From 3e51649a3e16f7bad8eeb2c5eb99eb4332e7e528 Mon Sep 17 00:00:00 2001 From: JiahuiPeng <46921893+804873052@users.noreply.github.com> Date: Mon, 1 Nov 2021 14:30:36 +0800 Subject: [PATCH] Refresh track2 autorest31 (#15977) * [Release] sdk/resourcemanager/operationalinsights/armoperationalinsights/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/operationsmanagement/armoperationsmanagement/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/web/armweb/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/authorization/armauthorization/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/cognitiveservices/armcognitiveservices/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/containerregistry/armcontainerregistry/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/mysql/armmysql/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/mysql/armmysqlflexibleservers/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/sql/armsql/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/streamanalytics/armstreamanalytics/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/keyvault/armkeyvault/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/notificationhubs/armnotificationhubs/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/managementgroups/armmanagementgroups/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/postgresql/armpostgresql/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/privatedns/armprivatedns/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/redis/armredis/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/servicebus/armservicebus/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/compute/armcompute/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/databricks/armdatabricks/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/msi/armmsi/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/resources/armresources/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/eventhub/armeventhub/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/servicefabric/armservicefabric/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/alertsmanagement/armalertsmanagement/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/appplatform/armappplatform/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/consumption/armconsumption/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/datalake-store/armdatalakestore/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/iothub/armiothub/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/logic/armlogic/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/mediaservices/armmediaservices/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/network/armnetwork/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/agrifood/armagrifood/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/cdn/armcdn/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/scheduler/armscheduler/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/search/armsearch/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/recoveryservices/armrecoveryservices/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/resourcehealth/armresourcehealth/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/containerservice/armcontainerservice/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/eventgrid/armeventgrid/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/monitor/armmonitor/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/relay/armrelay/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/security/armsecurity/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/storage/armstorage/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/apimanagement/armapimanagement/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/automation/armautomation/0.2.0 generation from spec commit: 69eacf00a36d565d3220d5dd6f4a5293664f1ae9 * [Release] sdk/resourcemanager/cosmos/armcosmos/0.2.0 * upgrade autorest version 30-->31 * fix README * fix changelog * replace azidentity R0 * gofmt example --- eng/scripts/build.ps1 | 2 +- .../agrifood/armagrifood/CHANGELOG.md | 7 + .../agrifood/armagrifood/README.md | 17 +- .../agrifood/armagrifood/autorest.md | 6 +- .../agrifood/armagrifood/go.mod | 4 +- .../agrifood/armagrifood/go.sum | 31 +- .../armagrifood/zz_generated_constants.go | 2 +- .../zz_generated_extensions_client.go | 28 +- ...zz_generated_farmbeatsextensions_client.go | 24 +- .../zz_generated_farmbeatsmodels_client.go | 30 +- .../zz_generated_locations_client.go | 22 +- .../armagrifood/zz_generated_models.go | 15 +- .../zz_generated_operations_client.go | 18 +- .../armagrifood/zz_generated_pagers.go | 5 +- .../armagrifood/zz_generated_time_rfc3339.go | 27 + .../armalertsmanagement/CHANGELOG.md | 9 +- .../armalertsmanagement/README.md | 17 +- .../armalertsmanagement/autorest.md | 6 +- .../armalertsmanagement/go.mod | 4 +- .../armalertsmanagement/go.sum | 31 +- .../zz_generated_actionrules_client.go | 25 +- .../zz_generated_alerts_client.go | 25 +- .../zz_generated_constants.go | 2 +- .../zz_generated_models.go | 42 +- .../zz_generated_operations_client.go | 15 +- .../zz_generated_polymorphic_helpers.go | 38 + ...enerated_smartdetectoralertrules_client.go | 23 +- .../zz_generated_smartgroups_client.go | 21 +- .../zz_generated_time_rfc3339.go | 27 + .../armapimanagement/CHANGELOG.md | 7 + .../apimanagement/armapimanagement/README.md | 17 +- .../armapimanagement/autorest.md | 6 +- .../apimanagement/armapimanagement/go.mod | 4 +- .../apimanagement/armapimanagement/go.sum | 31 +- .../zz_generated_api_client.go | 43 +- .../zz_generated_apidiagnostic_client.go | 40 +- .../zz_generated_apiexport_client.go | 24 +- .../zz_generated_apiissue_client.go | 40 +- .../zz_generated_apiissueattachment_client.go | 36 +- .../zz_generated_apiissuecomment_client.go | 36 +- ...zz_generated_apimanagementclient_client.go | 21 +- ...enerated_apimanagementoperations_client.go | 20 +- ...z_generated_apimanagementservice_client.go | 55 +- ...nerated_apimanagementserviceskus_client.go | 24 +- .../zz_generated_apimanagementskus_client.go | 24 +- .../zz_generated_apioperation_client.go | 40 +- .../zz_generated_apioperationpolicy_client.go | 36 +- .../zz_generated_apipolicy_client.go | 36 +- .../zz_generated_apiproduct_client.go | 24 +- .../zz_generated_apirelease_client.go | 40 +- .../zz_generated_apirevision_client.go | 24 +- .../zz_generated_apischema_client.go | 35 +- .../zz_generated_apitagdescription_client.go | 36 +- .../zz_generated_apiversionset_client.go | 40 +- ...zz_generated_authorizationserver_client.go | 44 +- .../zz_generated_backend_client.go | 42 +- .../zz_generated_cache_client.go | 40 +- .../zz_generated_certificate_client.go | 40 +- .../zz_generated_constants.go | 2 +- .../zz_generated_contentitem_client.go | 36 +- .../zz_generated_contenttype_client.go | 34 +- .../zz_generated_delegationsettings_client.go | 36 +- .../zz_generated_deletedservices_client.go | 29 +- .../zz_generated_diagnostic_client.go | 40 +- .../zz_generated_emailtemplate_client.go | 40 +- .../zz_generated_gateway_client.go | 50 +- .../zz_generated_gatewayapi_client.go | 32 +- ...ated_gatewaycertificateauthority_client.go | 36 +- ...ted_gatewayhostnameconfiguration_client.go | 36 +- .../zz_generated_group_client.go | 40 +- .../zz_generated_groupuser_client.go | 32 +- .../zz_generated_identityprovider_client.go | 44 +- .../zz_generated_issue_client.go | 28 +- .../zz_generated_logger_client.go | 40 +- .../armapimanagement/zz_generated_models.go | 213 +-- .../zz_generated_namedvalue_client.go | 43 +- .../zz_generated_networkstatus_client.go | 28 +- .../zz_generated_notification_client.go | 32 +- ...rated_notificationrecipientemail_client.go | 32 +- ...erated_notificationrecipientuser_client.go | 32 +- ..._generated_openidconnectprovider_client.go | 44 +- .../zz_generated_operation_client.go | 24 +- ...oundnetworkdependenciesendpoints_client.go | 24 +- .../armapimanagement/zz_generated_pagers.go | 5 +- .../zz_generated_policy_client.go | 36 +- .../zz_generated_policydescription_client.go | 24 +- .../armapimanagement/zz_generated_pollers.go | 3 +- .../zz_generated_portalrevision_client.go | 35 +- .../zz_generated_portalsettings_client.go | 24 +- ...erated_privateendpointconnection_client.go | 39 +- .../zz_generated_product_client.go | 44 +- .../zz_generated_productapi_client.go | 32 +- .../zz_generated_productgroup_client.go | 32 +- .../zz_generated_productpolicy_client.go | 36 +- ...z_generated_productsubscriptions_client.go | 24 +- .../zz_generated_quotabycounterkeys_client.go | 28 +- .../zz_generated_quotabyperiodkeys_client.go | 28 +- .../zz_generated_region_client.go | 24 +- .../zz_generated_reports_client.go | 52 +- .../zz_generated_response_types.go | 43 +- .../zz_generated_signinsettings_client.go | 32 +- .../zz_generated_signupsettings_client.go | 32 +- .../zz_generated_subscription_client.go | 48 +- .../zz_generated_tag_client.go | 88 +- .../zz_generated_tagresource_client.go | 24 +- .../zz_generated_tenantaccess_client.go | 46 +- .../zz_generated_tenantaccessgit_client.go | 24 +- ...zz_generated_tenantconfiguration_client.go | 29 +- .../zz_generated_tenantsettings_client.go | 28 +- .../zz_generated_time_rfc3339.go | 27 + .../zz_generated_user_client.go | 48 +- ...nerated_userconfirmationpassword_client.go | 22 +- .../zz_generated_usergroup_client.go | 24 +- .../zz_generated_useridentities_client.go | 24 +- .../zz_generated_usersubscription_client.go | 28 +- .../appplatform/armappplatform/CHANGELOG.md | 9 +- .../appplatform/armappplatform/README.md | 17 +- .../appplatform/armappplatform/autorest.md | 6 +- .../appplatform/armappplatform/go.mod | 4 +- .../appplatform/armappplatform/go.sum | 31 +- .../zz_generated_apps_client.go | 41 +- .../zz_generated_bindings_client.go | 33 +- .../zz_generated_certificates_client.go | 31 +- .../zz_generated_configservers_client.go | 29 +- .../armappplatform/zz_generated_constants.go | 86 +- .../zz_generated_customdomains_client.go | 33 +- .../zz_generated_deployments_client.go | 299 +++- .../armappplatform/zz_generated_models.go | 945 ++++++++++- .../zz_generated_monitoringsettings_client.go | 27 +- .../zz_generated_operations_client.go | 20 +- .../armappplatform/zz_generated_pagers.go | 59 +- .../armappplatform/zz_generated_pollers.go | 304 +++- .../zz_generated_polymorphic_helpers.go | 181 +++ .../zz_generated_response_types.go | 405 ++++- .../zz_generated_runtimeversions_client.go | 20 +- .../zz_generated_services_client.go | 223 ++- .../zz_generated_skus_client.go | 24 +- .../zz_generated_storages_client.go} | 196 +-- .../zz_generated_time_rfc3339.go | 27 + .../armauthorization/CHANGELOG.md | 7 + .../authorization/armauthorization/README.md | 17 +- .../armauthorization/autorest.md | 6 +- .../authorization/armauthorization/go.mod | 4 +- .../authorization/armauthorization/go.sum | 31 +- ...ated_accessreviewdefaultsettings_client.go | 24 +- ...z_generated_accessreviewinstance_client.go | 20 +- ...ed_accessreviewinstancedecisions_client.go | 22 +- ..._accessreviewinstancemydecisions_client.go | 26 +- ..._generated_accessreviewinstances_client.go | 24 +- ...ewinstancesassignedformyapproval_client.go | 24 +- ..._accessreviewscheduledefinitions_client.go | 26 +- ...definitionsassignedformyapproval_client.go | 18 +- .../zz_generated_constants.go | 2 +- .../zz_generated_denyassignments_client.go | 50 +- ...generated_eligiblechildresources_client.go | 24 +- .../armauthorization/zz_generated_models.go | 183 +-- .../zz_generated_operations_client.go | 18 +- .../armauthorization/zz_generated_pagers.go | 5 +- .../zz_generated_permissions_client.go | 33 +- .../zz_generated_polymorphic_helpers.go | 38 + ...rated_provideroperationsmetadata_client.go | 26 +- ..._generated_roleassignmentmetrics_client.go | 22 +- .../zz_generated_roleassignments_client.go | 92 +- ..._roleassignmentscheduleinstances_client.go | 30 +- ...d_roleassignmentschedulerequests_client.go | 38 +- ...enerated_roleassignmentschedules_client.go | 30 +- .../zz_generated_roledefinitions_client.go | 45 +- ...roleeligibilityscheduleinstances_client.go | 30 +- ..._roleeligibilityschedulerequests_client.go | 38 +- ...nerated_roleeligibilityschedules_client.go | 30 +- ...generated_rolemanagementpolicies_client.go | 38 +- ..._rolemanagementpolicyassignments_client.go | 38 +- .../zz_generated_time_rfc3339.go | 27 + .../automation/armautomation/CHANGELOG.md | 9 +- .../automation/armautomation/README.md | 17 +- .../automation/armautomation/autorest.md | 6 +- .../automation/armautomation/go.mod | 4 +- .../automation/armautomation/go.sum | 31 +- .../zz_generated_activity_client.go | 24 +- ...ted_agentregistrationinformation_client.go | 24 +- .../zz_generated_automationaccount_client.go | 30 +- .../zz_generated_automationclient_client.go | 22 +- .../zz_generated_certificate_client.go | 28 +- .../zz_generated_connection_client.go | 28 +- .../zz_generated_connectiontype_client.go | 26 +- .../armautomation/zz_generated_constants.go | 2 +- .../zz_generated_credential_client.go | 28 +- .../zz_generated_dsccompilationjob_client.go | 25 +- ...enerated_dsccompilationjobstream_client.go | 22 +- .../zz_generated_dscconfiguration_client.go | 34 +- .../zz_generated_dscnode_client.go | 26 +- ...z_generated_dscnodeconfiguration_client.go | 25 +- .../zz_generated_fields_client.go | 22 +- ...nerated_hybridrunbookworkergroup_client.go | 28 +- ...z_generated_hybridrunbookworkers_client.go | 26 +- .../armautomation/zz_generated_job_client.go | 26 +- .../zz_generated_jobschedule_client.go | 26 +- .../zz_generated_jobstream_client.go | 24 +- .../armautomation/zz_generated_keys_client.go | 22 +- .../zz_generated_linkedworkspace_client.go | 22 +- .../armautomation/zz_generated_models.go | 615 +++---- .../zz_generated_module_client.go | 28 +- ...z_generated_nodecountinformation_client.go | 22 +- .../zz_generated_nodereports_client.go | 26 +- .../zz_generated_objectdatatypes_client.go | 24 +- .../zz_generated_operations_client.go | 18 +- .../armautomation/zz_generated_pagers.go | 5 +- .../armautomation/zz_generated_pollers.go | 3 +- ...rated_privateendpointconnections_client.go | 23 +- ...z_generated_privatelinkresources_client.go | 22 +- .../zz_generated_python2package_client.go | 28 +- .../zz_generated_response_types.go | 15 +- .../zz_generated_runbook_client.go | 27 +- .../zz_generated_runbookdraft_client.go | 23 +- .../zz_generated_schedule_client.go | 28 +- ...reupdateconfigurationmachineruns_client.go | 24 +- ..._softwareupdateconfigurationruns_client.go | 24 +- ...ted_softwareupdateconfigurations_client.go | 26 +- .../zz_generated_sourcecontrol_client.go | 28 +- ...z_generated_sourcecontrolsyncjob_client.go | 26 +- ...ated_sourcecontrolsyncjobstreams_client.go | 24 +- .../zz_generated_statistics_client.go | 22 +- .../zz_generated_testjob_client.go | 24 +- .../zz_generated_testjobstreams_client.go | 24 +- .../zz_generated_time_rfc3339.go | 27 + .../zz_generated_usages_client.go | 22 +- .../zz_generated_variable_client.go | 28 +- .../zz_generated_watcher_client.go | 28 +- .../zz_generated_webhook_client.go | 30 +- sdk/resourcemanager/cdn/armcdn/CHANGELOG.md | 9 +- sdk/resourcemanager/cdn/armcdn/README.md | 17 +- sdk/resourcemanager/cdn/armcdn/autorest.md | 6 +- sdk/resourcemanager/cdn/armcdn/go.mod | 4 +- sdk/resourcemanager/cdn/armcdn/go.sum | 31 +- .../zz_generated_afdcustomdomains_client.go | 16 +- .../zz_generated_afdendpoints_client.go | 20 +- .../zz_generated_afdorigingroups_client.go | 18 +- .../armcdn/zz_generated_afdorigins_client.go | 16 +- .../armcdn/zz_generated_afdprofiles_client.go | 17 +- ...zz_generated_cdnmanagementclient_client.go | 19 +- .../cdn/armcdn/zz_generated_constants.go | 2 +- .../zz_generated_customdomains_client.go | 16 +- .../armcdn/zz_generated_edgenodes_client.go | 15 +- .../armcdn/zz_generated_endpoints_client.go | 20 +- .../zz_generated_loganalytics_client.go | 25 +- .../zz_generated_managedrulesets_client.go | 15 +- .../cdn/armcdn/zz_generated_models.go | 126 +- .../armcdn/zz_generated_operations_client.go | 15 +- .../zz_generated_origingroups_client.go | 16 +- .../cdn/armcdn/zz_generated_origins_client.go | 16 +- .../armcdn/zz_generated_policies_client.go | 16 +- .../zz_generated_polymorphic_helpers.go | 95 ++ .../armcdn/zz_generated_profiles_client.go | 24 +- .../zz_generated_resourceusage_client.go | 15 +- .../cdn/armcdn/zz_generated_response_types.go | 100 ++ .../cdn/armcdn/zz_generated_routes_client.go | 16 +- .../cdn/armcdn/zz_generated_rules_client.go | 16 +- .../armcdn/zz_generated_rulesets_client.go | 18 +- .../cdn/armcdn/zz_generated_secrets_client.go | 16 +- .../zz_generated_securitypolicies_client.go | 16 +- .../cdn/armcdn/zz_generated_time_rfc3339.go | 27 + .../armcdn/zz_generated_validate_client.go | 15 +- .../armcognitiveservices/CHANGELOG.md | 9 +- .../armcognitiveservices/README.md | 17 +- .../armcognitiveservices/autorest.md | 6 +- .../armcognitiveservices/go.mod | 4 +- .../armcognitiveservices/go.sum | 31 +- .../zz_generated_accounts_client.go | 33 +- ...ognitiveservicesmanagementclient_client.go | 24 +- .../zz_generated_constants.go | 2 +- .../zz_generated_deletedaccounts_client.go | 23 +- .../zz_generated_models.go | 15 +- .../zz_generated_operations_client.go | 18 +- .../zz_generated_pagers.go | 5 +- .../zz_generated_pollers.go | 3 +- ...rated_privateendpointconnections_client.go | 23 +- ...z_generated_privatelinkresources_client.go | 22 +- .../zz_generated_resourceskus_client.go | 22 +- .../zz_generated_response_types.go | 15 +- .../zz_generated_time_rfc3339.go | 27 + .../compute/armcompute/CHANGELOG.md | 7 + .../compute/armcompute/README.md | 17 +- .../compute/armcompute/autorest.md | 6 +- .../example_availabilitysets_test.go | 5 +- .../compute/armcompute/example_disks_test.go | 5 +- .../example_virtualmachineextensions_test.go | 5 +- .../example_virtualmachines_test.go | 19 +- .../example_virtualmachinescalesets_test.go | 15 +- sdk/resourcemanager/compute/armcompute/go.mod | 6 +- sdk/resourcemanager/compute/armcompute/go.sum | 22 +- .../zz_generated_availabilitysets_client.go | 32 +- ...erated_capacityreservationgroups_client.go | 30 +- ...z_generated_capacityreservations_client.go | 23 +- ...ted_cloudserviceoperatingsystems_client.go | 28 +- ...erated_cloudserviceroleinstances_client.go | 25 +- .../zz_generated_cloudserviceroles_client.go | 24 +- .../zz_generated_cloudservices_client.go | 27 +- ...erated_cloudservicesupdatedomain_client.go | 25 +- .../zz_generated_communitygalleries_client.go | 108 ++ ...generated_communitygalleryimages_client.go | 112 ++ ...ed_communitygalleryimageversions_client.go | 116 ++ .../armcompute/zz_generated_constants.go | 2 +- ...zz_generated_dedicatedhostgroups_client.go | 30 +- .../zz_generated_dedicatedhosts_client.go | 23 +- .../zz_generated_diskaccesses_client.go | 31 +- .../zz_generated_diskencryptionsets_client.go | 27 +- .../zz_generated_diskrestorepoint_client.go | 23 +- .../armcompute/zz_generated_disks_client.go | 25 +- .../zz_generated_galleries_client.go | 25 +- ...zz_generated_galleryapplications_client.go | 23 +- ...rated_galleryapplicationversions_client.go | 23 +- .../zz_generated_galleryimages_client.go | 23 +- ...z_generated_galleryimageversions_client.go | 23 +- ..._generated_gallerysharingprofile_client.go | 19 +- .../armcompute/zz_generated_images_client.go | 25 +- .../zz_generated_loganalytics_client.go | 19 +- .../compute/armcompute/zz_generated_models.go | 472 +++--- .../zz_generated_operations_client.go | 18 +- .../compute/armcompute/zz_generated_pagers.go | 5 +- .../armcompute/zz_generated_pollers.go | 3 +- ...nerated_proximityplacementgroups_client.go | 30 +- .../zz_generated_resourceskus_client.go | 22 +- .../armcompute/zz_generated_response_types.go | 285 +++- ...enerated_restorepointcollections_client.go | 29 +- .../zz_generated_restorepoints_client.go | 21 +- .../zz_generated_sharedgalleries_client.go | 24 +- ...zz_generated_sharedgalleryimages_client.go | 24 +- ...rated_sharedgalleryimageversions_client.go | 24 +- .../zz_generated_snapshots_client.go | 25 +- .../zz_generated_sshpublickeys_client.go | 32 +- .../armcompute/zz_generated_time_rfc3339.go | 27 + .../armcompute/zz_generated_usage_client.go | 22 +- ...ed_virtualmachineextensionimages_client.go | 26 +- ...nerated_virtualmachineextensions_client.go | 23 +- ...z_generated_virtualmachineimages_client.go | 30 +- ...ted_virtualmachineimagesedgezone_client.go | 30 +- ...erated_virtualmachineruncommands_client.go | 27 +- .../zz_generated_virtualmachines_client.go | 35 +- ...virtualmachinescalesetextensions_client.go | 23 +- ...almachinescalesetrollingupgrades_client.go | 21 +- ...enerated_virtualmachinescalesets_client.go | 37 +- ...rtualmachinescalesetvmextensions_client.go | 23 +- ...tualmachinescalesetvmruncommands_client.go | 23 +- ...erated_virtualmachinescalesetvms_client.go | 29 +- ...zz_generated_virtualmachinesizes_client.go | 22 +- .../consumption/armconsumption/CHANGELOG.md | 7 + .../consumption/armconsumption/README.md | 17 +- .../consumption/armconsumption/autorest.md | 6 +- .../consumption/armconsumption/go.mod | 4 +- .../consumption/armconsumption/go.sum | 31 +- .../zz_generated_aggregatedcost_client.go | 24 +- .../zz_generated_balances_client.go | 24 +- .../zz_generated_budgets_client.go | 38 +- .../zz_generated_charges_client.go | 24 +- .../armconsumption/zz_generated_constants.go | 2 +- .../zz_generated_credits_client.go | 22 +- .../zz_generated_events_client.go | 24 +- .../zz_generated_lots_client.go | 24 +- .../zz_generated_marketplaces_client.go | 26 +- .../armconsumption/zz_generated_models.go | 153 +- .../zz_generated_operations_client.go | 18 +- .../armconsumption/zz_generated_pagers.go | 5 +- .../zz_generated_polymorphic_helpers.go | 57 + .../zz_generated_pricesheet_client.go | 24 +- ...reservationrecommendationdetails_client.go | 24 +- ...rated_reservationrecommendations_client.go | 24 +- ...zz_generated_reservationsdetails_client.go | 29 +- ..._generated_reservationssummaries_client.go | 29 +- ...enerated_reservationtransactions_client.go | 24 +- .../zz_generated_tags_client.go | 24 +- .../zz_generated_time_rfc3339.go | 27 + .../zz_generated_usagedetails_client.go | 26 +- .../armcontainerregistry/CHANGELOG.md | 7 + .../armcontainerregistry/README.md | 17 +- .../armcontainerregistry/autorest.md | 6 +- .../armcontainerregistry/go.mod | 4 +- .../armcontainerregistry/go.sum | 31 +- .../zz_generated_agentpools_client.go | 25 +- ...zz_generated_connectedregistries_client.go | 35 +- .../zz_generated_constants.go | 10 +- .../zz_generated_exportpipelines_client.go | 31 +- .../zz_generated_importpipelines_client.go | 31 +- .../zz_generated_models.go | 176 +- .../zz_generated_operations_client.go | 20 +- .../zz_generated_pagers.go | 5 +- .../zz_generated_pipelineruns_client.go | 31 +- .../zz_generated_pollers.go | 3 +- .../zz_generated_polymorphic_helpers.go | 57 + ...rated_privateendpointconnections_client.go | 31 +- .../zz_generated_registries_client.go | 63 +- .../zz_generated_replications_client.go | 33 +- .../zz_generated_response_types.go | 85 +- .../zz_generated_runs_client.go | 27 +- .../zz_generated_scopemaps_client.go | 33 +- .../zz_generated_taskruns_client.go | 25 +- .../zz_generated_tasks_client.go | 25 +- .../zz_generated_time_rfc3339.go | 27 + .../zz_generated_tokens_client.go | 33 +- .../zz_generated_webhooks_client.go | 45 +- .../armcontainerservice/CHANGELOG.md | 7 + .../armcontainerservice/README.md | 17 +- .../armcontainerservice/autorest.md | 6 +- .../armcontainerservice/go.mod | 4 +- .../armcontainerservice/go.sum | 31 +- .../zz_generated_agentpools_client.go | 41 +- .../zz_generated_constants.go | 2 +- ...erated_maintenanceconfigurations_client.go | 34 +- .../zz_generated_managedclusters_client.go | 81 +- .../zz_generated_models.go | 90 +- .../zz_generated_operations_client.go | 20 +- .../zz_generated_pagers.go | 5 +- .../zz_generated_pollers.go | 3 +- ...rated_privateendpointconnections_client.go | 33 +- ...z_generated_privatelinkresources_client.go | 24 +- ...ated_resolveprivatelinkserviceid_client.go | 24 +- .../zz_generated_response_types.go | 29 +- .../zz_generated_snapshots_client.go | 42 +- .../zz_generated_time_rfc3339.go | 27 + .../cosmos/armcosmos/CHANGELOG.md | 7 + .../cosmos/armcosmos/README.md | 17 +- .../cosmos/armcosmos/autorest.md | 6 +- sdk/resourcemanager/cosmos/armcosmos/go.mod | 4 +- sdk/resourcemanager/cosmos/armcosmos/go.sum | 31 +- .../zz_generated_cassandraclusters_client.go | 338 ++-- ...z_generated_cassandradatacenters_client.go | 33 +- .../zz_generated_cassandraresources_client.go | 691 +------- .../zz_generated_collection_client.go | 32 +- ...zz_generated_collectionpartition_client.go | 28 +- ...erated_collectionpartitionregion_client.go | 24 +- .../zz_generated_collectionregion_client.go | 24 +- .../armcosmos/zz_generated_constants.go | 152 +- .../armcosmos/zz_generated_database_client.go | 32 +- ..._generated_databaseaccountregion_client.go | 24 +- .../zz_generated_databaseaccounts_client.go | 75 +- .../zz_generated_graphresources_client.go | 324 ---- .../zz_generated_gremlinresources_client.go | 63 +- ...nt.go => zz_generated_locations_client.go} | 92 +- .../cosmos/armcosmos/zz_generated_models.go | 1427 +++++------------ .../zz_generated_mongodbresources_client.go | 147 +- .../zz_generated_notebookworkspaces_client.go | 39 +- .../zz_generated_operations_client.go | 20 +- .../cosmos/armcosmos/zz_generated_pagers.go | 5 +- ...zz_generated_partitionkeyrangeid_client.go | 24 +- ...erated_partitionkeyrangeidregion_client.go | 24 +- .../zz_generated_percentile_client.go | 24 +- ...generated_percentilesourcetarget_client.go | 24 +- .../zz_generated_percentiletarget_client.go | 24 +- .../cosmos/armcosmos/zz_generated_pollers.go | 514 ++---- .../zz_generated_polymorphic_helpers.go | 36 +- ...rated_privateendpointconnections_client.go | 31 +- ...z_generated_privatelinkresources_client.go | 28 +- .../armcosmos/zz_generated_response_types.go | 923 ++++------- ...rated_restorabledatabaseaccounts_client.go | 32 +- ...ted_restorablemongodbcollections_client.go | 24 +- ...rated_restorablemongodbdatabases_client.go | 24 +- ...rated_restorablemongodbresources_client.go | 24 +- ...enerated_restorablesqlcontainers_client.go | 24 +- ...generated_restorablesqldatabases_client.go | 24 +- ...generated_restorablesqlresources_client.go | 24 +- .../zz_generated_sqlresources_client.go | 125 +- .../zz_generated_tableresources_client.go | 41 +- .../armcosmos/zz_generated_time_rfc3339.go | 27 + .../databricks/armdatabricks/CHANGELOG.md | 9 +- .../databricks/armdatabricks/README.md | 17 +- .../databricks/armdatabricks/autorest.md | 6 +- .../databricks/armdatabricks/go.mod | 4 +- .../databricks/armdatabricks/go.sum | 31 +- .../armdatabricks/zz_generated_constants.go | 2 +- .../armdatabricks/zz_generated_models.go | 21 +- .../zz_generated_operations_client.go | 18 +- ...oundnetworkdependenciesendpoints_client.go | 22 +- .../armdatabricks/zz_generated_pagers.go | 5 +- .../armdatabricks/zz_generated_pollers.go | 3 +- ...rated_privateendpointconnections_client.go | 23 +- ...z_generated_privatelinkresources_client.go | 24 +- .../zz_generated_response_types.go | 17 +- .../zz_generated_time_rfc3339.go | 27 + .../zz_generated_vnetpeering_client.go | 23 +- .../zz_generated_workspaces_client.go | 25 +- .../armdatalakeanalytics/CHANGELOG.md | 9 +- .../armdatalakeanalytics/README.md | 17 +- .../armdatalakeanalytics/autorest.md | 6 +- .../armdatalakeanalytics/go.mod | 4 +- .../armdatalakeanalytics/go.sum | 31 +- .../zz_generated_accounts_client.go | 29 +- .../zz_generated_computepolicies_client.go | 28 +- .../zz_generated_constants.go | 2 +- ..._generated_datalakestoreaccounts_client.go | 24 +- .../zz_generated_firewallrules_client.go | 28 +- .../zz_generated_locations_client.go | 22 +- .../zz_generated_models.go | 21 +- .../zz_generated_operations_client.go | 18 +- .../zz_generated_pagers.go | 5 +- .../zz_generated_pollers.go | 3 +- .../zz_generated_response_types.go | 9 +- .../zz_generated_storageaccounts_client.go | 30 +- .../zz_generated_time_rfc3339.go | 27 + .../armdatalakestore/CHANGELOG.md | 9 +- .../datalake-store/armdatalakestore/README.md | 17 +- .../armdatalakestore/autorest.md | 6 +- .../datalake-store/armdatalakestore/go.mod | 4 +- .../datalake-store/armdatalakestore/go.sum | 31 +- .../zz_generated_accounts_client.go | 29 +- .../zz_generated_constants.go | 2 +- .../zz_generated_firewallrules_client.go | 28 +- .../zz_generated_locations_client.go | 24 +- .../armdatalakestore/zz_generated_models.go | 15 +- .../zz_generated_operations_client.go | 18 +- .../armdatalakestore/zz_generated_pagers.go | 5 +- .../armdatalakestore/zz_generated_pollers.go | 3 +- .../zz_generated_response_types.go | 9 +- .../zz_generated_time_rfc3339.go | 27 + .../zz_generated_trustedidproviders_client.go | 28 +- ...zz_generated_virtualnetworkrules_client.go | 28 +- .../eventgrid/armeventgrid/CHANGELOG.md | 7 + .../eventgrid/armeventgrid/README.md | 17 +- .../eventgrid/armeventgrid/autorest.md | 6 +- .../eventgrid/armeventgrid/go.mod | 4 +- .../eventgrid/armeventgrid/go.sum | 31 +- .../armeventgrid/zz_generated_constants.go | 335 +--- .../zz_generated_domains_client.go | 47 +- .../zz_generated_domaintopics_client.go | 33 +- .../zz_generated_eventchannels_client.go | 317 ---- .../zz_generated_eventsubscriptions_client.go | 97 +- .../zz_generated_extensiontopics_client.go | 24 +- .../armeventgrid/zz_generated_models.go | 1165 +------------- .../zz_generated_operations_client.go | 20 +- .../armeventgrid/zz_generated_pagers.go | 437 +---- .../zz_generated_partnernamespaces_client.go | 574 ------- ...z_generated_partnerregistrations_client.go | 403 ----- ...d_partnertopiceventsubscriptions_client.go | 545 ------- .../zz_generated_partnertopics_client.go | 488 ------ .../armeventgrid/zz_generated_pollers.go | 347 +--- .../zz_generated_polymorphic_helpers.go | 109 +- ...rated_privateendpointconnections_client.go | 65 +- ...z_generated_privatelinkresources_client.go | 30 +- .../zz_generated_response_types.go | 701 +------- ...ed_systemtopiceventsubscriptions_client.go | 43 +- .../zz_generated_systemtopics_client.go | 39 +- .../armeventgrid/zz_generated_time_rfc3339.go | 27 + .../zz_generated_topics_client.go | 51 +- .../zz_generated_topictypes_client.go | 32 +- .../eventhub/armeventhub/CHANGELOG.md | 7 + .../eventhub/armeventhub/README.md | 17 +- .../eventhub/armeventhub/autorest.md | 6 +- .../eventhub/armeventhub/go.mod | 4 +- .../eventhub/armeventhub/go.sum | 31 +- .../zz_generated_clusters_client.go | 45 +- .../zz_generated_configuration_client.go | 28 +- .../armeventhub/zz_generated_constants.go | 44 +- .../zz_generated_consumergroups_client.go | 34 +- ...enerated_disasterrecoveryconfigs_client.go | 56 +- .../zz_generated_eventhubs_client.go | 56 +- .../armeventhub/zz_generated_models.go | 350 ++-- .../zz_generated_namespaces_client.go | 138 +- .../zz_generated_operations_client.go | 20 +- .../armeventhub/zz_generated_pagers.go | 59 +- .../armeventhub/zz_generated_pollers.go | 3 +- ...rated_privateendpointconnections_client.go | 33 +- ...z_generated_privatelinkresources_client.go | 24 +- .../zz_generated_response_types.go | 69 +- .../zz_generated_schemaregistry_client.go | 310 ++++ .../armeventhub/zz_generated_time_rfc3339.go | 27 + .../iothub/armiothub/CHANGELOG.md | 9 +- .../iothub/armiothub/README.md | 17 +- .../iothub/armiothub/autorest.md | 6 +- sdk/resourcemanager/iothub/armiothub/go.mod | 4 +- sdk/resourcemanager/iothub/armiothub/go.sum | 31 +- .../zz_generated_certificates_client.go | 30 +- .../armiothub/zz_generated_constants.go | 2 +- .../armiothub/zz_generated_iothub_client.go | 19 +- .../zz_generated_iothubresource_client.go | 57 +- .../iothub/armiothub/zz_generated_models.go | 69 +- .../zz_generated_operations_client.go | 18 +- .../iothub/armiothub/zz_generated_pagers.go | 5 +- .../iothub/armiothub/zz_generated_pollers.go | 3 +- ...rated_privateendpointconnections_client.go | 23 +- ...z_generated_privatelinkresources_client.go | 24 +- ...generated_resourceprovidercommon_client.go | 22 +- .../armiothub/zz_generated_response_types.go | 15 +- .../armiothub/zz_generated_time_rfc1123.go | 27 + .../keyvault/armkeyvault/CHANGELOG.md | 7 + .../keyvault/armkeyvault/README.md | 17 +- .../keyvault/armkeyvault/autorest.md | 6 +- .../armkeyvault/example_secrets_test.go | 3 +- .../armkeyvault/example_vaults_test.go | 13 +- .../keyvault/armkeyvault/go.mod | 6 +- .../keyvault/armkeyvault/go.sum | 22 +- .../armkeyvault/zz_generated_constants.go | 2 +- .../armkeyvault/zz_generated_keys_client.go | 30 +- .../zz_generated_managedhsms_client.go | 31 +- ...d_mhsmprivateendpointconnections_client.go | 27 +- ...nerated_mhsmprivatelinkresources_client.go | 22 +- .../armkeyvault/zz_generated_models.go | 71 +- .../zz_generated_operations_client.go | 18 +- .../armkeyvault/zz_generated_pagers.go | 5 +- .../armkeyvault/zz_generated_pollers.go | 3 +- ...rated_privateendpointconnections_client.go | 27 +- ...z_generated_privatelinkresources_client.go | 22 +- .../zz_generated_response_types.go | 19 +- .../zz_generated_secrets_client.go | 28 +- .../armkeyvault/zz_generated_time_rfc3339.go | 27 + .../armkeyvault/zz_generated_time_unix.go | 27 + .../armkeyvault/zz_generated_vaults_client.go | 48 +- .../logic/armlogic/CHANGELOG.md | 9 +- sdk/resourcemanager/logic/armlogic/README.md | 17 +- .../logic/armlogic/autorest.md | 6 +- sdk/resourcemanager/logic/armlogic/go.mod | 4 +- sdk/resourcemanager/logic/armlogic/go.sum | 31 +- .../logic/armlogic/zz_generated_constants.go | 2 +- ...ted_integrationaccountagreements_client.go | 28 +- ...ted_integrationaccountassemblies_client.go | 28 +- ...rationaccountbatchconfigurations_client.go | 26 +- ...d_integrationaccountcertificates_client.go | 26 +- ...generated_integrationaccountmaps_client.go | 28 +- ...rated_integrationaccountpartners_client.go | 28 +- ...zz_generated_integrationaccounts_client.go | 36 +- ...erated_integrationaccountschemas_client.go | 28 +- ...rated_integrationaccountsessions_client.go | 26 +- ...eenvironmentmanagedapioperations_client.go | 22 +- ...ionserviceenvironmentmanagedapis_client.go | 23 +- ...nserviceenvironmentnetworkhealth_client.go | 22 +- ...d_integrationserviceenvironments_client.go | 27 +- ...ntegrationserviceenvironmentskus_client.go | 22 +- .../logic/armlogic/zz_generated_models.go | 255 +-- .../zz_generated_operations_client.go | 18 +- .../logic/armlogic/zz_generated_pagers.go | 5 +- .../logic/armlogic/zz_generated_pollers.go | 3 +- .../armlogic/zz_generated_response_types.go | 13 +- .../armlogic/zz_generated_time_rfc3339.go | 27 + ...ted_workflowrunactionrepetitions_client.go | 26 +- ...ctionrepetitionsrequesthistories_client.go | 24 +- ...orkflowrunactionrequesthistories_client.go | 24 +- .../zz_generated_workflowrunactions_client.go | 26 +- ...orkflowrunactionscoperepetitions_client.go | 24 +- ..._generated_workflowrunoperations_client.go | 22 +- .../zz_generated_workflowruns_client.go | 24 +- .../armlogic/zz_generated_workflows_client.go | 37 +- ...nerated_workflowtriggerhistories_client.go | 24 +- .../zz_generated_workflowtriggers_client.go | 28 +- .../zz_generated_workflowversions_client.go | 24 +- ...enerated_workflowversiontriggers_client.go | 22 +- .../armmanagementgroups/CHANGELOG.md | 9 +- .../armmanagementgroups/README.md | 17 +- .../armmanagementgroups/autorest.md | 6 +- .../armmanagementgroups/go.mod | 4 +- .../armmanagementgroups/go.sum | 31 +- .../zz_generated_constants.go | 2 +- .../zz_generated_entities_client.go | 20 +- .../zz_generated_hierarchysettings_client.go | 28 +- .../zz_generated_managementgroups_client.go | 29 +- ...zz_generated_managementgroupsapi_client.go | 22 +- ...ted_managementgroupsubscriptions_client.go | 26 +- .../zz_generated_models.go | 15 +- .../zz_generated_operations_client.go | 18 +- .../zz_generated_pagers.go | 5 +- .../zz_generated_pollers.go | 3 +- .../zz_generated_response_types.go | 7 +- .../zz_generated_time_rfc3339.go | 27 + .../armmediaservices/CHANGELOG.md | 9 +- .../mediaservices/armmediaservices/README.md | 17 +- .../armmediaservices/autorest.md | 6 +- .../mediaservices/armmediaservices/go.mod | 4 +- .../mediaservices/armmediaservices/go.sum | 31 +- .../zz_generated_accountfilters_client.go | 28 +- .../zz_generated_assetfilters_client.go | 28 +- .../zz_generated_assets_client.go | 34 +- .../zz_generated_constants.go | 2 +- .../zz_generated_contentkeypolicies_client.go | 30 +- .../zz_generated_jobs_client.go | 28 +- .../zz_generated_liveevents_client.go | 25 +- .../zz_generated_liveoutputs_client.go | 23 +- .../zz_generated_locations_client.go | 22 +- .../zz_generated_mediaservices_client.go | 32 +- .../armmediaservices/zz_generated_models.go | 203 +-- .../zz_generated_operations_client.go | 18 +- .../armmediaservices/zz_generated_pagers.go | 5 +- .../armmediaservices/zz_generated_pollers.go | 3 +- .../zz_generated_polymorphic_helpers.go | 475 ++++++ ...rated_privateendpointconnections_client.go | 26 +- ...z_generated_privatelinkresources_client.go | 24 +- .../zz_generated_response_types.go | 33 +- .../zz_generated_streamingendpoints_client.go | 25 +- .../zz_generated_streaminglocators_client.go | 30 +- .../zz_generated_streamingpolicies_client.go | 26 +- .../zz_generated_time_rfc3339.go | 27 + .../zz_generated_transforms_client.go | 28 +- .../monitor/armmonitor/CHANGELOG.md | 7 + .../monitor/armmonitor/README.md | 17 +- .../monitor/armmonitor/autorest.md | 6 +- sdk/resourcemanager/monitor/armmonitor/go.mod | 4 +- sdk/resourcemanager/monitor/armmonitor/go.sum | 31 +- .../zz_generated_actiongroups_client.go | 30 +- .../zz_generated_activitylogalerts_client.go | 30 +- .../zz_generated_activitylogs_client.go | 22 +- .../zz_generated_alertruleincidents_client.go | 24 +- .../zz_generated_alertrules_client.go | 30 +- .../zz_generated_autoscalesettings_client.go | 30 +- .../zz_generated_baselines_client.go | 24 +- .../armmonitor/zz_generated_constants.go | 2 +- ...enerated_datacollectionendpoints_client.go | 30 +- ...d_datacollectionruleassociations_client.go | 40 +- ...zz_generated_datacollectionrules_client.go | 30 +- .../zz_generated_diagnosticsettings_client.go | 38 +- ...rated_diagnosticsettingscategory_client.go | 30 +- .../zz_generated_eventcategories_client.go | 18 +- .../zz_generated_logprofiles_client.go | 28 +- .../zz_generated_metricalerts_client.go | 30 +- .../zz_generated_metricalertsstatus_client.go | 24 +- .../zz_generated_metricdefinitions_client.go | 24 +- .../zz_generated_metricnamespaces_client.go | 24 +- .../armmonitor/zz_generated_metrics_client.go | 26 +- .../monitor/armmonitor/zz_generated_models.go | 105 +- .../zz_generated_operations_client.go | 18 +- .../monitor/armmonitor/zz_generated_pagers.go | 5 +- .../armmonitor/zz_generated_pollers.go | 3 +- .../zz_generated_polymorphic_helpers.go | 114 ++ ...rated_privateendpointconnections_client.go | 23 +- ...z_generated_privatelinkresources_client.go | 24 +- ...rated_privatelinkscopedresources_client.go | 23 +- ..._privatelinkscopeoperationstatus_client.go | 22 +- .../zz_generated_privatelinkscopes_client.go | 29 +- .../armmonitor/zz_generated_response_types.go | 13 +- ...zz_generated_scheduledqueryrules_client.go | 30 +- .../zz_generated_tenantactivitylogs_client.go | 18 +- .../armmonitor/zz_generated_time_rfc3339.go | 27 + .../zz_generated_vminsights_client.go | 24 +- sdk/resourcemanager/msi/armmsi/CHANGELOG.md | 9 +- sdk/resourcemanager/msi/armmsi/README.md | 17 +- sdk/resourcemanager/msi/armmsi/autorest.md | 6 +- sdk/resourcemanager/msi/armmsi/go.mod | 4 +- sdk/resourcemanager/msi/armmsi/go.sum | 31 +- .../msi/armmsi/zz_generated_constants.go | 2 +- .../msi/armmsi/zz_generated_models.go | 3 +- .../armmsi/zz_generated_operations_client.go | 18 +- .../msi/armmsi/zz_generated_pagers.go | 5 +- ...nerated_systemassignedidentities_client.go | 24 +- ...generated_userassignedidentities_client.go | 30 +- .../mysql/armmysql/CHANGELOG.md | 9 +- sdk/resourcemanager/mysql/armmysql/README.md | 17 +- .../mysql/armmysql/autorest.md | 6 +- sdk/resourcemanager/mysql/armmysql/go.mod | 4 +- sdk/resourcemanager/mysql/armmysql/go.sum | 31 +- .../armmysql/zz_generated_advisors_client.go | 24 +- ..._generated_checknameavailability_client.go | 22 +- .../zz_generated_configurations_client.go | 23 +- .../mysql/armmysql/zz_generated_constants.go | 2 +- .../armmysql/zz_generated_databases_client.go | 23 +- .../zz_generated_firewallrules_client.go | 23 +- ...ted_locationbasedperformancetier_client.go | 22 +- ...dedactionsessionsoperationstatus_client.go | 22 +- ...drecommendedactionsessionsresult_client.go | 22 +- .../armmysql/zz_generated_logfiles_client.go | 22 +- .../mysql/armmysql/zz_generated_models.go | 99 +- ..._generated_mysqlmanagementclient_client.go | 21 +- .../zz_generated_operations_client.go | 18 +- .../mysql/armmysql/zz_generated_pagers.go | 5 +- .../mysql/armmysql/zz_generated_pollers.go | 3 +- .../zz_generated_polymorphic_helpers.go | 19 + ...rated_privateendpointconnections_client.go | 23 +- ...z_generated_privatelinkresources_client.go | 24 +- .../zz_generated_querytexts_client.go | 24 +- .../zz_generated_recommendedactions_client.go | 24 +- .../zz_generated_recoverableservers_client.go | 22 +- .../armmysql/zz_generated_replicas_client.go | 22 +- .../armmysql/zz_generated_response_types.go | 51 +- ...z_generated_serveradministrators_client.go | 23 +- ...rated_serverbasedperformancetier_client.go | 22 +- .../zz_generated_serverkeys_client.go | 23 +- .../zz_generated_serverparameters_client.go | 19 +- .../armmysql/zz_generated_servers_client.go | 25 +- ...ated_serversecurityalertpolicies_client.go | 23 +- .../armmysql/zz_generated_time_rfc3339.go | 27 + .../zz_generated_topquerystatistics_client.go | 24 +- ...zz_generated_virtualnetworkrules_client.go | 23 +- .../zz_generated_waitstatistics_client.go | 24 +- .../armmysqlflexibleservers/CHANGELOG.md | 9 +- .../mysql/armmysqlflexibleservers/README.md | 17 +- .../mysql/armmysqlflexibleservers/autorest.md | 6 +- .../mysql/armmysqlflexibleservers/go.mod | 4 +- .../mysql/armmysqlflexibleservers/go.sum | 31 +- .../zz_generated_backups_client.go | 24 +- ..._generated_checknameavailability_client.go | 22 +- ...d_checkvirtualnetworksubnetusage_client.go | 22 +- .../zz_generated_configurations_client.go | 23 +- .../zz_generated_constants.go | 2 +- .../zz_generated_databases_client.go | 23 +- .../zz_generated_firewallrules_client.go | 23 +- ...enerated_getprivatednszonesuffix_client.go | 18 +- ...erated_locationbasedcapabilities_client.go | 22 +- .../zz_generated_models.go | 33 +- .../zz_generated_operations_client.go | 18 +- .../zz_generated_pagers.go | 5 +- .../zz_generated_pollers.go | 3 +- .../zz_generated_replicas_client.go | 22 +- .../zz_generated_response_types.go | 29 +- .../zz_generated_servers_client.go | 25 +- .../zz_generated_time_rfc3339.go | 27 + .../network/armnetwork/CHANGELOG.md | 7 + .../network/armnetwork/README.md | 17 +- .../network/armnetwork/autorest.md | 6 +- .../armnetwork/example_loadbalancers_test.go | 7 +- .../example_networkinterfaces_test.go | 7 +- .../example_networksecuritygroups_test.go | 9 +- .../example_publicipaddresses_test.go | 7 +- .../armnetwork/example_securityrules_test.go | 9 +- .../armnetwork/example_subnets_test.go | 9 +- .../example_virtualnetworks_test.go | 9 +- sdk/resourcemanager/network/armnetwork/go.mod | 6 +- sdk/resourcemanager/network/armnetwork/go.sum | 22 +- ...atewayprivateendpointconnections_client.go | 31 +- ...ationgatewayprivatelinkresources_client.go | 24 +- ...zz_generated_applicationgateways_client.go | 75 +- ...erated_applicationsecuritygroups_client.go | 39 +- ...z_generated_availabledelegations_client.go | 24 +- ...erated_availableendpointservices_client.go | 24 +- ...ed_availableprivateendpointtypes_client.go | 28 +- ...vailableresourcegroupdelegations_client.go | 24 +- ...enerated_availableservicealiases_client.go | 28 +- ..._generated_azurefirewallfqdntags_client.go | 24 +- .../zz_generated_azurefirewalls_client.go | 37 +- .../zz_generated_bastionhosts_client.go | 37 +- ..._generated_bgpservicecommunities_client.go | 24 +- .../zz_generated_connectionmonitors_client.go | 41 +- .../armnetwork/zz_generated_constants.go | 135 +- .../zz_generated_customipprefixes_client.go | 39 +- .../zz_generated_ddoscustompolicies_client.go | 31 +- ...zz_generated_ddosprotectionplans_client.go | 39 +- ...z_generated_defaultsecurityrules_client.go | 28 +- .../zz_generated_dscpconfiguration_client.go | 35 +- ...xpressroutecircuitauthorizations_client.go | 31 +- ...d_expressroutecircuitconnections_client.go | 31 +- ...ated_expressroutecircuitpeerings_client.go | 31 +- ...z_generated_expressroutecircuits_client.go | 53 +- ...enerated_expressrouteconnections_client.go | 31 +- ...ressroutecrossconnectionpeerings_client.go | 31 +- ...ted_expressroutecrossconnections_client.go | 43 +- ...z_generated_expressroutegateways_client.go | 37 +- .../zz_generated_expressroutelinks_client.go | 28 +- .../zz_generated_expressrouteports_client.go | 43 +- ...rated_expressrouteportslocations_client.go | 28 +- ...ted_expressrouteserviceproviders_client.go | 24 +- .../zz_generated_firewallpolicies_client.go | 35 +- ...ted_firewallpolicyidpssignatures_client.go | 105 ++ ...policyidpssignaturesfiltervalues_client.go | 105 ++ ...allpolicyidpssignaturesoverrides_client.go | 291 ++++ ...rewallpolicyrulecollectiongroups_client.go | 31 +- .../zz_generated_flowlogs_client.go | 35 +- .../zz_generated_hubroutetables_client.go | 31 +- ...ted_hubvirtualnetworkconnections_client.go | 31 +- .../zz_generated_inboundnatrules_client.go | 43 +- ...zz_generated_inboundsecurityrule_client.go | 21 +- .../zz_generated_ipallocations_client.go | 39 +- .../zz_generated_ipgroups_client.go | 39 +- ..._loadbalancerbackendaddresspools_client.go | 31 +- ...balancerfrontendipconfigurations_client.go | 28 +- ...d_loadbalancerloadbalancingrules_client.go | 28 +- ...ed_loadbalancernetworkinterfaces_client.go | 24 +- ...erated_loadbalanceroutboundrules_client.go | 28 +- .../zz_generated_loadbalancerprobes_client.go | 28 +- .../zz_generated_loadbalancers_client.go | 121 +- ...z_generated_localnetworkgateways_client.go | 35 +- .../network/armnetwork/zz_generated_models.go | 562 ++++++- .../zz_generated_natgateways_client.go | 39 +- .../zz_generated_natrules_client.go | 31 +- ...networkinterfaceipconfigurations_client.go | 28 +- ...ed_networkinterfaceloadbalancers_client.go | 24 +- .../zz_generated_networkinterfaces_client.go | 65 +- ...etworkinterfacetapconfigurations_client.go | 31 +- ...enerated_networkmanagementclient_client.go | 47 +- .../zz_generated_networkprofiles_client.go | 41 +- ..._generated_networksecuritygroups_client.go | 39 +- ...nerated_networkvirtualappliances_client.go | 39 +- .../zz_generated_networkwatchers_client.go | 67 +- .../zz_generated_operations_client.go | 20 +- .../zz_generated_p2svpngateways_client.go | 47 +- .../zz_generated_packetcaptures_client.go | 35 +- .../network/armnetwork/zz_generated_pagers.go | 59 +- ...erexpressroutecircuitconnections_client.go | 28 +- .../armnetwork/zz_generated_pollers.go | 132 +- .../zz_generated_polymorphic_helpers.go | 38 + ...z_generated_privatednszonegroups_client.go | 31 +- .../zz_generated_privateendpoints_client.go | 35 +- ...zz_generated_privatelinkservices_client.go | 61 +- .../zz_generated_publicipaddresses_client.go | 57 +- .../zz_generated_publicipprefixes_client.go | 39 +- ...enerated_resourcenavigationlinks_client.go | 24 +- .../armnetwork/zz_generated_response_types.go | 699 +++++++- .../zz_generated_routefilterrules_client.go | 31 +- .../zz_generated_routefilters_client.go | 39 +- .../armnetwork/zz_generated_routes_client.go | 31 +- .../zz_generated_routetables_client.go | 39 +- .../zz_generated_routingintent_client.go | 334 ++++ ...nerated_securitypartnerproviders_client.go | 39 +- .../zz_generated_securityrules_client.go | 31 +- ...enerated_serviceassociationlinks_client.go | 24 +- ...enerated_serviceendpointpolicies_client.go | 39 +- ...serviceendpointpolicydefinitions_client.go | 31 +- ..._generated_servicetaginformation_client.go | 24 +- .../zz_generated_servicetags_client.go | 24 +- .../armnetwork/zz_generated_subnets_client.go | 35 +- .../armnetwork/zz_generated_time_rfc3339.go | 27 + .../armnetwork/zz_generated_usages_client.go | 24 +- ..._generated_virtualappliancesites_client.go | 31 +- ...z_generated_virtualapplianceskus_client.go | 28 +- ...enerated_virtualhubbgpconnection_client.go | 27 +- ...nerated_virtualhubbgpconnections_client.go | 27 +- ...erated_virtualhubipconfiguration_client.go | 31 +- ...enerated_virtualhubroutetablev2s_client.go | 31 +- .../zz_generated_virtualhubs_client.go | 41 +- ...virtualnetworkgatewayconnections_client.go | 49 +- ...ed_virtualnetworkgatewaynatrules_client.go | 31 +- ...generated_virtualnetworkgateways_client.go | 73 +- ...generated_virtualnetworkpeerings_client.go | 31 +- .../zz_generated_virtualnetworks_client.go | 47 +- .../zz_generated_virtualnetworktaps_client.go | 39 +- ..._generated_virtualrouterpeerings_client.go | 31 +- .../zz_generated_virtualrouters_client.go | 35 +- .../zz_generated_virtualwans_client.go | 39 +- .../zz_generated_vpnconnections_client.go | 35 +- .../zz_generated_vpngateways_client.go | 43 +- .../zz_generated_vpnlinkconnections_client.go | 27 +- ...enerated_vpnserverconfigurations_client.go | 39 +- ...urationsassociatedwithvirtualwan_client.go | 21 +- ...generated_vpnsitelinkconnections_client.go | 24 +- .../zz_generated_vpnsitelinks_client.go | 28 +- .../zz_generated_vpnsites_client.go | 39 +- ..._generated_vpnsitesconfiguration_client.go | 21 +- ...d_webapplicationfirewallpolicies_client.go | 37 +- .../zz_generated_webcategories_client.go | 28 +- .../armnotificationhubs/CHANGELOG.md | 9 +- .../armnotificationhubs/README.md | 17 +- .../armnotificationhubs/autorest.md | 6 +- .../armnotificationhubs/go.mod | 4 +- .../armnotificationhubs/go.sum | 31 +- .../zz_generated_constants.go | 2 +- .../zz_generated_models.go | 15 +- .../zz_generated_namespaces_client.go | 41 +- .../zz_generated_notificationhubs_client.go | 44 +- .../zz_generated_operations_client.go | 18 +- .../zz_generated_pagers.go | 5 +- .../zz_generated_pollers.go | 3 +- .../zz_generated_response_types.go | 5 +- .../zz_generated_time_rfc3339.go | 27 + .../armoperationalinsights/CHANGELOG.md | 7 + .../armoperationalinsights/README.md | 17 +- .../armoperationalinsights/autorest.md | 6 +- .../armoperationalinsights/go.mod | 4 +- .../armoperationalinsights/go.sum | 31 +- ..._generated_availableservicetiers_client.go | 22 +- .../zz_generated_clusters_client.go | 27 +- .../zz_generated_constants.go | 2 +- .../zz_generated_dataexports_client.go | 26 +- .../zz_generated_datasources_client.go | 26 +- .../zz_generated_deletedworkspaces_client.go | 24 +- .../zz_generated_gateways_client.go | 20 +- .../zz_generated_intelligencepacks_client.go | 22 +- .../zz_generated_linkedservices_client.go | 23 +- ..._generated_linkedstorageaccounts_client.go | 26 +- .../zz_generated_managementgroups_client.go | 22 +- .../zz_generated_models.go | 33 +- .../zz_generated_operations_client.go | 18 +- .../zz_generated_operationstatuses_client.go | 22 +- .../zz_generated_pagers.go | 5 +- .../zz_generated_pollers.go | 3 +- .../zz_generated_response_types.go | 15 +- .../zz_generated_savedsearches_client.go | 26 +- .../zz_generated_schema_client.go | 22 +- .../zz_generated_sharedkeys_client.go | 24 +- ..._generated_storageinsightconfigs_client.go | 26 +- .../zz_generated_time_rfc3339.go | 27 + .../zz_generated_usages_client.go | 22 +- .../zz_generated_workspacepurge_client.go | 24 +- .../zz_generated_workspaces_client.go | 29 +- .../armoperationsmanagement/CHANGELOG.md | 9 +- .../armoperationsmanagement/README.md | 17 +- .../armoperationsmanagement/autorest.md | 6 +- .../armoperationsmanagement/go.mod | 4 +- .../armoperationsmanagement/go.sum | 31 +- .../zz_generated_constants.go | 2 +- ...generated_managementassociations_client.go | 26 +- ...nerated_managementconfigurations_client.go | 26 +- .../zz_generated_models.go | 3 +- .../zz_generated_operations_client.go | 18 +- .../zz_generated_pollers.go | 3 +- .../zz_generated_response_types.go | 9 +- .../zz_generated_solutions_client.go | 25 +- .../postgresql/armpostgresql/CHANGELOG.md | 7 + .../postgresql/armpostgresql/README.md | 17 +- .../postgresql/armpostgresql/autorest.md | 6 +- .../postgresql/armpostgresql/go.mod | 4 +- .../postgresql/armpostgresql/go.sum | 31 +- ..._generated_checknameavailability_client.go | 15 +- .../zz_generated_configurations_client.go | 16 +- .../armpostgresql/zz_generated_constants.go | 2 +- .../zz_generated_databases_client.go | 16 +- .../zz_generated_firewallrules_client.go | 16 +- ...ted_locationbasedperformancetier_client.go | 15 +- .../zz_generated_logfiles_client.go | 15 +- .../armpostgresql/zz_generated_models.go | 30 +- .../zz_generated_operations_client.go | 15 +- .../zz_generated_polymorphic_helpers.go | 19 + ...rated_privateendpointconnections_client.go | 16 +- ...z_generated_privatelinkresources_client.go | 17 +- .../zz_generated_recoverableservers_client.go | 15 +- .../zz_generated_replicas_client.go | 15 +- .../zz_generated_response_types.go | 40 + ...z_generated_serveradministrators_client.go | 16 +- ...rated_serverbasedperformancetier_client.go | 15 +- .../zz_generated_serverkeys_client.go | 16 +- .../zz_generated_serverparameters_client.go | 12 +- .../zz_generated_servers_client.go | 18 +- ...ated_serversecurityalertpolicies_client.go | 16 +- .../zz_generated_time_rfc3339.go | 27 + ...zz_generated_virtualnetworkrules_client.go | 16 +- .../armpostgresqlflexibleservers/CHANGELOG.md | 7 + .../armpostgresqlflexibleservers/README.md | 17 +- .../armpostgresqlflexibleservers/autorest.md | 6 +- .../armpostgresqlflexibleservers/go.mod | 4 +- .../armpostgresqlflexibleservers/go.sum | 31 +- ..._generated_checknameavailability_client.go | 22 +- .../zz_generated_configurations_client.go | 23 +- .../zz_generated_constants.go | 2 +- .../zz_generated_databases_client.go | 23 +- .../zz_generated_firewallrules_client.go | 23 +- ...enerated_getprivatednszonesuffix_client.go | 18 +- ...erated_locationbasedcapabilities_client.go | 22 +- .../zz_generated_models.go | 27 +- .../zz_generated_operations_client.go | 18 +- .../zz_generated_pagers.go | 5 +- .../zz_generated_pollers.go | 3 +- .../zz_generated_response_types.go | 27 +- .../zz_generated_servers_client.go | 25 +- .../zz_generated_time_rfc3339.go | 27 + ...erated_virtualnetworksubnetusage_client.go | 22 +- .../privatedns/armprivatedns/CHANGELOG.md | 7 + .../privatedns/armprivatedns/README.md | 17 +- .../privatedns/armprivatedns/autorest.md | 6 +- .../privatedns/armprivatedns/go.mod | 4 +- .../privatedns/armprivatedns/go.sum | 31 +- .../armprivatedns/zz_generated_constants.go | 2 +- .../armprivatedns/zz_generated_models.go | 3 +- .../armprivatedns/zz_generated_pagers.go | 5 +- .../armprivatedns/zz_generated_pollers.go | 3 +- .../zz_generated_privatezones_client.go | 27 +- .../zz_generated_recordsets_client.go | 42 +- .../zz_generated_response_types.go | 15 +- ...zz_generated_virtualnetworklinks_client.go | 25 +- .../armrecoveryservices/CHANGELOG.md | 9 +- .../armrecoveryservices/README.md | 17 +- .../armrecoveryservices/autorest.md | 6 +- .../armrecoveryservices/go.mod | 4 +- .../armrecoveryservices/go.sum | 31 +- .../zz_generated_constants.go | 2 +- .../zz_generated_models.go | 77 +- .../zz_generated_operations_client.go | 26 +- .../zz_generated_pagers.go | 5 +- .../zz_generated_pollers.go | 3 +- .../zz_generated_polymorphic_helpers.go | 19 + ...z_generated_privatelinkresources_client.go | 24 +- .../zz_generated_recoveryservices_client.go | 22 +- ...z_generated_registeredidentities_client.go | 20 +- .../zz_generated_replicationusages_client.go | 22 +- .../zz_generated_response_types.go | 7 +- .../zz_generated_time_rfc3339.go | 27 + .../zz_generated_usages_client.go | 22 +- .../zz_generated_vaultcertificates_client.go | 22 +- .../zz_generated_vaultextendedinfo_client.go | 26 +- .../zz_generated_vaults_client.go | 25 +- .../redis/armredis/CHANGELOG.md | 7 + sdk/resourcemanager/redis/armredis/README.md | 17 +- .../redis/armredis/autorest.md | 6 +- sdk/resourcemanager/redis/armredis/go.mod | 4 +- sdk/resourcemanager/redis/armredis/go.sum | 31 +- .../redis/armredis/zz_generated_constants.go | 2 +- .../zz_generated_firewallrules_client.go | 26 +- .../zz_generated_linkedserver_client.go | 23 +- .../redis/armredis/zz_generated_models.go | 9 +- .../zz_generated_operations_client.go | 18 +- .../redis/armredis/zz_generated_pagers.go | 5 +- .../zz_generated_patchschedules_client.go | 26 +- .../redis/armredis/zz_generated_pollers.go | 3 +- ...rated_privateendpointconnections_client.go | 23 +- ...z_generated_privatelinkresources_client.go | 22 +- .../armredis/zz_generated_redis_client.go | 37 +- .../armredis/zz_generated_response_types.go | 15 +- .../armredis/zz_generated_time_rfc3339.go | 27 + .../relay/armrelay/CHANGELOG.md | 9 +- sdk/resourcemanager/relay/armrelay/README.md | 17 +- .../relay/armrelay/autorest.md | 6 +- sdk/resourcemanager/relay/armrelay/go.mod | 4 +- sdk/resourcemanager/relay/armrelay/go.sum | 31 +- .../relay/armrelay/zz_generated_constants.go | 2 +- .../zz_generated_hybridconnections_client.go | 36 +- .../relay/armrelay/zz_generated_models.go | 39 +- .../zz_generated_namespaces_client.go | 39 +- .../zz_generated_operations_client.go | 18 +- .../relay/armrelay/zz_generated_pagers.go | 5 +- .../relay/armrelay/zz_generated_pollers.go | 3 +- .../armrelay/zz_generated_response_types.go | 7 +- .../armrelay/zz_generated_time_rfc3339.go | 27 + .../armrelay/zz_generated_wcfrelays_client.go | 36 +- .../armresourcehealth/CHANGELOG.md | 9 +- .../armresourcehealth/README.md | 17 +- .../armresourcehealth/autorest.md | 6 +- .../resourcehealth/armresourcehealth/go.mod | 4 +- .../resourcehealth/armresourcehealth/go.sum | 31 +- ...z_generated_availabilitystatuses_client.go | 34 +- ...erated_childavailabilitystatuses_client.go | 29 +- .../zz_generated_childresources_client.go | 24 +- .../zz_generated_constants.go | 2 +- .../zz_generated_emergingissues_client.go | 24 +- .../armresourcehealth/zz_generated_models.go | 75 +- .../zz_generated_operations_client.go | 18 +- .../armresourcehealth/zz_generated_pagers.go | 5 +- .../zz_generated_time_rfc3339.go | 27 + .../resources/armresources/CHANGELOG.md | 7 + .../resources/armresources/README.md | 17 +- .../resources/armresources/autorest.md | 6 +- .../armresources/examples_providers_test.go | 3 +- .../examples_resourcegroups_test.go | 13 +- .../armresources/examples_resources_test.go | 5 +- .../resources/armresources/go.mod | 6 +- .../resources/armresources/go.sum | 22 +- .../armresources/zz_generated_constants.go | 2 +- ...z_generated_deploymentoperations_client.go | 39 +- .../zz_generated_deployments_client.go | 68 +- .../armresources/zz_generated_models.go | 42 +- .../zz_generated_operations_client.go | 15 +- ..._generated_providerresourcetypes_client.go | 15 +- .../zz_generated_providers_client.go | 27 +- .../zz_generated_resourcegroups_client.go | 20 +- .../zz_generated_resources_client.go | 65 +- .../zz_generated_response_types.go | 58 + .../armresources/zz_generated_tags_client.go | 37 +- .../armresources/zz_generated_time_rfc3339.go | 27 + .../scheduler/armscheduler/CHANGELOG.md | 9 +- .../scheduler/armscheduler/README.md | 17 +- .../scheduler/armscheduler/autorest.md | 6 +- .../scheduler/armscheduler/go.mod | 4 +- .../scheduler/armscheduler/go.sum | 31 +- .../armscheduler/zz_generated_constants.go | 2 +- .../zz_generated_jobcollections_client.go | 29 +- .../armscheduler/zz_generated_jobs_client.go | 30 +- .../armscheduler/zz_generated_models.go | 57 +- .../armscheduler/zz_generated_pagers.go | 5 +- .../armscheduler/zz_generated_pollers.go | 3 +- .../zz_generated_polymorphic_helpers.go | 19 + .../zz_generated_response_types.go | 9 +- .../armscheduler/zz_generated_time_rfc3339.go | 27 + .../search/armsearch/CHANGELOG.md | 9 +- .../search/armsearch/README.md | 17 +- .../search/armsearch/autorest.md | 6 +- sdk/resourcemanager/search/armsearch/go.mod | 4 +- sdk/resourcemanager/search/armsearch/go.sum | 31 +- .../zz_generated_adminkeys_client.go | 24 +- .../armsearch/zz_generated_constants.go | 2 +- .../search/armsearch/zz_generated_models.go | 3 +- .../zz_generated_operations_client.go | 18 +- .../search/armsearch/zz_generated_pagers.go | 5 +- .../search/armsearch/zz_generated_pollers.go | 3 +- ...rated_privateendpointconnections_client.go | 28 +- ...z_generated_privatelinkresources_client.go | 22 +- .../zz_generated_querykeys_client.go | 24 +- .../armsearch/zz_generated_response_types.go | 9 +- .../armsearch/zz_generated_services_client.go | 29 +- ...rated_sharedprivatelinkresources_client.go | 23 +- .../security/armsecurity/CHANGELOG.md | 9 +- .../security/armsecurity/README.md | 17 +- .../security/armsecurity/autorest.md | 6 +- .../security/armsecurity/go.mod | 4 +- .../security/armsecurity/go.sum | 31 +- ...ated_adaptiveapplicationcontrols_client.go | 26 +- ...erated_adaptivenetworkhardenings_client.go | 23 +- ...nerated_advancedthreatprotection_client.go | 38 +- .../armsecurity/zz_generated_alerts_client.go | 31 +- ...generated_alertssuppressionrules_client.go | 26 +- .../zz_generated_allowedconnections_client.go | 26 +- .../zz_generated_assessments_client.go | 38 +- ...zz_generated_assessmentsmetadata_client.go | 30 +- .../zz_generated_automations_client.go | 30 +- ...nerated_autoprovisioningsettings_client.go | 26 +- .../zz_generated_complianceresults_client.go | 30 +- .../zz_generated_compliances_client.go | 30 +- .../zz_generated_connectors_client.go | 26 +- .../armsecurity/zz_generated_constants.go | 89 +- ...ated_customassessmentautomations_client.go | 32 +- ...ted_customentitystoreassignments_client.go | 28 +- .../armsecurity/zz_generated_date_type.go | 28 + ...z_generated_devicesecuritygroups_client.go | 38 +- ...ated_discoveredsecuritysolutions_client.go | 26 +- ...erated_externalsecuritysolutions_client.go | 26 +- ...ed_informationprotectionpolicies_client.go | 35 +- .../zz_generated_ingestionsettings_client.go | 30 +- ...zz_generated_iotsecuritysolution_client.go | 30 +- ...ted_iotsecuritysolutionanalytics_client.go | 24 +- ...olutionsanalyticsaggregatedalert_client.go | 24 +- ...solutionsanalyticsrecommendation_client.go | 24 +- ...nerated_jitnetworkaccesspolicies_client.go | 34 +- .../zz_generated_locations_client.go | 24 +- .../zz_generated_mdeonboardings_client.go | 157 ++ .../armsecurity/zz_generated_models.go | 786 +++++++-- .../zz_generated_operations_client.go | 18 +- .../armsecurity/zz_generated_pagers.go | 113 +- .../armsecurity/zz_generated_pollers.go | 3 +- .../zz_generated_polymorphic_helpers.go | 288 ++++ .../zz_generated_pricings_client.go | 26 +- ..._regulatorycomplianceassessments_client.go | 24 +- ...ted_regulatorycompliancecontrols_client.go | 24 +- ...ed_regulatorycompliancestandards_client.go | 24 +- .../zz_generated_response_types.go | 99 +- ...ed_securescorecontroldefinitions_client.go | 24 +- ...zz_generated_securescorecontrols_client.go | 24 +- .../zz_generated_securescores_client.go | 24 +- .../zz_generated_securityconnectors_client.go | 409 +++++ .../zz_generated_securitycontacts_client.go | 28 +- .../zz_generated_securitysolutions_client.go | 24 +- ...d_securitysolutionsreferencedata_client.go | 24 +- ...ed_servervulnerabilityassessment_client.go | 25 +- .../zz_generated_settings_client.go | 26 +- ...zz_generated_softwareinventories_client.go | 26 +- ...erabilityassessmentbaselinerules_client.go | 43 +- ...lnerabilityassessmentscanresults_client.go | 30 +- ..._sqlvulnerabilityassessmentscans_client.go | 30 +- .../zz_generated_subassessments_client.go | 35 +- .../armsecurity/zz_generated_tasks_client.go | 30 +- .../armsecurity/zz_generated_time_rfc3339.go | 27 + .../zz_generated_topology_client.go | 26 +- .../zz_generated_workspacesettings_client.go | 28 +- .../servicebus/armservicebus/CHANGELOG.md | 7 + .../servicebus/armservicebus/README.md | 17 +- .../servicebus/armservicebus/autorest.md | 6 +- .../servicebus/armservicebus/go.mod | 4 +- .../servicebus/armservicebus/go.sum | 31 +- .../armservicebus/zz_generated_constants.go | 2 +- ...enerated_disasterrecoveryconfigs_client.go | 34 +- .../zz_generated_migrationconfigs_client.go | 23 +- .../armservicebus/zz_generated_models.go | 81 +- .../zz_generated_namespaces_client.go | 45 +- .../zz_generated_operations_client.go | 18 +- .../armservicebus/zz_generated_pagers.go | 5 +- .../armservicebus/zz_generated_pollers.go | 3 +- ...rated_privateendpointconnections_client.go | 25 +- ...z_generated_privatelinkresources_client.go | 22 +- .../zz_generated_queues_client.go | 36 +- .../zz_generated_response_types.go | 11 +- .../zz_generated_rules_client.go | 26 +- .../zz_generated_subscriptions_client.go | 26 +- .../zz_generated_time_rfc3339.go | 27 + .../zz_generated_topics_client.go | 36 +- .../armservicefabric/CHANGELOG.md | 9 +- .../servicefabric/armservicefabric/README.md | 17 +- .../armservicefabric/autorest.md | 6 +- .../servicefabric/armservicefabric/go.mod | 4 +- .../servicefabric/armservicefabric/go.sum | 31 +- .../zz_generated_applications_client.go | 23 +- .../zz_generated_applicationtypes_client.go | 25 +- ...enerated_applicationtypeversions_client.go | 23 +- .../zz_generated_clusters_client.go | 27 +- .../zz_generated_clusterversions_client.go | 28 +- .../zz_generated_constants.go | 2 +- .../armservicefabric/zz_generated_models.go | 75 +- .../zz_generated_operations_client.go | 18 +- .../armservicefabric/zz_generated_pagers.go | 5 +- .../armservicefabric/zz_generated_pollers.go | 3 +- .../zz_generated_polymorphic_helpers.go | 76 + .../zz_generated_response_types.go | 25 +- .../zz_generated_services_client.go | 23 +- .../zz_generated_time_rfc3339.go | 27 + sdk/resourcemanager/sql/armsql/CHANGELOG.md | 7 + sdk/resourcemanager/sql/armsql/README.md | 17 +- sdk/resourcemanager/sql/armsql/autorest.md | 6 +- sdk/resourcemanager/sql/armsql/go.mod | 7 +- sdk/resourcemanager/sql/armsql/go.sum | 31 +- ...backupshorttermretentionpolicies_client.go | 23 +- .../zz_generated_capabilities_client.go | 22 +- .../sql/armsql/zz_generated_constants.go | 2 +- .../zz_generated_databaseadvisors_client.go | 26 +- ...enerated_databaseautomatictuning_client.go | 24 +- ...ted_databaseblobauditingpolicies_client.go | 26 +- .../zz_generated_databasecolumns_client.go | 26 +- .../zz_generated_databaseextensions_client.go | 21 +- .../zz_generated_databaseoperations_client.go | 22 +- ...rated_databaserecommendedactions_client.go | 26 +- .../armsql/zz_generated_databases_client.go | 31 +- .../zz_generated_databaseschemas_client.go | 24 +- ...ed_databasesecurityalertpolicies_client.go | 26 +- .../zz_generated_databasetables_client.go | 24 +- .../zz_generated_databaseusages_client.go | 22 +- ...erabilityassessmentrulebaselines_client.go | 24 +- ...databasevulnerabilityassessments_client.go | 26 +- ...basevulnerabilityassessmentscans_client.go | 25 +- ...zz_generated_datamaskingpolicies_client.go | 24 +- .../zz_generated_datamaskingrules_client.go | 24 +- ...ated_datawarehouseuseractivities_client.go | 24 +- .../zz_generated_deletedservers_client.go | 25 +- ..._generated_elasticpoolactivities_client.go | 22 +- ...ed_elasticpooldatabaseactivities_client.go | 22 +- ..._generated_elasticpooloperations_client.go | 22 +- .../zz_generated_elasticpools_client.go | 29 +- ...z_generated_encryptionprotectors_client.go | 23 +- ...ndeddatabaseblobauditingpolicies_client.go | 26 +- ...tendedserverblobauditingpolicies_client.go | 23 +- .../zz_generated_failovergroups_client.go | 23 +- .../zz_generated_firewallrules_client.go | 28 +- .../zz_generated_geobackuppolicies_client.go | 26 +- ...generated_instancefailovergroups_client.go | 23 +- .../zz_generated_instancepools_client.go | 25 +- .../armsql/zz_generated_jobagents_client.go | 23 +- .../zz_generated_jobcredentials_client.go | 26 +- .../zz_generated_jobexecutions_client.go | 27 +- .../sql/armsql/zz_generated_jobs_client.go | 26 +- .../zz_generated_jobstepexecutions_client.go | 24 +- .../armsql/zz_generated_jobsteps_client.go | 30 +- ...zz_generated_jobtargetexecutions_client.go | 26 +- .../zz_generated_jobtargetgroups_client.go | 26 +- .../armsql/zz_generated_jobversions_client.go | 24 +- ...zz_generated_ledgerdigestuploads_client.go | 23 +- ...nerated_longtermretentionbackups_client.go | 37 +- ...mretentionmanagedinstancebackups_client.go | 37 +- ...erated_longtermretentionpolicies_client.go | 23 +- ...nerated_maintenancewindowoptions_client.go | 22 +- .../zz_generated_maintenancewindows_client.go | 22 +- ...backupshorttermretentionpolicies_client.go | 23 +- ...generated_manageddatabasecolumns_client.go | 26 +- ...generated_manageddatabasequeries_client.go | 24 +- ...baserecommendedsensitivitylabels_client.go | 20 +- ...ed_manageddatabaserestoredetails_client.go | 22 +- .../zz_generated_manageddatabases_client.go | 25 +- ...generated_manageddatabaseschemas_client.go | 24 +- ...geddatabasesecurityalertpolicies_client.go | 26 +- ...ed_manageddatabasesecurityevents_client.go | 22 +- ...manageddatabasesensitivitylabels_client.go | 28 +- ..._generated_manageddatabasetables_client.go | 24 +- ...atabasetransparentdataencryption_client.go | 26 +- ...erabilityassessmentrulebaselines_client.go | 24 +- ...databasevulnerabilityassessments_client.go | 26 +- ...basevulnerabilityassessmentscans_client.go | 25 +- ...ed_managedinstanceadministrators_client.go | 23 +- ...stanceazureadonlyauthentications_client.go | 23 +- ...agedinstanceencryptionprotectors_client.go | 23 +- ...zz_generated_managedinstancekeys_client.go | 23 +- ...nstancelongtermretentionpolicies_client.go | 23 +- ...erated_managedinstanceoperations_client.go | 24 +- ...stanceprivateendpointconnections_client.go | 23 +- ...agedinstanceprivatelinkresources_client.go | 24 +- .../zz_generated_managedinstances_client.go | 31 +- ...d_managedinstancetdecertificates_client.go | 19 +- ...instancevulnerabilityassessments_client.go | 26 +- ...backupshorttermretentionpolicies_client.go | 23 +- ...nagedserversecurityalertpolicies_client.go | 23 +- .../sql/armsql/zz_generated_models.go | 471 ++---- .../armsql/zz_generated_operations_client.go | 18 +- .../zz_generated_operationshealth_client.go | 22 +- ..._generated_outboundfirewallrules_client.go | 23 +- .../sql/armsql/zz_generated_pagers.go | 5 +- .../sql/armsql/zz_generated_pollers.go | 3 +- ...rated_privateendpointconnections_client.go | 23 +- ...z_generated_privatelinkresources_client.go | 24 +- ...ted_recommendedsensitivitylabels_client.go | 20 +- ...z_generated_recoverabledatabases_client.go | 24 +- ...ated_recoverablemanageddatabases_client.go | 24 +- .../zz_generated_replicationlinks_client.go | 25 +- .../sql/armsql/zz_generated_response_types.go | 245 ++- ...rated_restorabledroppeddatabases_client.go | 24 +- ...estorabledroppedmanageddatabases_client.go | 24 +- .../zz_generated_restorepoints_client.go | 23 +- .../zz_generated_sensitivitylabels_client.go | 28 +- .../zz_generated_serveradvisors_client.go | 26 +- ..._generated_serverautomatictuning_client.go | 24 +- ...ated_serverazureadadministrators_client.go | 23 +- ...serverazureadonlyauthentications_client.go | 23 +- ...rated_serverblobauditingpolicies_client.go | 23 +- ...nerated_servercommunicationlinks_client.go | 23 +- ...nerated_serverconnectionpolicies_client.go | 24 +- ...erated_serverdevopsauditsettings_client.go | 23 +- .../zz_generated_serverdnsaliases_client.go | 23 +- .../armsql/zz_generated_serverkeys_client.go | 23 +- .../zz_generated_serveroperations_client.go | 22 +- .../sql/armsql/zz_generated_servers_client.go | 27 +- ...ated_serversecurityalertpolicies_client.go | 23 +- .../zz_generated_servertrustgroups_client.go | 25 +- .../zz_generated_serverusages_client.go | 22 +- ...d_servervulnerabilityassessments_client.go | 26 +- .../zz_generated_serviceobjectives_client.go | 24 +- .../armsql/zz_generated_sqlagent_client.go | 24 +- .../zz_generated_subscriptionusages_client.go | 24 +- .../armsql/zz_generated_syncagents_client.go | 27 +- .../armsql/zz_generated_syncgroups_client.go | 29 +- .../armsql/zz_generated_syncmembers_client.go | 25 +- .../zz_generated_tdecertificates_client.go | 19 +- .../sql/armsql/zz_generated_time_rfc3339.go | 27 + .../armsql/zz_generated_timezones_client.go | 24 +- ...rated_transparentdataencryptions_client.go | 26 +- .../sql/armsql/zz_generated_usages_client.go | 22 +- .../zz_generated_virtualclusters_client.go | 27 +- ...zz_generated_virtualnetworkrules_client.go | 23 +- ...zz_generated_workloadclassifiers_client.go | 23 +- .../zz_generated_workloadgroups_client.go | 23 +- .../storage/armstorage/CHANGELOG.md | 7 + .../storage/armstorage/README.md | 17 +- .../storage/armstorage/autorest.md | 6 +- .../armstorage/example_blobcontainers_test.go | 9 +- .../example_storageaccounts_test.go | 19 +- .../storage/armstorage/example_usage_test.go | 3 +- sdk/resourcemanager/storage/armstorage/go.mod | 6 +- sdk/resourcemanager/storage/armstorage/go.sum | 22 +- .../zz_generated_blobcontainers_client.go | 43 +- ..._generated_blobinventorypolicies_client.go | 26 +- .../zz_generated_blobservices_client.go | 26 +- .../armstorage/zz_generated_constants.go | 2 +- .../zz_generated_deletedaccounts_client.go | 24 +- .../zz_generated_encryptionscopes_client.go | 28 +- .../zz_generated_fileservices_client.go | 26 +- .../zz_generated_fileshares_client.go | 30 +- .../zz_generated_managementpolicies_client.go | 24 +- .../storage/armstorage/zz_generated_models.go | 213 +-- ...erated_objectreplicationpolicies_client.go | 26 +- .../zz_generated_operations_client.go | 18 +- .../storage/armstorage/zz_generated_pagers.go | 5 +- .../armstorage/zz_generated_pollers.go | 3 +- ...rated_privateendpointconnections_client.go | 26 +- ...z_generated_privatelinkresources_client.go | 22 +- .../armstorage/zz_generated_queue_client.go | 28 +- .../zz_generated_queueservices_client.go | 26 +- .../armstorage/zz_generated_response_types.go | 15 +- .../armstorage/zz_generated_skus_client.go | 22 +- .../zz_generated_storageaccounts_client.go | 37 +- .../armstorage/zz_generated_table_client.go | 28 +- .../zz_generated_tableservices_client.go | 26 +- .../armstorage/zz_generated_time_rfc3339.go | 27 + .../armstorage/zz_generated_usages_client.go | 22 +- .../armstreamanalytics/CHANGELOG.md | 9 +- .../armstreamanalytics/README.md | 17 +- .../armstreamanalytics/autorest.md | 6 +- .../streamanalytics/armstreamanalytics/go.mod | 4 +- .../streamanalytics/armstreamanalytics/go.sum | 31 +- .../zz_generated_clusters_client.go | 27 +- .../zz_generated_constants.go | 2 +- .../zz_generated_functions_client.go | 29 +- .../zz_generated_inputs_client.go | 27 +- .../armstreamanalytics/zz_generated_models.go | 33 +- .../zz_generated_operations_client.go | 18 +- .../zz_generated_outputs_client.go | 27 +- .../armstreamanalytics/zz_generated_pagers.go | 5 +- .../zz_generated_pollers.go | 3 +- .../zz_generated_polymorphic_helpers.go | 152 ++ .../zz_generated_privateendpoints_client.go | 25 +- .../zz_generated_response_types.go | 33 +- .../zz_generated_streamingjobs_client.go | 27 +- .../zz_generated_subscriptions_client.go | 23 +- .../zz_generated_time_rfc3339.go | 27 + .../zz_generated_transformations_client.go | 26 +- sdk/resourcemanager/web/armweb/CHANGELOG.md | 7 + sdk/resourcemanager/web/armweb/README.md | 17 +- sdk/resourcemanager/web/armweb/autorest.md | 6 +- sdk/resourcemanager/web/armweb/go.mod | 4 +- sdk/resourcemanager/web/armweb/go.sum | 31 +- ...ated_appservicecertificateorders_client.go | 39 +- ...generated_appserviceenvironments_client.go | 93 +- .../zz_generated_appserviceplans_client.go | 63 +- ...ted_certificateordersdiagnostics_client.go | 24 +- ..._certificateregistrationprovider_client.go | 18 +- .../zz_generated_certificates_client.go | 30 +- .../web/armweb/zz_generated_constants.go | 2 +- .../zz_generated_deletedwebapps_client.go | 26 +- .../armweb/zz_generated_diagnostics_client.go | 64 +- ...rated_domainregistrationprovider_client.go | 18 +- .../web/armweb/zz_generated_domains_client.go | 43 +- .../web/armweb/zz_generated_global_client.go | 24 +- .../zz_generated_kubeenvironments_client.go | 27 +- .../web/armweb/zz_generated_models.go | 527 ++---- .../web/armweb/zz_generated_pagers.go | 5 +- .../web/armweb/zz_generated_pollers.go | 3 +- .../armweb/zz_generated_provider_client.go | 34 +- .../zz_generated_recommendations_client.go | 34 +- ...generated_resourcehealthmetadata_client.go | 32 +- .../web/armweb/zz_generated_response_types.go | 127 +- .../armweb/zz_generated_staticsites_client.go | 83 +- .../web/armweb/zz_generated_time_rfc3339.go | 27 + .../zz_generated_topleveldomains_client.go | 26 +- .../web/armweb/zz_generated_webapps_client.go | 567 +++---- ...enerated_websitemanagementclient_client.go | 50 +- 1483 files changed, 33472 insertions(+), 23787 deletions(-) create mode 100644 sdk/resourcemanager/appplatform/armappplatform/zz_generated_polymorphic_helpers.go rename sdk/resourcemanager/{cosmos/armcosmos/zz_generated_service_client.go => appplatform/armappplatform/zz_generated_storages_client.go} (50%) create mode 100644 sdk/resourcemanager/compute/armcompute/zz_generated_communitygalleries_client.go create mode 100644 sdk/resourcemanager/compute/armcompute/zz_generated_communitygalleryimages_client.go create mode 100644 sdk/resourcemanager/compute/armcompute/zz_generated_communitygalleryimageversions_client.go delete mode 100644 sdk/resourcemanager/cosmos/armcosmos/zz_generated_graphresources_client.go rename sdk/resourcemanager/cosmos/armcosmos/{zz_generated_cosmosdbmanagementclient_client.go => zz_generated_locations_client.go} (50%) delete mode 100644 sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_eventchannels_client.go delete mode 100644 sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_partnernamespaces_client.go delete mode 100644 sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_partnerregistrations_client.go delete mode 100644 sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_partnertopiceventsubscriptions_client.go delete mode 100644 sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_partnertopics_client.go create mode 100644 sdk/resourcemanager/eventhub/armeventhub/zz_generated_schemaregistry_client.go create mode 100644 sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicyidpssignatures_client.go create mode 100644 sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicyidpssignaturesfiltervalues_client.go create mode 100644 sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicyidpssignaturesoverrides_client.go create mode 100644 sdk/resourcemanager/network/armnetwork/zz_generated_routingintent_client.go create mode 100644 sdk/resourcemanager/security/armsecurity/zz_generated_mdeonboardings_client.go create mode 100644 sdk/resourcemanager/security/armsecurity/zz_generated_securityconnectors_client.go diff --git a/eng/scripts/build.ps1 b/eng/scripts/build.ps1 index 37ba7d6da486..604081a12d36 100644 --- a/eng/scripts/build.ps1 +++ b/eng/scripts/build.ps1 @@ -9,7 +9,7 @@ param( [switch]$format, [switch]$tidy, [string]$config = "autorest.md", - [string]$goExtension = "@autorest/go@4.0.0-preview.30", + [string]$goExtension = "@autorest/go@4.0.0-preview.31", [string]$outputFolder ) diff --git a/sdk/resourcemanager/agrifood/armagrifood/CHANGELOG.md b/sdk/resourcemanager/agrifood/armagrifood/CHANGELOG.md index 363821ad10ce..ca54a5a2a4cf 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/CHANGELOG.md +++ b/sdk/resourcemanager/agrifood/armagrifood/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-10-08) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/agrifood/armagrifood". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/agrifood/armagrifood") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/agrifood/armagrifood/README.md b/sdk/resourcemanager/agrifood/armagrifood/README.md index 98288cdf3e85..32437f39e26b 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/README.md +++ b/sdk/resourcemanager/agrifood/armagrifood/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure AgriFood +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure AgriFood modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armagrifood.NewExtensionsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure AgriFood modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armagrifood.NewExtensionsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armagrifood.NewExtensionsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/agrifood/armagrifood/autorest.md b/sdk/resourcemanager/agrifood/armagrifood/autorest.md index ce4598c52db6..ede70e60751f 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/autorest.md +++ b/sdk/resourcemanager/agrifood/armagrifood/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/agrifood/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/agrifood/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/agrifood/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/agrifood/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/agrifood/armagrifood/go.mod b/sdk/resourcemanager/agrifood/armagrifood/go.mod index 7621f8094472..92fc3c64eaa4 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/go.mod +++ b/sdk/resourcemanager/agrifood/armagrifood/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/agrifood/armagrifoo go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/agrifood/armagrifood/go.sum b/sdk/resourcemanager/agrifood/armagrifood/go.sum index 4f0fb709cf31..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/go.sum +++ b/sdk/resourcemanager/agrifood/armagrifood/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible h1:Cw16jiP4dI+CK761aq44ol4RV5dUiIIXky1+EKpoiVM= -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/agrifood/armagrifood/zz_generated_constants.go b/sdk/resourcemanager/agrifood/armagrifood/zz_generated_constants.go index 5ad964d1eea6..af942e9f2e7b 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/zz_generated_constants.go +++ b/sdk/resourcemanager/agrifood/armagrifood/zz_generated_constants.go @@ -10,7 +10,7 @@ package armagrifood const ( module = "armagrifood" - version = "v0.1.0" + version = "v0.2.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/agrifood/armagrifood/zz_generated_extensions_client.go b/sdk/resourcemanager/agrifood/armagrifood/zz_generated_extensions_client.go index b3cb84fa1111..bde45c831ee2 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/zz_generated_extensions_client.go +++ b/sdk/resourcemanager/agrifood/armagrifood/zz_generated_extensions_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // ExtensionsClient contains the methods for the Extensions group. @@ -31,8 +32,15 @@ type ExtensionsClient struct { } // NewExtensionsClient creates a new instance of ExtensionsClient with the specified values. -func NewExtensionsClient(con *arm.Connection, subscriptionID string) *ExtensionsClient { - return &ExtensionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewExtensionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExtensionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ExtensionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Install extension. @@ -86,7 +94,7 @@ func (client *ExtensionsClient) createCreateRequest(ctx context.Context, extensi func (client *ExtensionsClient) createHandleResponse(resp *http.Response) (ExtensionsCreateResponse, error) { result := ExtensionsCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Extension); err != nil { - return ExtensionsCreateResponse{}, err + return ExtensionsCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -215,7 +223,7 @@ func (client *ExtensionsClient) getCreateRequest(ctx context.Context, extensionI func (client *ExtensionsClient) getHandleResponse(resp *http.Response) (ExtensionsGetResponse, error) { result := ExtensionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Extension); err != nil { - return ExtensionsGetResponse{}, err + return ExtensionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -293,7 +301,7 @@ func (client *ExtensionsClient) listByFarmBeatsCreateRequest(ctx context.Context func (client *ExtensionsClient) listByFarmBeatsHandleResponse(resp *http.Response) (ExtensionsListByFarmBeatsResponse, error) { result := ExtensionsListByFarmBeatsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExtensionListResponse); err != nil { - return ExtensionsListByFarmBeatsResponse{}, err + return ExtensionsListByFarmBeatsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -362,7 +370,7 @@ func (client *ExtensionsClient) updateCreateRequest(ctx context.Context, extensi func (client *ExtensionsClient) updateHandleResponse(resp *http.Response) (ExtensionsUpdateResponse, error) { result := ExtensionsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Extension); err != nil { - return ExtensionsUpdateResponse{}, err + return ExtensionsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/agrifood/armagrifood/zz_generated_farmbeatsextensions_client.go b/sdk/resourcemanager/agrifood/armagrifood/zz_generated_farmbeatsextensions_client.go index e28479918cb6..a4b440df297f 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/zz_generated_farmbeatsextensions_client.go +++ b/sdk/resourcemanager/agrifood/armagrifood/zz_generated_farmbeatsextensions_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // FarmBeatsExtensionsClient contains the methods for the FarmBeatsExtensions group. @@ -30,8 +31,15 @@ type FarmBeatsExtensionsClient struct { } // NewFarmBeatsExtensionsClient creates a new instance of FarmBeatsExtensionsClient with the specified values. -func NewFarmBeatsExtensionsClient(con *arm.Connection) *FarmBeatsExtensionsClient { - return &FarmBeatsExtensionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewFarmBeatsExtensionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *FarmBeatsExtensionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FarmBeatsExtensionsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get farmBeats extension. @@ -73,7 +81,7 @@ func (client *FarmBeatsExtensionsClient) getCreateRequest(ctx context.Context, f func (client *FarmBeatsExtensionsClient) getHandleResponse(resp *http.Response) (FarmBeatsExtensionsGetResponse, error) { result := FarmBeatsExtensionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FarmBeatsExtension); err != nil { - return FarmBeatsExtensionsGetResponse{}, err + return FarmBeatsExtensionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -146,7 +154,7 @@ func (client *FarmBeatsExtensionsClient) listCreateRequest(ctx context.Context, func (client *FarmBeatsExtensionsClient) listHandleResponse(resp *http.Response) (FarmBeatsExtensionsListResponse, error) { result := FarmBeatsExtensionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FarmBeatsExtensionListResponse); err != nil { - return FarmBeatsExtensionsListResponse{}, err + return FarmBeatsExtensionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/agrifood/armagrifood/zz_generated_farmbeatsmodels_client.go b/sdk/resourcemanager/agrifood/armagrifood/zz_generated_farmbeatsmodels_client.go index cc1f2fde8572..3d99a206187f 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/zz_generated_farmbeatsmodels_client.go +++ b/sdk/resourcemanager/agrifood/armagrifood/zz_generated_farmbeatsmodels_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // FarmBeatsModelsClient contains the methods for the FarmBeatsModels group. @@ -31,8 +32,15 @@ type FarmBeatsModelsClient struct { } // NewFarmBeatsModelsClient creates a new instance of FarmBeatsModelsClient with the specified values. -func NewFarmBeatsModelsClient(con *arm.Connection, subscriptionID string) *FarmBeatsModelsClient { - return &FarmBeatsModelsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewFarmBeatsModelsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FarmBeatsModelsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FarmBeatsModelsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update FarmBeats resource. @@ -82,7 +90,7 @@ func (client *FarmBeatsModelsClient) createOrUpdateCreateRequest(ctx context.Con func (client *FarmBeatsModelsClient) createOrUpdateHandleResponse(resp *http.Response) (FarmBeatsModelsCreateOrUpdateResponse, error) { result := FarmBeatsModelsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FarmBeats); err != nil { - return FarmBeatsModelsCreateOrUpdateResponse{}, err + return FarmBeatsModelsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -203,7 +211,7 @@ func (client *FarmBeatsModelsClient) getCreateRequest(ctx context.Context, resou func (client *FarmBeatsModelsClient) getHandleResponse(resp *http.Response) (FarmBeatsModelsGetResponse, error) { result := FarmBeatsModelsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FarmBeats); err != nil { - return FarmBeatsModelsGetResponse{}, err + return FarmBeatsModelsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -267,7 +275,7 @@ func (client *FarmBeatsModelsClient) listByResourceGroupCreateRequest(ctx contex func (client *FarmBeatsModelsClient) listByResourceGroupHandleResponse(resp *http.Response) (FarmBeatsModelsListByResourceGroupResponse, error) { result := FarmBeatsModelsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FarmBeatsListResponse); err != nil { - return FarmBeatsModelsListByResourceGroupResponse{}, err + return FarmBeatsModelsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -327,7 +335,7 @@ func (client *FarmBeatsModelsClient) listBySubscriptionCreateRequest(ctx context func (client *FarmBeatsModelsClient) listBySubscriptionHandleResponse(resp *http.Response) (FarmBeatsModelsListBySubscriptionResponse, error) { result := FarmBeatsModelsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FarmBeatsListResponse); err != nil { - return FarmBeatsModelsListBySubscriptionResponse{}, err + return FarmBeatsModelsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -392,7 +400,7 @@ func (client *FarmBeatsModelsClient) updateCreateRequest(ctx context.Context, fa func (client *FarmBeatsModelsClient) updateHandleResponse(resp *http.Response) (FarmBeatsModelsUpdateResponse, error) { result := FarmBeatsModelsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FarmBeats); err != nil { - return FarmBeatsModelsUpdateResponse{}, err + return FarmBeatsModelsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/agrifood/armagrifood/zz_generated_locations_client.go b/sdk/resourcemanager/agrifood/armagrifood/zz_generated_locations_client.go index fca0593f1b19..7734f2ebb158 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/zz_generated_locations_client.go +++ b/sdk/resourcemanager/agrifood/armagrifood/zz_generated_locations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LocationsClient contains the methods for the Locations group. @@ -30,8 +31,15 @@ type LocationsClient struct { } // NewLocationsClient creates a new instance of LocationsClient with the specified values. -func NewLocationsClient(con *arm.Connection, subscriptionID string) *LocationsClient { - return &LocationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LocationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LocationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNameAvailability - Checks the name availability of the resource with requested resource name. @@ -73,7 +81,7 @@ func (client *LocationsClient) checkNameAvailabilityCreateRequest(ctx context.Co func (client *LocationsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (LocationsCheckNameAvailabilityResponse, error) { result := LocationsCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponse); err != nil { - return LocationsCheckNameAvailabilityResponse{}, err + return LocationsCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/agrifood/armagrifood/zz_generated_models.go b/sdk/resourcemanager/agrifood/armagrifood/zz_generated_models.go index 1bf68864c33f..ba2f3021ad35 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/zz_generated_models.go +++ b/sdk/resourcemanager/agrifood/armagrifood/zz_generated_models.go @@ -10,10 +10,9 @@ package armagrifood import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // CheckNameAvailabilityRequest - The check availability request body. @@ -536,10 +535,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -555,9 +554,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -566,9 +563,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) diff --git a/sdk/resourcemanager/agrifood/armagrifood/zz_generated_operations_client.go b/sdk/resourcemanager/agrifood/armagrifood/zz_generated_operations_client.go index 117b8c90b800..1acf94450e75 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/zz_generated_operations_client.go +++ b/sdk/resourcemanager/agrifood/armagrifood/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armagrifood import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists the available operations of Microsoft.AgFoodPlatform resource provider. @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/agrifood/armagrifood/zz_generated_pagers.go b/sdk/resourcemanager/agrifood/armagrifood/zz_generated_pagers.go index cf1dbd6d08f0..e76ec7d6ded0 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/zz_generated_pagers.go +++ b/sdk/resourcemanager/agrifood/armagrifood/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armagrifood import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // ExtensionsListByFarmBeatsPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/agrifood/armagrifood/zz_generated_time_rfc3339.go b/sdk/resourcemanager/agrifood/armagrifood/zz_generated_time_rfc3339.go index 05261373c48f..f1d3ec094897 100644 --- a/sdk/resourcemanager/agrifood/armagrifood/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/agrifood/armagrifood/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armagrifood import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/CHANGELOG.md b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/CHANGELOG.md index e4f3d9f035c1..6ee9f3587c1a 100644 --- a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/CHANGELOG.md +++ b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-26) diff --git a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/README.md b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/README.md index e9653d1e2db2..0e021a738cdc 100644 --- a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/README.md +++ b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Alerts Management +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Alerts Management modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armalertsmanagement.NewAlertsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Alerts Management modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armalertsmanagement.NewAlertsClient(conn,"") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armalertsmanagement.NewAlertsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/autorest.md b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/autorest.md index 30cff12f9137..74239df34fc8 100644 --- a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/autorest.md +++ b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/autorest.md @@ -5,10 +5,10 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/3c16aae50c7110e1aad241ac93995621d4093d46/specification/alertsmanagement/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/3c16aae50c7110e1aad241ac93995621d4093d46/specification/alertsmanagement/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/alertsmanagement/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/alertsmanagement/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 modelerfour: lenient-model-deduplication: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/go.mod b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/go.mod index 7e3d5c8c0a29..adf43247d2ee 100644 --- a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/go.mod +++ b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/alertsmanagement/ar go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.2.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/go.sum b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/go.sum index c8ff7a2143ad..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/go.sum +++ b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible h1:iCb2tuoEm3N7ZpUDOvu1Yxl1B3iOVDmaD6weaRuIPzs= -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_actionrules_client.go b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_actionrules_client.go index 4b63632357ca..82bca758c254 100644 --- a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_actionrules_client.go +++ b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_actionrules_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -29,8 +31,15 @@ type ActionRulesClient struct { } // NewActionRulesClient creates a new instance of ActionRulesClient with the specified values. -func NewActionRulesClient(con *arm.Connection, subscriptionID string) *ActionRulesClient { - return &ActionRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewActionRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ActionRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ActionRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateUpdate - Creates/Updates a specific action rule @@ -83,7 +92,7 @@ func (client *ActionRulesClient) createUpdateHandleResponse(resp *http.Response) result.XMSRequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ActionRule); err != nil { - return ActionRulesCreateUpdateResponse{}, err + return ActionRulesCreateUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -151,7 +160,7 @@ func (client *ActionRulesClient) deleteHandleResponse(resp *http.Response) (Acti result.XMSRequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.Value); err != nil { - return ActionRulesDeleteResponse{}, err + return ActionRulesDeleteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -219,7 +228,7 @@ func (client *ActionRulesClient) getByNameHandleResponse(resp *http.Response) (A result.XMSRequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ActionRule); err != nil { - return ActionRulesGetByNameResponse{}, err + return ActionRulesGetByNameResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -310,7 +319,7 @@ func (client *ActionRulesClient) listByResourceGroupHandleResponse(resp *http.Re result.XMSRequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ActionRulesList); err != nil { - return ActionRulesListByResourceGroupResponse{}, err + return ActionRulesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -397,7 +406,7 @@ func (client *ActionRulesClient) listBySubscriptionHandleResponse(resp *http.Res result.XMSRequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ActionRulesList); err != nil { - return ActionRulesListBySubscriptionResponse{}, err + return ActionRulesListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -465,7 +474,7 @@ func (client *ActionRulesClient) updateHandleResponse(resp *http.Response) (Acti result.XMSRequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ActionRule); err != nil { - return ActionRulesUpdateResponse{}, err + return ActionRulesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_alerts_client.go b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_alerts_client.go index a0ae16dd536a..66423b509dd7 100644 --- a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_alerts_client.go +++ b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_alerts_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -30,8 +32,15 @@ type AlertsClient struct { } // NewAlertsClient creates a new instance of AlertsClient with the specified values. -func NewAlertsClient(con *arm.Connection, subscriptionID string) *AlertsClient { - return &AlertsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAlertsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AlertsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AlertsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ChangeState - Change the state of an alert. @@ -78,7 +87,7 @@ func (client *AlertsClient) changeStateCreateRequest(ctx context.Context, alertI func (client *AlertsClient) changeStateHandleResponse(resp *http.Response) (AlertsChangeStateResponse, error) { result := AlertsChangeStateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Alert); err != nil { - return AlertsChangeStateResponse{}, err + return AlertsChangeStateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -185,7 +194,7 @@ func (client *AlertsClient) getAllCreateRequest(ctx context.Context, options *Al func (client *AlertsClient) getAllHandleResponse(resp *http.Response) (AlertsGetAllResponse, error) { result := AlertsGetAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertsList); err != nil { - return AlertsGetAllResponse{}, err + return AlertsGetAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -246,7 +255,7 @@ func (client *AlertsClient) getByIDCreateRequest(ctx context.Context, alertID st func (client *AlertsClient) getByIDHandleResponse(resp *http.Response) (AlertsGetByIDResponse, error) { result := AlertsGetByIDResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Alert); err != nil { - return AlertsGetByIDResponse{}, err + return AlertsGetByIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -307,7 +316,7 @@ func (client *AlertsClient) getHistoryCreateRequest(ctx context.Context, alertID func (client *AlertsClient) getHistoryHandleResponse(resp *http.Response) (AlertsGetHistoryResponse, error) { result := AlertsGetHistoryResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertModification); err != nil { - return AlertsGetHistoryResponse{}, err + return AlertsGetHistoryResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -398,7 +407,7 @@ func (client *AlertsClient) getSummaryCreateRequest(ctx context.Context, groupby func (client *AlertsClient) getSummaryHandleResponse(resp *http.Response) (AlertsGetSummaryResponse, error) { result := AlertsGetSummaryResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertsSummary); err != nil { - return AlertsGetSummaryResponse{}, err + return AlertsGetSummaryResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -452,7 +461,7 @@ func (client *AlertsClient) metaDataCreateRequest(ctx context.Context, identifie func (client *AlertsClient) metaDataHandleResponse(resp *http.Response) (AlertsMetaDataResponse, error) { result := AlertsMetaDataResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertsMetaData); err != nil { - return AlertsMetaDataResponse{}, err + return AlertsMetaDataResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_constants.go b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_constants.go index aca6205f77c2..7775c0645000 100644 --- a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_constants.go +++ b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_constants.go @@ -10,7 +10,7 @@ package armalertsmanagement const ( module = "armalertsmanagement" - version = "v0.1.1" + version = "v0.2.0" ) // ActionRuleStatus - Indicates if the given action rule is enabled or disabled diff --git a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_models.go b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_models.go index 11479ad259db..c72faee9e84b 100644 --- a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_models.go +++ b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_models.go @@ -165,10 +165,10 @@ func (a *ActionRuleProperties) UnmarshalJSON(data []byte) error { func (a ActionRuleProperties) marshalInternal(objectMap map[string]interface{}, discValue ActionRuleType) { populate(objectMap, "conditions", a.Conditions) - populate(objectMap, "createdAt", (*timeRFC3339)(a.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", a.CreatedAt) populate(objectMap, "createdBy", a.CreatedBy) populate(objectMap, "description", a.Description) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(a.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", a.LastModifiedAt) populate(objectMap, "lastModifiedBy", a.LastModifiedBy) populate(objectMap, "scope", a.Scope) populate(objectMap, "status", a.Status) @@ -184,9 +184,7 @@ func (a *ActionRuleProperties) unmarshalInternal(rawMsg map[string]json.RawMessa err = unpopulate(val, &a.Conditions) delete(rawMsg, key) case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &a.CreatedBy) @@ -195,9 +193,7 @@ func (a *ActionRuleProperties) unmarshalInternal(rawMsg map[string]json.RawMessa err = unpopulate(val, &a.Description) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &a.LastModifiedBy) @@ -1126,17 +1122,17 @@ func (e Essentials) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "alertRule", e.AlertRule) populate(objectMap, "alertState", e.AlertState) - populate(objectMap, "lastModifiedDateTime", (*timeRFC3339)(e.LastModifiedDateTime)) + populateTimeRFC3339(objectMap, "lastModifiedDateTime", e.LastModifiedDateTime) populate(objectMap, "lastModifiedUserName", e.LastModifiedUserName) populate(objectMap, "monitorCondition", e.MonitorCondition) - populate(objectMap, "monitorConditionResolvedDateTime", (*timeRFC3339)(e.MonitorConditionResolvedDateTime)) + populateTimeRFC3339(objectMap, "monitorConditionResolvedDateTime", e.MonitorConditionResolvedDateTime) populate(objectMap, "monitorService", e.MonitorService) populate(objectMap, "severity", e.Severity) populate(objectMap, "signalType", e.SignalType) populate(objectMap, "smartGroupId", e.SmartGroupID) populate(objectMap, "smartGroupingReason", e.SmartGroupingReason) populate(objectMap, "sourceCreatedId", e.SourceCreatedID) - populate(objectMap, "startDateTime", (*timeRFC3339)(e.StartDateTime)) + populateTimeRFC3339(objectMap, "startDateTime", e.StartDateTime) populate(objectMap, "targetResource", e.TargetResource) populate(objectMap, "targetResourceGroup", e.TargetResourceGroup) populate(objectMap, "targetResourceName", e.TargetResourceName) @@ -1160,9 +1156,7 @@ func (e *Essentials) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.AlertState) delete(rawMsg, key) case "lastModifiedDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.LastModifiedDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.LastModifiedDateTime) delete(rawMsg, key) case "lastModifiedUserName": err = unpopulate(val, &e.LastModifiedUserName) @@ -1171,9 +1165,7 @@ func (e *Essentials) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.MonitorCondition) delete(rawMsg, key) case "monitorConditionResolvedDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.MonitorConditionResolvedDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.MonitorConditionResolvedDateTime) delete(rawMsg, key) case "monitorService": err = unpopulate(val, &e.MonitorService) @@ -1194,9 +1186,7 @@ func (e *Essentials) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.SourceCreatedID) delete(rawMsg, key) case "startDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.StartDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.StartDateTime) delete(rawMsg, key) case "targetResource": err = unpopulate(val, &e.TargetResource) @@ -1691,7 +1681,7 @@ func (s SmartGroupProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "alertSeverities", s.AlertSeverities) populate(objectMap, "alertStates", s.AlertStates) populate(objectMap, "alertsCount", s.AlertsCount) - populate(objectMap, "lastModifiedDateTime", (*timeRFC3339)(s.LastModifiedDateTime)) + populateTimeRFC3339(objectMap, "lastModifiedDateTime", s.LastModifiedDateTime) populate(objectMap, "lastModifiedUserName", s.LastModifiedUserName) populate(objectMap, "monitorConditions", s.MonitorConditions) populate(objectMap, "monitorServices", s.MonitorServices) @@ -1701,7 +1691,7 @@ func (s SmartGroupProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "resources", s.Resources) populate(objectMap, "severity", s.Severity) populate(objectMap, "smartGroupState", s.SmartGroupState) - populate(objectMap, "startDateTime", (*timeRFC3339)(s.StartDateTime)) + populateTimeRFC3339(objectMap, "startDateTime", s.StartDateTime) return json.Marshal(objectMap) } @@ -1724,9 +1714,7 @@ func (s *SmartGroupProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.AlertsCount) delete(rawMsg, key) case "lastModifiedDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedDateTime) delete(rawMsg, key) case "lastModifiedUserName": err = unpopulate(val, &s.LastModifiedUserName) @@ -1756,9 +1744,7 @@ func (s *SmartGroupProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.SmartGroupState) delete(rawMsg, key) case "startDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.StartDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.StartDateTime) delete(rawMsg, key) } if err != nil { diff --git a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_operations_client.go b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_operations_client.go index b174c6953544..2c3c38e853a5 100644 --- a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_operations_client.go +++ b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_operations_client.go @@ -11,7 +11,9 @@ package armalertsmanagement import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - List all operations available through Azure Alerts Management Resource Provider. @@ -61,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationsList); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_polymorphic_helpers.go index 81bb2bb70b28..b4d5577cc716 100644 --- a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_polymorphic_helpers.go @@ -51,6 +51,25 @@ func unmarshalActionRulePropertiesClassificationArray(rawMsg json.RawMessage) ([ return fArray, nil } +func unmarshalActionRulePropertiesClassificationMap(rawMsg json.RawMessage) (map[string]ActionRulePropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ActionRulePropertiesClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalActionRulePropertiesClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalAlertsMetaDataPropertiesClassification(rawMsg json.RawMessage) (AlertsMetaDataPropertiesClassification, error) { if rawMsg == nil { return nil, nil @@ -87,3 +106,22 @@ func unmarshalAlertsMetaDataPropertiesClassificationArray(rawMsg json.RawMessage } return fArray, nil } + +func unmarshalAlertsMetaDataPropertiesClassificationMap(rawMsg json.RawMessage) (map[string]AlertsMetaDataPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]AlertsMetaDataPropertiesClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalAlertsMetaDataPropertiesClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_smartdetectoralertrules_client.go b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_smartdetectoralertrules_client.go index 80adf65b2601..2967540038ca 100644 --- a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_smartdetectoralertrules_client.go +++ b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_smartdetectoralertrules_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -30,8 +32,15 @@ type SmartDetectorAlertRulesClient struct { } // NewSmartDetectorAlertRulesClient creates a new instance of SmartDetectorAlertRulesClient with the specified values. -func NewSmartDetectorAlertRulesClient(con *arm.Connection, subscriptionID string) *SmartDetectorAlertRulesClient { - return &SmartDetectorAlertRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSmartDetectorAlertRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SmartDetectorAlertRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SmartDetectorAlertRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update a Smart Detector alert rule. @@ -81,7 +90,7 @@ func (client *SmartDetectorAlertRulesClient) createOrUpdateCreateRequest(ctx con func (client *SmartDetectorAlertRulesClient) createOrUpdateHandleResponse(resp *http.Response) (SmartDetectorAlertRulesCreateOrUpdateResponse, error) { result := SmartDetectorAlertRulesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertRule); err != nil { - return SmartDetectorAlertRulesCreateOrUpdateResponse{}, err + return SmartDetectorAlertRulesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -205,7 +214,7 @@ func (client *SmartDetectorAlertRulesClient) getCreateRequest(ctx context.Contex func (client *SmartDetectorAlertRulesClient) getHandleResponse(resp *http.Response) (SmartDetectorAlertRulesGetResponse, error) { result := SmartDetectorAlertRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertRule); err != nil { - return SmartDetectorAlertRulesGetResponse{}, err + return SmartDetectorAlertRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -262,7 +271,7 @@ func (client *SmartDetectorAlertRulesClient) listCreateRequest(ctx context.Conte func (client *SmartDetectorAlertRulesClient) listHandleResponse(resp *http.Response) (SmartDetectorAlertRulesListResponse, error) { result := SmartDetectorAlertRulesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertRulesList); err != nil { - return SmartDetectorAlertRulesListResponse{}, err + return SmartDetectorAlertRulesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -323,7 +332,7 @@ func (client *SmartDetectorAlertRulesClient) listByResourceGroupCreateRequest(ct func (client *SmartDetectorAlertRulesClient) listByResourceGroupHandleResponse(resp *http.Response) (SmartDetectorAlertRulesListByResourceGroupResponse, error) { result := SmartDetectorAlertRulesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertRulesList); err != nil { - return SmartDetectorAlertRulesListByResourceGroupResponse{}, err + return SmartDetectorAlertRulesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -388,7 +397,7 @@ func (client *SmartDetectorAlertRulesClient) patchCreateRequest(ctx context.Cont func (client *SmartDetectorAlertRulesClient) patchHandleResponse(resp *http.Response) (SmartDetectorAlertRulesPatchResponse, error) { result := SmartDetectorAlertRulesPatchResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertRule); err != nil { - return SmartDetectorAlertRulesPatchResponse{}, err + return SmartDetectorAlertRulesPatchResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_smartgroups_client.go b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_smartgroups_client.go index 7aaab19c07dd..902928b09d05 100644 --- a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_smartgroups_client.go +++ b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_smartgroups_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -30,8 +32,15 @@ type SmartGroupsClient struct { } // NewSmartGroupsClient creates a new instance of SmartGroupsClient with the specified values. -func NewSmartGroupsClient(con *arm.Connection, subscriptionID string) *SmartGroupsClient { - return &SmartGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSmartGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SmartGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SmartGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ChangeState - Change the state of a Smart Group. @@ -81,7 +90,7 @@ func (client *SmartGroupsClient) changeStateHandleResponse(resp *http.Response) result.XMSRequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.SmartGroup); err != nil { - return SmartGroupsChangeStateResponse{}, err + return SmartGroupsChangeStateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -168,7 +177,7 @@ func (client *SmartGroupsClient) getAllCreateRequest(ctx context.Context, option func (client *SmartGroupsClient) getAllHandleResponse(resp *http.Response) (SmartGroupsGetAllResponse, error) { result := SmartGroupsGetAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SmartGroupsList); err != nil { - return SmartGroupsGetAllResponse{}, err + return SmartGroupsGetAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -232,7 +241,7 @@ func (client *SmartGroupsClient) getByIDHandleResponse(resp *http.Response) (Sma result.XMSRequestID = &val } if err := runtime.UnmarshalAsJSON(resp, &result.SmartGroup); err != nil { - return SmartGroupsGetByIDResponse{}, err + return SmartGroupsGetByIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -293,7 +302,7 @@ func (client *SmartGroupsClient) getHistoryCreateRequest(ctx context.Context, sm func (client *SmartGroupsClient) getHistoryHandleResponse(resp *http.Response) (SmartGroupsGetHistoryResponse, error) { result := SmartGroupsGetHistoryResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SmartGroupModification); err != nil { - return SmartGroupsGetHistoryResponse{}, err + return SmartGroupsGetHistoryResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_time_rfc3339.go b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_time_rfc3339.go index d14c88c6147b..98ed580a246c 100644 --- a/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/alertsmanagement/armalertsmanagement/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armalertsmanagement import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/CHANGELOG.md b/sdk/resourcemanager/apimanagement/armapimanagement/CHANGELOG.md index 0fb020fa113e..42ac080f9b98 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/CHANGELOG.md +++ b/sdk/resourcemanager/apimanagement/armapimanagement/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-10-08) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armapimanagement". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/apimanagement/armapimanagement") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/README.md b/sdk/resourcemanager/apimanagement/armapimanagement/README.md index fbbf0be072d5..3096ee9377e2 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/README.md +++ b/sdk/resourcemanager/apimanagement/armapimanagement/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure API Management +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure API Management modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armapimanagement.NewTagClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure API Management modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armapimanagement.NewTagClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armapimanagement.NewTagClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/autorest.md b/sdk/resourcemanager/apimanagement/armapimanagement/autorest.md index 96fd24bdd426..d87fdbae475d 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/autorest.md +++ b/sdk/resourcemanager/apimanagement/armapimanagement/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/apimanagement/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/apimanagement/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/apimanagement/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/apimanagement/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/go.mod b/sdk/resourcemanager/apimanagement/armapimanagement/go.mod index 7b16079ef0ba..f78503398643 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/go.mod +++ b/sdk/resourcemanager/apimanagement/armapimanagement/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/apimanagement/armap go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/go.sum b/sdk/resourcemanager/apimanagement/armapimanagement/go.sum index 4f0fb709cf31..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/go.sum +++ b/sdk/resourcemanager/apimanagement/armapimanagement/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible h1:Cw16jiP4dI+CK761aq44ol4RV5dUiIIXky1+EKpoiVM= -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_api_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_api_client.go index 43f774d4d6ab..f310a720f196 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_api_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_api_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // APIClient contains the methods for the API group. @@ -32,8 +32,15 @@ type APIClient struct { } // NewAPIClient creates a new instance of APIClient with the specified values. -func NewAPIClient(con *arm.Connection, subscriptionID string) *APIClient { - return &APIClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAPIClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *APIClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APIClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates new or updates existing specified API of the API Management service instance. @@ -97,7 +104,7 @@ func (client *APIClient) createOrUpdateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -163,7 +170,7 @@ func (client *APIClient) deleteCreateRequest(ctx context.Context, resourceGroupN if options != nil && options.DeleteRevisions != nil { reqQP.Set("deleteRevisions", strconv.FormatBool(*options.DeleteRevisions)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -224,7 +231,7 @@ func (client *APIClient) getCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -237,7 +244,7 @@ func (client *APIClient) getHandleResponse(resp *http.Response) (APIGetResponse, result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.APIContract); err != nil { - return APIGetResponse{}, err + return APIGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -293,7 +300,7 @@ func (client *APIClient) getEntityTagCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -360,7 +367,7 @@ func (client *APIClient) listByServiceCreateRequest(ctx context.Context, resourc if options != nil && options.ExpandAPIVersionSet != nil { reqQP.Set("expandApiVersionSet", strconv.FormatBool(*options.ExpandAPIVersionSet)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -370,7 +377,7 @@ func (client *APIClient) listByServiceCreateRequest(ctx context.Context, resourc func (client *APIClient) listByServiceHandleResponse(resp *http.Response) (APIListByServiceResponse, error) { result := APIListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APICollection); err != nil { - return APIListByServiceResponse{}, err + return APIListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -434,7 +441,7 @@ func (client *APIClient) listByTagsCreateRequest(ctx context.Context, resourceGr if options != nil && options.IncludeNotTaggedApis != nil { reqQP.Set("includeNotTaggedApis", strconv.FormatBool(*options.IncludeNotTaggedApis)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -444,7 +451,7 @@ func (client *APIClient) listByTagsCreateRequest(ctx context.Context, resourceGr func (client *APIClient) listByTagsHandleResponse(resp *http.Response) (APIListByTagsResponse, error) { result := APIListByTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TagResourceCollection); err != nil { - return APIListByTagsResponse{}, err + return APIListByTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -503,7 +510,7 @@ func (client *APIClient) updateCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -517,7 +524,7 @@ func (client *APIClient) updateHandleResponse(resp *http.Response) (APIUpdateRes result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.APIContract); err != nil { - return APIUpdateResponse{}, err + return APIUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apidiagnostic_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apidiagnostic_client.go index 74bca973fcce..902da70f0cac 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apidiagnostic_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apidiagnostic_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // APIDiagnosticClient contains the methods for the APIDiagnostic group. @@ -31,8 +32,15 @@ type APIDiagnosticClient struct { } // NewAPIDiagnosticClient creates a new instance of APIDiagnosticClient with the specified values. -func NewAPIDiagnosticClient(con *arm.Connection, subscriptionID string) *APIDiagnosticClient { - return &APIDiagnosticClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAPIDiagnosticClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *APIDiagnosticClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APIDiagnosticClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates a new Diagnostic for an API or updates an existing one. @@ -80,7 +88,7 @@ func (client *APIDiagnosticClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -96,7 +104,7 @@ func (client *APIDiagnosticClient) createOrUpdateHandleResponse(resp *http.Respo result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticContract); err != nil { - return APIDiagnosticCreateOrUpdateResponse{}, err + return APIDiagnosticCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -159,7 +167,7 @@ func (client *APIDiagnosticClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -224,7 +232,7 @@ func (client *APIDiagnosticClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -237,7 +245,7 @@ func (client *APIDiagnosticClient) getHandleResponse(resp *http.Response) (APIDi result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticContract); err != nil { - return APIDiagnosticGetResponse{}, err + return APIDiagnosticGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -297,7 +305,7 @@ func (client *APIDiagnosticClient) getEntityTagCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -362,7 +370,7 @@ func (client *APIDiagnosticClient) listByServiceCreateRequest(ctx context.Contex if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -372,7 +380,7 @@ func (client *APIDiagnosticClient) listByServiceCreateRequest(ctx context.Contex func (client *APIDiagnosticClient) listByServiceHandleResponse(resp *http.Response) (APIDiagnosticListByServiceResponse, error) { result := APIDiagnosticListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticCollection); err != nil { - return APIDiagnosticListByServiceResponse{}, err + return APIDiagnosticListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -435,7 +443,7 @@ func (client *APIDiagnosticClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -449,7 +457,7 @@ func (client *APIDiagnosticClient) updateHandleResponse(resp *http.Response) (AP result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticContract); err != nil { - return APIDiagnosticUpdateResponse{}, err + return APIDiagnosticUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiexport_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiexport_client.go index 628037aa0792..fc1819766973 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiexport_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiexport_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // APIExportClient contains the methods for the APIExport group. @@ -30,8 +31,15 @@ type APIExportClient struct { } // NewAPIExportClient creates a new instance of APIExportClient with the specified values. -func NewAPIExportClient(con *arm.Connection, subscriptionID string) *APIExportClient { - return &APIExportClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAPIExportClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *APIExportClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APIExportClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // 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. @@ -77,7 +85,7 @@ func (client *APIExportClient) getCreateRequest(ctx context.Context, resourceGro reqQP := req.Raw().URL.Query() reqQP.Set("format", string(formatParam)) reqQP.Set("export", string(export)) - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -87,7 +95,7 @@ func (client *APIExportClient) getCreateRequest(ctx context.Context, resourceGro func (client *APIExportClient) getHandleResponse(resp *http.Response) (APIExportGetResponse, error) { result := APIExportGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIExportResult); err != nil { - return APIExportGetResponse{}, err + return APIExportGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiissue_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiissue_client.go index 335d486f5cb6..9ca0b134c284 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiissue_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiissue_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // APIIssueClient contains the methods for the APIIssue group. @@ -31,8 +32,15 @@ type APIIssueClient struct { } // NewAPIIssueClient creates a new instance of APIIssueClient with the specified values. -func NewAPIIssueClient(con *arm.Connection, subscriptionID string) *APIIssueClient { - return &APIIssueClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAPIIssueClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *APIIssueClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APIIssueClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates a new Issue for an API or updates an existing one. @@ -80,7 +88,7 @@ func (client *APIIssueClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -96,7 +104,7 @@ func (client *APIIssueClient) createOrUpdateHandleResponse(resp *http.Response) result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.IssueContract); err != nil { - return APIIssueCreateOrUpdateResponse{}, err + return APIIssueCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -159,7 +167,7 @@ func (client *APIIssueClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -227,7 +235,7 @@ func (client *APIIssueClient) getCreateRequest(ctx context.Context, resourceGrou if options != nil && options.ExpandCommentsAttachments != nil { reqQP.Set("expandCommentsAttachments", strconv.FormatBool(*options.ExpandCommentsAttachments)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -240,7 +248,7 @@ func (client *APIIssueClient) getHandleResponse(resp *http.Response) (APIIssueGe result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.IssueContract); err != nil { - return APIIssueGetResponse{}, err + return APIIssueGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -300,7 +308,7 @@ func (client *APIIssueClient) getEntityTagCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -368,7 +376,7 @@ func (client *APIIssueClient) listByServiceCreateRequest(ctx context.Context, re if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -378,7 +386,7 @@ func (client *APIIssueClient) listByServiceCreateRequest(ctx context.Context, re func (client *APIIssueClient) listByServiceHandleResponse(resp *http.Response) (APIIssueListByServiceResponse, error) { result := APIIssueListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IssueCollection); err != nil { - return APIIssueListByServiceResponse{}, err + return APIIssueListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -441,7 +449,7 @@ func (client *APIIssueClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -455,7 +463,7 @@ func (client *APIIssueClient) updateHandleResponse(resp *http.Response) (APIIssu result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.IssueContract); err != nil { - return APIIssueUpdateResponse{}, err + return APIIssueUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiissueattachment_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiissueattachment_client.go index 43090822f19f..691f3d72b5f4 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiissueattachment_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiissueattachment_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // APIIssueAttachmentClient contains the methods for the APIIssueAttachment group. @@ -31,8 +32,15 @@ type APIIssueAttachmentClient struct { } // NewAPIIssueAttachmentClient creates a new instance of APIIssueAttachmentClient with the specified values. -func NewAPIIssueAttachmentClient(con *arm.Connection, subscriptionID string) *APIIssueAttachmentClient { - return &APIIssueAttachmentClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAPIIssueAttachmentClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *APIIssueAttachmentClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APIIssueAttachmentClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates a new Attachment for the Issue in an API or updates an existing one. @@ -84,7 +92,7 @@ func (client *APIIssueAttachmentClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -100,7 +108,7 @@ func (client *APIIssueAttachmentClient) createOrUpdateHandleResponse(resp *http. result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.IssueAttachmentContract); err != nil { - return APIIssueAttachmentCreateOrUpdateResponse{}, err + return APIIssueAttachmentCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -167,7 +175,7 @@ func (client *APIIssueAttachmentClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -236,7 +244,7 @@ func (client *APIIssueAttachmentClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -249,7 +257,7 @@ func (client *APIIssueAttachmentClient) getHandleResponse(resp *http.Response) ( result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.IssueAttachmentContract); err != nil { - return APIIssueAttachmentGetResponse{}, err + return APIIssueAttachmentGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -313,7 +321,7 @@ func (client *APIIssueAttachmentClient) getEntityTagCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -382,7 +390,7 @@ func (client *APIIssueAttachmentClient) listByServiceCreateRequest(ctx context.C if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -392,7 +400,7 @@ func (client *APIIssueAttachmentClient) listByServiceCreateRequest(ctx context.C func (client *APIIssueAttachmentClient) listByServiceHandleResponse(resp *http.Response) (APIIssueAttachmentListByServiceResponse, error) { result := APIIssueAttachmentListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IssueAttachmentCollection); err != nil { - return APIIssueAttachmentListByServiceResponse{}, err + return APIIssueAttachmentListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiissuecomment_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiissuecomment_client.go index b89bbf7f6682..c4364ae475e8 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiissuecomment_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiissuecomment_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // APIIssueCommentClient contains the methods for the APIIssueComment group. @@ -31,8 +32,15 @@ type APIIssueCommentClient struct { } // NewAPIIssueCommentClient creates a new instance of APIIssueCommentClient with the specified values. -func NewAPIIssueCommentClient(con *arm.Connection, subscriptionID string) *APIIssueCommentClient { - return &APIIssueCommentClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAPIIssueCommentClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *APIIssueCommentClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APIIssueCommentClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates a new Comment for the Issue in an API or updates an existing one. @@ -84,7 +92,7 @@ func (client *APIIssueCommentClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -100,7 +108,7 @@ func (client *APIIssueCommentClient) createOrUpdateHandleResponse(resp *http.Res result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.IssueCommentContract); err != nil { - return APIIssueCommentCreateOrUpdateResponse{}, err + return APIIssueCommentCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -167,7 +175,7 @@ func (client *APIIssueCommentClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -236,7 +244,7 @@ func (client *APIIssueCommentClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -249,7 +257,7 @@ func (client *APIIssueCommentClient) getHandleResponse(resp *http.Response) (API result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.IssueCommentContract); err != nil { - return APIIssueCommentGetResponse{}, err + return APIIssueCommentGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -313,7 +321,7 @@ func (client *APIIssueCommentClient) getEntityTagCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -382,7 +390,7 @@ func (client *APIIssueCommentClient) listByServiceCreateRequest(ctx context.Cont if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -392,7 +400,7 @@ func (client *APIIssueCommentClient) listByServiceCreateRequest(ctx context.Cont func (client *APIIssueCommentClient) listByServiceHandleResponse(resp *http.Response) (APIIssueCommentListByServiceResponse, error) { result := APIIssueCommentListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IssueCommentCollection); err != nil { - return APIIssueCommentListByServiceResponse{}, err + return APIIssueCommentListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementclient_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementclient_client.go index 7aa62f451dad..713eed40e8c0 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementclient_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementclient_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // APIManagementClient contains the methods for the APIManagementClient group. @@ -31,8 +31,15 @@ type APIManagementClient struct { } // NewAPIManagementClient creates a new instance of APIManagementClient with the specified values. -func NewAPIManagementClient(con *arm.Connection, subscriptionID string) *APIManagementClient { - return &APIManagementClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAPIManagementClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *APIManagementClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APIManagementClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginPerformConnectivityCheckAsync - Performs a connectivity check between the API Management service and a given destination, and returns metrics for @@ -94,7 +101,7 @@ func (client *APIManagementClient) performConnectivityCheckAsyncCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, connectivityCheckRequestParams) diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementoperations_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementoperations_client.go index 3b45d32a991a..3782178f7a30 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementoperations_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementoperations_client.go @@ -11,11 +11,12 @@ package armapimanagement import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // APIManagementOperationsClient contains the methods for the APIManagementOperations group. @@ -26,8 +27,15 @@ type APIManagementOperationsClient struct { } // NewAPIManagementOperationsClient creates a new instance of APIManagementOperationsClient with the specified values. -func NewAPIManagementOperationsClient(con *arm.Connection) *APIManagementOperationsClient { - return &APIManagementOperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewAPIManagementOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *APIManagementOperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APIManagementOperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available REST API operations of the Microsoft.ApiManagement provider. @@ -52,7 +60,7 @@ func (client *APIManagementOperationsClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -62,7 +70,7 @@ func (client *APIManagementOperationsClient) listCreateRequest(ctx context.Conte func (client *APIManagementOperationsClient) listHandleResponse(resp *http.Response) (APIManagementOperationsListResponse, error) { result := APIManagementOperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return APIManagementOperationsListResponse{}, err + return APIManagementOperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementservice_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementservice_client.go index 79d1c1c032f0..598fa596ed23 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementservice_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementservice_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // APIManagementServiceClient contains the methods for the APIManagementService group. @@ -31,8 +31,15 @@ type APIManagementServiceClient struct { } // NewAPIManagementServiceClient creates a new instance of APIManagementServiceClient with the specified values. -func NewAPIManagementServiceClient(con *arm.Connection, subscriptionID string) *APIManagementServiceClient { - return &APIManagementServiceClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAPIManagementServiceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *APIManagementServiceClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APIManagementServiceClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginApplyNetworkConfigurationUpdates - Updates the Microsoft.ApiManagement resource running in the Virtual network to pick the updated DNS changes. @@ -92,7 +99,7 @@ func (client *APIManagementServiceClient) applyNetworkConfigurationUpdatesCreate return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Parameters != nil { @@ -173,7 +180,7 @@ func (client *APIManagementServiceClient) backupCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -221,7 +228,7 @@ func (client *APIManagementServiceClient) checkNameAvailabilityCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -231,7 +238,7 @@ func (client *APIManagementServiceClient) checkNameAvailabilityCreateRequest(ctx func (client *APIManagementServiceClient) checkNameAvailabilityHandleResponse(resp *http.Response) (APIManagementServiceCheckNameAvailabilityResponse, error) { result := APIManagementServiceCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIManagementServiceNameAvailabilityResult); err != nil { - return APIManagementServiceCheckNameAvailabilityResponse{}, err + return APIManagementServiceCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -306,7 +313,7 @@ func (client *APIManagementServiceClient) createOrUpdateCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -382,7 +389,7 @@ func (client *APIManagementServiceClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -438,7 +445,7 @@ func (client *APIManagementServiceClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -448,7 +455,7 @@ func (client *APIManagementServiceClient) getCreateRequest(ctx context.Context, func (client *APIManagementServiceClient) getHandleResponse(resp *http.Response) (APIManagementServiceGetResponse, error) { result := APIManagementServiceGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIManagementServiceResource); err != nil { - return APIManagementServiceGetResponse{}, err + return APIManagementServiceGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -495,7 +502,7 @@ func (client *APIManagementServiceClient) getDomainOwnershipIdentifierCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -505,7 +512,7 @@ func (client *APIManagementServiceClient) getDomainOwnershipIdentifierCreateRequ func (client *APIManagementServiceClient) getDomainOwnershipIdentifierHandleResponse(resp *http.Response) (APIManagementServiceGetDomainOwnershipIdentifierResponse, error) { result := APIManagementServiceGetDomainOwnershipIdentifierResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIManagementServiceGetDomainOwnershipIdentifierResult); err != nil { - return APIManagementServiceGetDomainOwnershipIdentifierResponse{}, err + return APIManagementServiceGetDomainOwnershipIdentifierResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -560,7 +567,7 @@ func (client *APIManagementServiceClient) getSsoTokenCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -570,7 +577,7 @@ func (client *APIManagementServiceClient) getSsoTokenCreateRequest(ctx context.C func (client *APIManagementServiceClient) getSsoTokenHandleResponse(resp *http.Response) (APIManagementServiceGetSsoTokenResponse, error) { result := APIManagementServiceGetSsoTokenResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIManagementServiceGetSsoTokenResult); err != nil { - return APIManagementServiceGetSsoTokenResponse{}, err + return APIManagementServiceGetSsoTokenResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -614,7 +621,7 @@ func (client *APIManagementServiceClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -624,7 +631,7 @@ func (client *APIManagementServiceClient) listCreateRequest(ctx context.Context, func (client *APIManagementServiceClient) listHandleResponse(resp *http.Response) (APIManagementServiceListResponse, error) { result := APIManagementServiceListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIManagementServiceListResult); err != nil { - return APIManagementServiceListResponse{}, err + return APIManagementServiceListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -672,7 +679,7 @@ func (client *APIManagementServiceClient) listByResourceGroupCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -682,7 +689,7 @@ func (client *APIManagementServiceClient) listByResourceGroupCreateRequest(ctx c func (client *APIManagementServiceClient) listByResourceGroupHandleResponse(resp *http.Response) (APIManagementServiceListByResourceGroupResponse, error) { result := APIManagementServiceListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIManagementServiceListResult); err != nil { - return APIManagementServiceListByResourceGroupResponse{}, err + return APIManagementServiceListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -761,7 +768,7 @@ func (client *APIManagementServiceClient) restoreCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -837,7 +844,7 @@ func (client *APIManagementServiceClient) updateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementserviceskus_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementserviceskus_client.go index 2dd351184e6a..559ee2e05aa0 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementserviceskus_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementserviceskus_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // APIManagementServiceSKUsClient contains the methods for the APIManagementServiceSKUs group. @@ -30,8 +31,15 @@ type APIManagementServiceSKUsClient struct { } // NewAPIManagementServiceSKUsClient creates a new instance of APIManagementServiceSKUsClient with the specified values. -func NewAPIManagementServiceSKUsClient(con *arm.Connection, subscriptionID string) *APIManagementServiceSKUsClient { - return &APIManagementServiceSKUsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAPIManagementServiceSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *APIManagementServiceSKUsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APIManagementServiceSKUsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListAvailableServiceSKUs - Gets all available SKU for a given API Management service @@ -68,7 +76,7 @@ func (client *APIManagementServiceSKUsClient) listAvailableServiceSKUsCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -78,7 +86,7 @@ func (client *APIManagementServiceSKUsClient) listAvailableServiceSKUsCreateRequ func (client *APIManagementServiceSKUsClient) listAvailableServiceSKUsHandleResponse(resp *http.Response) (APIManagementServiceSKUsListAvailableServiceSKUsResponse, error) { result := APIManagementServiceSKUsListAvailableServiceSKUsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceSKUResults); err != nil { - return APIManagementServiceSKUsListAvailableServiceSKUsResponse{}, err + return APIManagementServiceSKUsListAvailableServiceSKUsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementskus_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementskus_client.go index a42e9d48fd00..d56db403ac65 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementskus_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apimanagementskus_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // APIManagementSKUsClient contains the methods for the APIManagementSKUs group. @@ -30,8 +31,15 @@ type APIManagementSKUsClient struct { } // NewAPIManagementSKUsClient creates a new instance of APIManagementSKUsClient with the specified values. -func NewAPIManagementSKUsClient(con *arm.Connection, subscriptionID string) *APIManagementSKUsClient { - return &APIManagementSKUsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAPIManagementSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *APIManagementSKUsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APIManagementSKUsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets the list of Microsoft.ApiManagement SKUs available for your Subscription. @@ -60,7 +68,7 @@ func (client *APIManagementSKUsClient) listCreateRequest(ctx context.Context, op return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -70,7 +78,7 @@ func (client *APIManagementSKUsClient) listCreateRequest(ctx context.Context, op func (client *APIManagementSKUsClient) listHandleResponse(resp *http.Response) (APIManagementSKUsListResponse, error) { result := APIManagementSKUsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIManagementSKUsResult); err != nil { - return APIManagementSKUsListResponse{}, err + return APIManagementSKUsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apioperation_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apioperation_client.go index a428f6a73b2d..185365d5e8e7 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apioperation_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apioperation_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // APIOperationClient contains the methods for the APIOperation group. @@ -31,8 +32,15 @@ type APIOperationClient struct { } // NewAPIOperationClient creates a new instance of APIOperationClient with the specified values. -func NewAPIOperationClient(con *arm.Connection, subscriptionID string) *APIOperationClient { - return &APIOperationClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAPIOperationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *APIOperationClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APIOperationClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates a new operation in the API or updates an existing one. @@ -80,7 +88,7 @@ func (client *APIOperationClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -96,7 +104,7 @@ func (client *APIOperationClient) createOrUpdateHandleResponse(resp *http.Respon result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.OperationContract); err != nil { - return APIOperationCreateOrUpdateResponse{}, err + return APIOperationCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -159,7 +167,7 @@ func (client *APIOperationClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -224,7 +232,7 @@ func (client *APIOperationClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -237,7 +245,7 @@ func (client *APIOperationClient) getHandleResponse(resp *http.Response) (APIOpe result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.OperationContract); err != nil { - return APIOperationGetResponse{}, err + return APIOperationGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -297,7 +305,7 @@ func (client *APIOperationClient) getEntityTagCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -365,7 +373,7 @@ func (client *APIOperationClient) listByAPICreateRequest(ctx context.Context, re if options != nil && options.Tags != nil { reqQP.Set("tags", *options.Tags) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -375,7 +383,7 @@ func (client *APIOperationClient) listByAPICreateRequest(ctx context.Context, re func (client *APIOperationClient) listByAPIHandleResponse(resp *http.Response) (APIOperationListByAPIResponse, error) { result := APIOperationListByAPIResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationCollection); err != nil { - return APIOperationListByAPIResponse{}, err + return APIOperationListByAPIResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -438,7 +446,7 @@ func (client *APIOperationClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -452,7 +460,7 @@ func (client *APIOperationClient) updateHandleResponse(resp *http.Response) (API result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.OperationContract); err != nil { - return APIOperationUpdateResponse{}, err + return APIOperationUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apioperationpolicy_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apioperationpolicy_client.go index c48405675099..fce158a6dd16 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apioperationpolicy_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apioperationpolicy_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // APIOperationPolicyClient contains the methods for the APIOperationPolicy group. @@ -30,8 +31,15 @@ type APIOperationPolicyClient struct { } // NewAPIOperationPolicyClient creates a new instance of APIOperationPolicyClient with the specified values. -func NewAPIOperationPolicyClient(con *arm.Connection, subscriptionID string) *APIOperationPolicyClient { - return &APIOperationPolicyClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAPIOperationPolicyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *APIOperationPolicyClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APIOperationPolicyClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates policy configuration for the API Operation level. @@ -83,7 +91,7 @@ func (client *APIOperationPolicyClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -99,7 +107,7 @@ func (client *APIOperationPolicyClient) createOrUpdateHandleResponse(resp *http. result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.PolicyContract); err != nil { - return APIOperationPolicyCreateOrUpdateResponse{}, err + return APIOperationPolicyCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -166,7 +174,7 @@ func (client *APIOperationPolicyClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -238,7 +246,7 @@ func (client *APIOperationPolicyClient) getCreateRequest(ctx context.Context, re if options != nil && options.Format != nil { reqQP.Set("format", string(*options.Format)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -251,7 +259,7 @@ func (client *APIOperationPolicyClient) getHandleResponse(resp *http.Response) ( result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.PolicyContract); err != nil { - return APIOperationPolicyGetResponse{}, err + return APIOperationPolicyGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -315,7 +323,7 @@ func (client *APIOperationPolicyClient) getEntityTagCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -378,7 +386,7 @@ func (client *APIOperationPolicyClient) listByOperationCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -388,7 +396,7 @@ func (client *APIOperationPolicyClient) listByOperationCreateRequest(ctx context func (client *APIOperationPolicyClient) listByOperationHandleResponse(resp *http.Response) (APIOperationPolicyListByOperationResponse, error) { result := APIOperationPolicyListByOperationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PolicyCollection); err != nil { - return APIOperationPolicyListByOperationResponse{}, err + return APIOperationPolicyListByOperationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apipolicy_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apipolicy_client.go index d4e971d53152..2a4e1d9d97fa 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apipolicy_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apipolicy_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // APIPolicyClient contains the methods for the APIPolicy group. @@ -30,8 +31,15 @@ type APIPolicyClient struct { } // NewAPIPolicyClient creates a new instance of APIPolicyClient with the specified values. -func NewAPIPolicyClient(con *arm.Connection, subscriptionID string) *APIPolicyClient { - return &APIPolicyClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAPIPolicyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *APIPolicyClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APIPolicyClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates policy configuration for the API. @@ -79,7 +87,7 @@ func (client *APIPolicyClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -95,7 +103,7 @@ func (client *APIPolicyClient) createOrUpdateHandleResponse(resp *http.Response) result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.PolicyContract); err != nil { - return APIPolicyCreateOrUpdateResponse{}, err + return APIPolicyCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -158,7 +166,7 @@ func (client *APIPolicyClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -227,7 +235,7 @@ func (client *APIPolicyClient) getCreateRequest(ctx context.Context, resourceGro if options != nil && options.Format != nil { reqQP.Set("format", string(*options.Format)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json, application/vnd.ms-azure-apim.policy+xml, application/vnd.ms-azure-apim.policy.raw+xml") return req, nil @@ -240,7 +248,7 @@ func (client *APIPolicyClient) getHandleResponse(resp *http.Response) (APIPolicy result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.PolicyContract); err != nil { - return APIPolicyGetResponse{}, err + return APIPolicyGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -300,7 +308,7 @@ func (client *APIPolicyClient) getEntityTagCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -359,7 +367,7 @@ func (client *APIPolicyClient) listByAPICreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -369,7 +377,7 @@ func (client *APIPolicyClient) listByAPICreateRequest(ctx context.Context, resou func (client *APIPolicyClient) listByAPIHandleResponse(resp *http.Response) (APIPolicyListByAPIResponse, error) { result := APIPolicyListByAPIResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PolicyCollection); err != nil { - return APIPolicyListByAPIResponse{}, err + return APIPolicyListByAPIResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiproduct_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiproduct_client.go index bb6460382b3a..7f585a077b92 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiproduct_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiproduct_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // APIProductClient contains the methods for the APIProduct group. @@ -31,8 +32,15 @@ type APIProductClient struct { } // NewAPIProductClient creates a new instance of APIProductClient with the specified values. -func NewAPIProductClient(con *arm.Connection, subscriptionID string) *APIProductClient { - return &APIProductClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAPIProductClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *APIProductClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APIProductClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByApis - Lists all Products, which the API is part of. @@ -82,7 +90,7 @@ func (client *APIProductClient) listByApisCreateRequest(ctx context.Context, res if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -92,7 +100,7 @@ func (client *APIProductClient) listByApisCreateRequest(ctx context.Context, res func (client *APIProductClient) listByApisHandleResponse(resp *http.Response) (APIProductListByApisResponse, error) { result := APIProductListByApisResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProductCollection); err != nil { - return APIProductListByApisResponse{}, err + return APIProductListByApisResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apirelease_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apirelease_client.go index 4990684904ef..f0bc0e9dc51b 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apirelease_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apirelease_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // APIReleaseClient contains the methods for the APIRelease group. @@ -31,8 +32,15 @@ type APIReleaseClient struct { } // NewAPIReleaseClient creates a new instance of APIReleaseClient with the specified values. -func NewAPIReleaseClient(con *arm.Connection, subscriptionID string) *APIReleaseClient { - return &APIReleaseClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAPIReleaseClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *APIReleaseClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APIReleaseClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates a new Release for the API. @@ -80,7 +88,7 @@ func (client *APIReleaseClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -96,7 +104,7 @@ func (client *APIReleaseClient) createOrUpdateHandleResponse(resp *http.Response result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.APIReleaseContract); err != nil { - return APIReleaseCreateOrUpdateResponse{}, err + return APIReleaseCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -159,7 +167,7 @@ func (client *APIReleaseClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -224,7 +232,7 @@ func (client *APIReleaseClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -237,7 +245,7 @@ func (client *APIReleaseClient) getHandleResponse(resp *http.Response) (APIRelea result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.APIReleaseContract); err != nil { - return APIReleaseGetResponse{}, err + return APIReleaseGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -297,7 +305,7 @@ func (client *APIReleaseClient) getEntityTagCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -364,7 +372,7 @@ func (client *APIReleaseClient) listByServiceCreateRequest(ctx context.Context, if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -374,7 +382,7 @@ func (client *APIReleaseClient) listByServiceCreateRequest(ctx context.Context, func (client *APIReleaseClient) listByServiceHandleResponse(resp *http.Response) (APIReleaseListByServiceResponse, error) { result := APIReleaseListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIReleaseCollection); err != nil { - return APIReleaseListByServiceResponse{}, err + return APIReleaseListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -437,7 +445,7 @@ func (client *APIReleaseClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -451,7 +459,7 @@ func (client *APIReleaseClient) updateHandleResponse(resp *http.Response) (APIRe result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.APIReleaseContract); err != nil { - return APIReleaseUpdateResponse{}, err + return APIReleaseUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apirevision_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apirevision_client.go index 14662f9c66cd..aeee6db089f0 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apirevision_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apirevision_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // APIRevisionClient contains the methods for the APIRevision group. @@ -31,8 +32,15 @@ type APIRevisionClient struct { } // NewAPIRevisionClient creates a new instance of APIRevisionClient with the specified values. -func NewAPIRevisionClient(con *arm.Connection, subscriptionID string) *APIRevisionClient { - return &APIRevisionClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAPIRevisionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *APIRevisionClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APIRevisionClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByService - Lists all revisions of an API. @@ -82,7 +90,7 @@ func (client *APIRevisionClient) listByServiceCreateRequest(ctx context.Context, if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -92,7 +100,7 @@ func (client *APIRevisionClient) listByServiceCreateRequest(ctx context.Context, func (client *APIRevisionClient) listByServiceHandleResponse(resp *http.Response) (APIRevisionListByServiceResponse, error) { result := APIRevisionListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIRevisionCollection); err != nil { - return APIRevisionListByServiceResponse{}, err + return APIRevisionListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apischema_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apischema_client.go index 22e528e8629a..c454fa4e055a 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apischema_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apischema_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // APISchemaClient contains the methods for the APISchema group. @@ -32,8 +32,15 @@ type APISchemaClient struct { } // NewAPISchemaClient creates a new instance of APISchemaClient with the specified values. -func NewAPISchemaClient(con *arm.Connection, subscriptionID string) *APISchemaClient { - return &APISchemaClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAPISchemaClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *APISchemaClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APISchemaClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates schema configuration for the API. @@ -101,7 +108,7 @@ func (client *APISchemaClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -171,7 +178,7 @@ func (client *APISchemaClient) deleteCreateRequest(ctx context.Context, resource if options != nil && options.Force != nil { reqQP.Set("force", strconv.FormatBool(*options.Force)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -236,7 +243,7 @@ func (client *APISchemaClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -249,7 +256,7 @@ func (client *APISchemaClient) getHandleResponse(resp *http.Response) (APISchema result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.SchemaContract); err != nil { - return APISchemaGetResponse{}, err + return APISchemaGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -309,7 +316,7 @@ func (client *APISchemaClient) getEntityTagCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -374,7 +381,7 @@ func (client *APISchemaClient) listByAPICreateRequest(ctx context.Context, resou if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -384,7 +391,7 @@ func (client *APISchemaClient) listByAPICreateRequest(ctx context.Context, resou func (client *APISchemaClient) listByAPIHandleResponse(resp *http.Response) (APISchemaListByAPIResponse, error) { result := APISchemaListByAPIResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SchemaCollection); err != nil { - return APISchemaListByAPIResponse{}, err + return APISchemaListByAPIResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apitagdescription_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apitagdescription_client.go index d06e3c6d0c5b..3ea633963362 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apitagdescription_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apitagdescription_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // APITagDescriptionClient contains the methods for the APITagDescription group. @@ -31,8 +32,15 @@ type APITagDescriptionClient struct { } // NewAPITagDescriptionClient creates a new instance of APITagDescriptionClient with the specified values. -func NewAPITagDescriptionClient(con *arm.Connection, subscriptionID string) *APITagDescriptionClient { - return &APITagDescriptionClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAPITagDescriptionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *APITagDescriptionClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APITagDescriptionClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create/Update tag description in scope of the Api. @@ -80,7 +88,7 @@ func (client *APITagDescriptionClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -96,7 +104,7 @@ func (client *APITagDescriptionClient) createOrUpdateHandleResponse(resp *http.R result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.TagDescriptionContract); err != nil { - return APITagDescriptionCreateOrUpdateResponse{}, err + return APITagDescriptionCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -159,7 +167,7 @@ func (client *APITagDescriptionClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -224,7 +232,7 @@ func (client *APITagDescriptionClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -237,7 +245,7 @@ func (client *APITagDescriptionClient) getHandleResponse(resp *http.Response) (A result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.TagDescriptionContract); err != nil { - return APITagDescriptionGetResponse{}, err + return APITagDescriptionGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -297,7 +305,7 @@ func (client *APITagDescriptionClient) getEntityTagCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -363,7 +371,7 @@ func (client *APITagDescriptionClient) listByServiceCreateRequest(ctx context.Co if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -373,7 +381,7 @@ func (client *APITagDescriptionClient) listByServiceCreateRequest(ctx context.Co func (client *APITagDescriptionClient) listByServiceHandleResponse(resp *http.Response) (APITagDescriptionListByServiceResponse, error) { result := APITagDescriptionListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TagDescriptionCollection); err != nil { - return APITagDescriptionListByServiceResponse{}, err + return APITagDescriptionListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiversionset_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiversionset_client.go index ed9de9a5a76d..d378835d5302 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiversionset_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_apiversionset_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // APIVersionSetClient contains the methods for the APIVersionSet group. @@ -31,8 +32,15 @@ type APIVersionSetClient struct { } // NewAPIVersionSetClient creates a new instance of APIVersionSetClient with the specified values. -func NewAPIVersionSetClient(con *arm.Connection, subscriptionID string) *APIVersionSetClient { - return &APIVersionSetClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAPIVersionSetClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *APIVersionSetClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &APIVersionSetClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or Updates a Api Version Set. @@ -76,7 +84,7 @@ func (client *APIVersionSetClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -92,7 +100,7 @@ func (client *APIVersionSetClient) createOrUpdateHandleResponse(resp *http.Respo result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.APIVersionSetContract); err != nil { - return APIVersionSetCreateOrUpdateResponse{}, err + return APIVersionSetCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -151,7 +159,7 @@ func (client *APIVersionSetClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -212,7 +220,7 @@ func (client *APIVersionSetClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -225,7 +233,7 @@ func (client *APIVersionSetClient) getHandleResponse(resp *http.Response) (APIVe result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.APIVersionSetContract); err != nil { - return APIVersionSetGetResponse{}, err + return APIVersionSetGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -281,7 +289,7 @@ func (client *APIVersionSetClient) getEntityTagCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -342,7 +350,7 @@ func (client *APIVersionSetClient) listByServiceCreateRequest(ctx context.Contex if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -352,7 +360,7 @@ func (client *APIVersionSetClient) listByServiceCreateRequest(ctx context.Contex func (client *APIVersionSetClient) listByServiceHandleResponse(resp *http.Response) (APIVersionSetListByServiceResponse, error) { result := APIVersionSetListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIVersionSetCollection); err != nil { - return APIVersionSetListByServiceResponse{}, err + return APIVersionSetListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -411,7 +419,7 @@ func (client *APIVersionSetClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -425,7 +433,7 @@ func (client *APIVersionSetClient) updateHandleResponse(resp *http.Response) (AP result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.APIVersionSetContract); err != nil { - return APIVersionSetUpdateResponse{}, err + return APIVersionSetUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_authorizationserver_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_authorizationserver_client.go index 143dafc3f35d..27c60b049fa6 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_authorizationserver_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_authorizationserver_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // AuthorizationServerClient contains the methods for the AuthorizationServer group. @@ -31,8 +32,15 @@ type AuthorizationServerClient struct { } // NewAuthorizationServerClient creates a new instance of AuthorizationServerClient with the specified values. -func NewAuthorizationServerClient(con *arm.Connection, subscriptionID string) *AuthorizationServerClient { - return &AuthorizationServerClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAuthorizationServerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AuthorizationServerClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AuthorizationServerClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates new authorization server or updates an existing authorization server. @@ -76,7 +84,7 @@ func (client *AuthorizationServerClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -92,7 +100,7 @@ func (client *AuthorizationServerClient) createOrUpdateHandleResponse(resp *http result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationServerContract); err != nil { - return AuthorizationServerCreateOrUpdateResponse{}, err + return AuthorizationServerCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -151,7 +159,7 @@ func (client *AuthorizationServerClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -212,7 +220,7 @@ func (client *AuthorizationServerClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -225,7 +233,7 @@ func (client *AuthorizationServerClient) getHandleResponse(resp *http.Response) result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationServerContract); err != nil { - return AuthorizationServerGetResponse{}, err + return AuthorizationServerGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -281,7 +289,7 @@ func (client *AuthorizationServerClient) getEntityTagCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -342,7 +350,7 @@ func (client *AuthorizationServerClient) listByServiceCreateRequest(ctx context. if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -352,7 +360,7 @@ func (client *AuthorizationServerClient) listByServiceCreateRequest(ctx context. func (client *AuthorizationServerClient) listByServiceHandleResponse(resp *http.Response) (AuthorizationServerListByServiceResponse, error) { result := AuthorizationServerListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationServerCollection); err != nil { - return AuthorizationServerListByServiceResponse{}, err + return AuthorizationServerListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -411,7 +419,7 @@ func (client *AuthorizationServerClient) listSecretsCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -424,7 +432,7 @@ func (client *AuthorizationServerClient) listSecretsHandleResponse(resp *http.Re result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationServerSecretsContract); err != nil { - return AuthorizationServerListSecretsResponse{}, err + return AuthorizationServerListSecretsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -483,7 +491,7 @@ func (client *AuthorizationServerClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -497,7 +505,7 @@ func (client *AuthorizationServerClient) updateHandleResponse(resp *http.Respons result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationServerContract); err != nil { - return AuthorizationServerUpdateResponse{}, err + return AuthorizationServerUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_backend_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_backend_client.go index eb75922ad188..1fa189abbeed 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_backend_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_backend_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // BackendClient contains the methods for the Backend group. @@ -31,8 +32,15 @@ type BackendClient struct { } // NewBackendClient creates a new instance of BackendClient with the specified values. -func NewBackendClient(con *arm.Connection, subscriptionID string) *BackendClient { - return &BackendClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewBackendClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *BackendClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &BackendClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or Updates a backend. @@ -76,7 +84,7 @@ func (client *BackendClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -92,7 +100,7 @@ func (client *BackendClient) createOrUpdateHandleResponse(resp *http.Response) ( result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.BackendContract); err != nil { - return BackendCreateOrUpdateResponse{}, err + return BackendCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -151,7 +159,7 @@ func (client *BackendClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -212,7 +220,7 @@ func (client *BackendClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -225,7 +233,7 @@ func (client *BackendClient) getHandleResponse(resp *http.Response) (BackendGetR result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.BackendContract); err != nil { - return BackendGetResponse{}, err + return BackendGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -281,7 +289,7 @@ func (client *BackendClient) getEntityTagCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -342,7 +350,7 @@ func (client *BackendClient) listByServiceCreateRequest(ctx context.Context, res if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -352,7 +360,7 @@ func (client *BackendClient) listByServiceCreateRequest(ctx context.Context, res func (client *BackendClient) listByServiceHandleResponse(resp *http.Response) (BackendListByServiceResponse, error) { result := BackendListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BackendCollection); err != nil { - return BackendListByServiceResponse{}, err + return BackendListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -412,7 +420,7 @@ func (client *BackendClient) reconnectCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Parameters != nil { @@ -475,7 +483,7 @@ func (client *BackendClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -489,7 +497,7 @@ func (client *BackendClient) updateHandleResponse(resp *http.Response) (BackendU result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.BackendContract); err != nil { - return BackendUpdateResponse{}, err + return BackendUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_cache_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_cache_client.go index b6fa46af6920..bfdd79635ec5 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_cache_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_cache_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // CacheClient contains the methods for the Cache group. @@ -31,8 +32,15 @@ type CacheClient struct { } // NewCacheClient creates a new instance of CacheClient with the specified values. -func NewCacheClient(con *arm.Connection, subscriptionID string) *CacheClient { - return &CacheClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCacheClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CacheClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CacheClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates an External Cache to be used in Api Management instance. @@ -76,7 +84,7 @@ func (client *CacheClient) createOrUpdateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -92,7 +100,7 @@ func (client *CacheClient) createOrUpdateHandleResponse(resp *http.Response) (Ca result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.CacheContract); err != nil { - return CacheCreateOrUpdateResponse{}, err + return CacheCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -151,7 +159,7 @@ func (client *CacheClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -212,7 +220,7 @@ func (client *CacheClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -225,7 +233,7 @@ func (client *CacheClient) getHandleResponse(resp *http.Response) (CacheGetRespo result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.CacheContract); err != nil { - return CacheGetResponse{}, err + return CacheGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -281,7 +289,7 @@ func (client *CacheClient) getEntityTagCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -339,7 +347,7 @@ func (client *CacheClient) listByServiceCreateRequest(ctx context.Context, resou if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -349,7 +357,7 @@ func (client *CacheClient) listByServiceCreateRequest(ctx context.Context, resou func (client *CacheClient) listByServiceHandleResponse(resp *http.Response) (CacheListByServiceResponse, error) { result := CacheListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CacheCollection); err != nil { - return CacheListByServiceResponse{}, err + return CacheListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -408,7 +416,7 @@ func (client *CacheClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -422,7 +430,7 @@ func (client *CacheClient) updateHandleResponse(resp *http.Response) (CacheUpdat result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.CacheContract); err != nil { - return CacheUpdateResponse{}, err + return CacheUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_certificate_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_certificate_client.go index 9fe2500c6aac..e6a8aec64c7b 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_certificate_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_certificate_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // CertificateClient contains the methods for the Certificate group. @@ -31,8 +32,15 @@ type CertificateClient struct { } // NewCertificateClient creates a new instance of CertificateClient with the specified values. -func NewCertificateClient(con *arm.Connection, subscriptionID string) *CertificateClient { - return &CertificateClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCertificateClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CertificateClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CertificateClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the certificate being used for authentication with the backend. @@ -76,7 +84,7 @@ func (client *CertificateClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -92,7 +100,7 @@ func (client *CertificateClient) createOrUpdateHandleResponse(resp *http.Respons result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.CertificateContract); err != nil { - return CertificateCreateOrUpdateResponse{}, err + return CertificateCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -151,7 +159,7 @@ func (client *CertificateClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -212,7 +220,7 @@ func (client *CertificateClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -225,7 +233,7 @@ func (client *CertificateClient) getHandleResponse(resp *http.Response) (Certifi result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.CertificateContract); err != nil { - return CertificateGetResponse{}, err + return CertificateGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -281,7 +289,7 @@ func (client *CertificateClient) getEntityTagCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -345,7 +353,7 @@ func (client *CertificateClient) listByServiceCreateRequest(ctx context.Context, if options != nil && options.IsKeyVaultRefreshFailed != nil { reqQP.Set("isKeyVaultRefreshFailed", strconv.FormatBool(*options.IsKeyVaultRefreshFailed)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -355,7 +363,7 @@ func (client *CertificateClient) listByServiceCreateRequest(ctx context.Context, func (client *CertificateClient) listByServiceHandleResponse(resp *http.Response) (CertificateListByServiceResponse, error) { result := CertificateListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CertificateCollection); err != nil { - return CertificateListByServiceResponse{}, err + return CertificateListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -414,7 +422,7 @@ func (client *CertificateClient) refreshSecretCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -427,7 +435,7 @@ func (client *CertificateClient) refreshSecretHandleResponse(resp *http.Response result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.CertificateContract); err != nil { - return CertificateRefreshSecretResponse{}, err + return CertificateRefreshSecretResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_constants.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_constants.go index 6322f56a6493..5a40ff497d66 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_constants.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_constants.go @@ -10,7 +10,7 @@ package armapimanagement const ( module = "armapimanagement" - version = "v0.1.0" + version = "v0.2.0" ) // APIManagementSKUCapacityScaleType - The scale type applicable to the sku. diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_contentitem_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_contentitem_client.go index 701fbf8c4c87..1c0633f95c35 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_contentitem_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_contentitem_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ContentItemClient contains the methods for the ContentItem group. @@ -30,8 +31,15 @@ type ContentItemClient struct { } // NewContentItemClient creates a new instance of ContentItemClient with the specified values. -func NewContentItemClient(con *arm.Connection, subscriptionID string) *ContentItemClient { - return &ContentItemClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewContentItemClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ContentItemClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ContentItemClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates a new developer portal's content item specified by the provided content type. @@ -79,7 +87,7 @@ func (client *ContentItemClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -95,7 +103,7 @@ func (client *ContentItemClient) createOrUpdateHandleResponse(resp *http.Respons result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ContentItemContract); err != nil { - return ContentItemCreateOrUpdateResponse{}, err + return ContentItemCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -158,7 +166,7 @@ func (client *ContentItemClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -223,7 +231,7 @@ func (client *ContentItemClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +244,7 @@ func (client *ContentItemClient) getHandleResponse(resp *http.Response) (Content result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ContentItemContract); err != nil { - return ContentItemGetResponse{}, err + return ContentItemGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -296,7 +304,7 @@ func (client *ContentItemClient) getEntityTagCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -352,7 +360,7 @@ func (client *ContentItemClient) listByServiceCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -362,7 +370,7 @@ func (client *ContentItemClient) listByServiceCreateRequest(ctx context.Context, func (client *ContentItemClient) listByServiceHandleResponse(resp *http.Response) (ContentItemListByServiceResponse, error) { result := ContentItemListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ContentItemCollection); err != nil { - return ContentItemListByServiceResponse{}, err + return ContentItemListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_contenttype_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_contenttype_client.go index 4d547d6c6d16..894c84a1d041 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_contenttype_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_contenttype_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ContentTypeClient contains the methods for the ContentType group. @@ -30,8 +31,15 @@ type ContentTypeClient struct { } // NewContentTypeClient creates a new instance of ContentTypeClient with the specified values. -func NewContentTypeClient(con *arm.Connection, subscriptionID string) *ContentTypeClient { - return &ContentTypeClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewContentTypeClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ContentTypeClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ContentTypeClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the developer portal's content type. Content types describe content items' properties, validation rules, and constraints. @@ -77,7 +85,7 @@ func (client *ContentTypeClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -93,7 +101,7 @@ func (client *ContentTypeClient) createOrUpdateHandleResponse(resp *http.Respons result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ContentTypeContract); err != nil { - return ContentTypeCreateOrUpdateResponse{}, err + return ContentTypeCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -154,7 +162,7 @@ func (client *ContentTypeClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -215,7 +223,7 @@ func (client *ContentTypeClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -228,7 +236,7 @@ func (client *ContentTypeClient) getHandleResponse(resp *http.Response) (Content result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ContentTypeContract); err != nil { - return ContentTypeGetResponse{}, err + return ContentTypeGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -280,7 +288,7 @@ func (client *ContentTypeClient) listByServiceCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -290,7 +298,7 @@ func (client *ContentTypeClient) listByServiceCreateRequest(ctx context.Context, func (client *ContentTypeClient) listByServiceHandleResponse(resp *http.Response) (ContentTypeListByServiceResponse, error) { result := ContentTypeListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ContentTypeCollection); err != nil { - return ContentTypeListByServiceResponse{}, err + return ContentTypeListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_delegationsettings_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_delegationsettings_client.go index 4f922117bee9..0d362783269a 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_delegationsettings_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_delegationsettings_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DelegationSettingsClient contains the methods for the DelegationSettings group. @@ -30,8 +31,15 @@ type DelegationSettingsClient struct { } // NewDelegationSettingsClient creates a new instance of DelegationSettingsClient with the specified values. -func NewDelegationSettingsClient(con *arm.Connection, subscriptionID string) *DelegationSettingsClient { - return &DelegationSettingsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDelegationSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DelegationSettingsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DelegationSettingsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or Update Delegation settings. @@ -71,7 +79,7 @@ func (client *DelegationSettingsClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -84,7 +92,7 @@ func (client *DelegationSettingsClient) createOrUpdateCreateRequest(ctx context. func (client *DelegationSettingsClient) createOrUpdateHandleResponse(resp *http.Response) (DelegationSettingsCreateOrUpdateResponse, error) { result := DelegationSettingsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PortalDelegationSettings); err != nil { - return DelegationSettingsCreateOrUpdateResponse{}, err + return DelegationSettingsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -139,7 +147,7 @@ func (client *DelegationSettingsClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -152,7 +160,7 @@ func (client *DelegationSettingsClient) getHandleResponse(resp *http.Response) ( result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.PortalDelegationSettings); err != nil { - return DelegationSettingsGetResponse{}, err + return DelegationSettingsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -204,7 +212,7 @@ func (client *DelegationSettingsClient) getEntityTagCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -259,7 +267,7 @@ func (client *DelegationSettingsClient) listSecretsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -269,7 +277,7 @@ func (client *DelegationSettingsClient) listSecretsCreateRequest(ctx context.Con func (client *DelegationSettingsClient) listSecretsHandleResponse(resp *http.Response) (DelegationSettingsListSecretsResponse, error) { result := DelegationSettingsListSecretsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PortalSettingValidationKeyContract); err != nil { - return DelegationSettingsListSecretsResponse{}, err + return DelegationSettingsListSecretsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -324,7 +332,7 @@ func (client *DelegationSettingsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_deletedservices_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_deletedservices_client.go index 7b08a4a65274..4cee3845cc34 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_deletedservices_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_deletedservices_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DeletedServicesClient contains the methods for the DeletedServices group. @@ -31,8 +31,15 @@ type DeletedServicesClient struct { } // NewDeletedServicesClient creates a new instance of DeletedServicesClient with the specified values. -func NewDeletedServicesClient(con *arm.Connection, subscriptionID string) *DeletedServicesClient { - return &DeletedServicesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDeletedServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DeletedServicesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DeletedServicesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetByName - Get soft-deleted Api Management Service by name. @@ -72,7 +79,7 @@ func (client *DeletedServicesClient) getByNameCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -82,7 +89,7 @@ func (client *DeletedServicesClient) getByNameCreateRequest(ctx context.Context, func (client *DeletedServicesClient) getByNameHandleResponse(resp *http.Response) (DeletedServicesGetByNameResponse, error) { result := DeletedServicesGetByNameResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeletedServiceContract); err != nil { - return DeletedServicesGetByNameResponse{}, err + return DeletedServicesGetByNameResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -126,7 +133,7 @@ func (client *DeletedServicesClient) listBySubscriptionCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -136,7 +143,7 @@ func (client *DeletedServicesClient) listBySubscriptionCreateRequest(ctx context func (client *DeletedServicesClient) listBySubscriptionHandleResponse(resp *http.Response) (DeletedServicesListBySubscriptionResponse, error) { result := DeletedServicesListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeletedServicesCollection); err != nil { - return DeletedServicesListBySubscriptionResponse{}, err + return DeletedServicesListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -211,7 +218,7 @@ func (client *DeletedServicesClient) purgeCreateRequest(ctx context.Context, ser return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_diagnostic_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_diagnostic_client.go index d5105012aea4..d9121a5b0265 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_diagnostic_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_diagnostic_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // DiagnosticClient contains the methods for the Diagnostic group. @@ -31,8 +32,15 @@ type DiagnosticClient struct { } // NewDiagnosticClient creates a new instance of DiagnosticClient with the specified values. -func NewDiagnosticClient(con *arm.Connection, subscriptionID string) *DiagnosticClient { - return &DiagnosticClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDiagnosticClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DiagnosticClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DiagnosticClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates a new Diagnostic or updates an existing one. @@ -76,7 +84,7 @@ func (client *DiagnosticClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -92,7 +100,7 @@ func (client *DiagnosticClient) createOrUpdateHandleResponse(resp *http.Response result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticContract); err != nil { - return DiagnosticCreateOrUpdateResponse{}, err + return DiagnosticCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -151,7 +159,7 @@ func (client *DiagnosticClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -212,7 +220,7 @@ func (client *DiagnosticClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -225,7 +233,7 @@ func (client *DiagnosticClient) getHandleResponse(resp *http.Response) (Diagnost result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticContract); err != nil { - return DiagnosticGetResponse{}, err + return DiagnosticGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -281,7 +289,7 @@ func (client *DiagnosticClient) getEntityTagCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -342,7 +350,7 @@ func (client *DiagnosticClient) listByServiceCreateRequest(ctx context.Context, if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -352,7 +360,7 @@ func (client *DiagnosticClient) listByServiceCreateRequest(ctx context.Context, func (client *DiagnosticClient) listByServiceHandleResponse(resp *http.Response) (DiagnosticListByServiceResponse, error) { result := DiagnosticListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticCollection); err != nil { - return DiagnosticListByServiceResponse{}, err + return DiagnosticListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -411,7 +419,7 @@ func (client *DiagnosticClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -425,7 +433,7 @@ func (client *DiagnosticClient) updateHandleResponse(resp *http.Response) (Diagn result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticContract); err != nil { - return DiagnosticUpdateResponse{}, err + return DiagnosticUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_emailtemplate_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_emailtemplate_client.go index cb313b8ea1dd..26fa640d18a4 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_emailtemplate_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_emailtemplate_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // EmailTemplateClient contains the methods for the EmailTemplate group. @@ -31,8 +32,15 @@ type EmailTemplateClient struct { } // NewEmailTemplateClient creates a new instance of EmailTemplateClient with the specified values. -func NewEmailTemplateClient(con *arm.Connection, subscriptionID string) *EmailTemplateClient { - return &EmailTemplateClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewEmailTemplateClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *EmailTemplateClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &EmailTemplateClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Updates an Email Template. @@ -76,7 +84,7 @@ func (client *EmailTemplateClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -89,7 +97,7 @@ func (client *EmailTemplateClient) createOrUpdateCreateRequest(ctx context.Conte func (client *EmailTemplateClient) createOrUpdateHandleResponse(resp *http.Response) (EmailTemplateCreateOrUpdateResponse, error) { result := EmailTemplateCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EmailTemplateContract); err != nil { - return EmailTemplateCreateOrUpdateResponse{}, err + return EmailTemplateCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -148,7 +156,7 @@ func (client *EmailTemplateClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -209,7 +217,7 @@ func (client *EmailTemplateClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -222,7 +230,7 @@ func (client *EmailTemplateClient) getHandleResponse(resp *http.Response) (Email result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.EmailTemplateContract); err != nil { - return EmailTemplateGetResponse{}, err + return EmailTemplateGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -278,7 +286,7 @@ func (client *EmailTemplateClient) getEntityTagCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -339,7 +347,7 @@ func (client *EmailTemplateClient) listByServiceCreateRequest(ctx context.Contex if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -349,7 +357,7 @@ func (client *EmailTemplateClient) listByServiceCreateRequest(ctx context.Contex func (client *EmailTemplateClient) listByServiceHandleResponse(resp *http.Response) (EmailTemplateListByServiceResponse, error) { result := EmailTemplateListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EmailTemplateCollection); err != nil { - return EmailTemplateListByServiceResponse{}, err + return EmailTemplateListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -408,7 +416,7 @@ func (client *EmailTemplateClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -422,7 +430,7 @@ func (client *EmailTemplateClient) updateHandleResponse(resp *http.Response) (Em result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.EmailTemplateContract); err != nil { - return EmailTemplateUpdateResponse{}, err + return EmailTemplateUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_gateway_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_gateway_client.go index 96c349ed1ce5..2ef206d68897 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_gateway_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_gateway_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // GatewayClient contains the methods for the Gateway group. @@ -31,8 +32,15 @@ type GatewayClient struct { } // NewGatewayClient creates a new instance of GatewayClient with the specified values. -func NewGatewayClient(con *arm.Connection, subscriptionID string) *GatewayClient { - return &GatewayClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewGatewayClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *GatewayClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &GatewayClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a Gateway to be used in Api Management instance. @@ -76,7 +84,7 @@ func (client *GatewayClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -92,7 +100,7 @@ func (client *GatewayClient) createOrUpdateHandleResponse(resp *http.Response) ( result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.GatewayContract); err != nil { - return GatewayCreateOrUpdateResponse{}, err + return GatewayCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -151,7 +159,7 @@ func (client *GatewayClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -212,7 +220,7 @@ func (client *GatewayClient) generateTokenCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -222,7 +230,7 @@ func (client *GatewayClient) generateTokenCreateRequest(ctx context.Context, res func (client *GatewayClient) generateTokenHandleResponse(resp *http.Response) (GatewayGenerateTokenResponse, error) { result := GatewayGenerateTokenResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GatewayTokenContract); err != nil { - return GatewayGenerateTokenResponse{}, err + return GatewayGenerateTokenResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -281,7 +289,7 @@ func (client *GatewayClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -294,7 +302,7 @@ func (client *GatewayClient) getHandleResponse(resp *http.Response) (GatewayGetR result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.GatewayContract); err != nil { - return GatewayGetResponse{}, err + return GatewayGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -350,7 +358,7 @@ func (client *GatewayClient) getEntityTagCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -411,7 +419,7 @@ func (client *GatewayClient) listByServiceCreateRequest(ctx context.Context, res if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -421,7 +429,7 @@ func (client *GatewayClient) listByServiceCreateRequest(ctx context.Context, res func (client *GatewayClient) listByServiceHandleResponse(resp *http.Response) (GatewayListByServiceResponse, error) { result := GatewayListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GatewayCollection); err != nil { - return GatewayListByServiceResponse{}, err + return GatewayListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -480,7 +488,7 @@ func (client *GatewayClient) listKeysCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -493,7 +501,7 @@ func (client *GatewayClient) listKeysHandleResponse(resp *http.Response) (Gatewa result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.GatewayKeysContract); err != nil { - return GatewayListKeysResponse{}, err + return GatewayListKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -552,7 +560,7 @@ func (client *GatewayClient) regenerateKeyCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -612,7 +620,7 @@ func (client *GatewayClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -626,7 +634,7 @@ func (client *GatewayClient) updateHandleResponse(resp *http.Response) (GatewayU result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.GatewayContract); err != nil { - return GatewayUpdateResponse{}, err + return GatewayUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_gatewayapi_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_gatewayapi_client.go index 1d0664ab71b4..a59f8952cdd7 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_gatewayapi_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_gatewayapi_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // GatewayAPIClient contains the methods for the GatewayAPI group. @@ -31,8 +32,15 @@ type GatewayAPIClient struct { } // NewGatewayAPIClient creates a new instance of GatewayAPIClient with the specified values. -func NewGatewayAPIClient(con *arm.Connection, subscriptionID string) *GatewayAPIClient { - return &GatewayAPIClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewGatewayAPIClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *GatewayAPIClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &GatewayAPIClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Adds an API to the specified Gateway. @@ -80,7 +88,7 @@ func (client *GatewayAPIClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Parameters != nil { @@ -93,7 +101,7 @@ func (client *GatewayAPIClient) createOrUpdateCreateRequest(ctx context.Context, func (client *GatewayAPIClient) createOrUpdateHandleResponse(resp *http.Response) (GatewayAPICreateOrUpdateResponse, error) { result := GatewayAPICreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIContract); err != nil { - return GatewayAPICreateOrUpdateResponse{}, err + return GatewayAPICreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -156,7 +164,7 @@ func (client *GatewayAPIClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -217,7 +225,7 @@ func (client *GatewayAPIClient) getEntityTagCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -282,7 +290,7 @@ func (client *GatewayAPIClient) listByServiceCreateRequest(ctx context.Context, if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -292,7 +300,7 @@ func (client *GatewayAPIClient) listByServiceCreateRequest(ctx context.Context, func (client *GatewayAPIClient) listByServiceHandleResponse(resp *http.Response) (GatewayAPIListByServiceResponse, error) { result := GatewayAPIListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APICollection); err != nil { - return GatewayAPIListByServiceResponse{}, err + return GatewayAPIListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_gatewaycertificateauthority_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_gatewaycertificateauthority_client.go index 8b14075718d5..f590f8163c38 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_gatewaycertificateauthority_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_gatewaycertificateauthority_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // GatewayCertificateAuthorityClient contains the methods for the GatewayCertificateAuthority group. @@ -31,8 +32,15 @@ type GatewayCertificateAuthorityClient struct { } // NewGatewayCertificateAuthorityClient creates a new instance of GatewayCertificateAuthorityClient with the specified values. -func NewGatewayCertificateAuthorityClient(con *arm.Connection, subscriptionID string) *GatewayCertificateAuthorityClient { - return &GatewayCertificateAuthorityClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewGatewayCertificateAuthorityClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *GatewayCertificateAuthorityClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &GatewayCertificateAuthorityClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Assign Certificate entity to Gateway entity as Certificate Authority. @@ -80,7 +88,7 @@ func (client *GatewayCertificateAuthorityClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -96,7 +104,7 @@ func (client *GatewayCertificateAuthorityClient) createOrUpdateHandleResponse(re result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.GatewayCertificateAuthorityContract); err != nil { - return GatewayCertificateAuthorityCreateOrUpdateResponse{}, err + return GatewayCertificateAuthorityCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -159,7 +167,7 @@ func (client *GatewayCertificateAuthorityClient) deleteCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -224,7 +232,7 @@ func (client *GatewayCertificateAuthorityClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -237,7 +245,7 @@ func (client *GatewayCertificateAuthorityClient) getHandleResponse(resp *http.Re result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.GatewayCertificateAuthorityContract); err != nil { - return GatewayCertificateAuthorityGetResponse{}, err + return GatewayCertificateAuthorityGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -297,7 +305,7 @@ func (client *GatewayCertificateAuthorityClient) getEntityTagCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -362,7 +370,7 @@ func (client *GatewayCertificateAuthorityClient) listByServiceCreateRequest(ctx if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -372,7 +380,7 @@ func (client *GatewayCertificateAuthorityClient) listByServiceCreateRequest(ctx func (client *GatewayCertificateAuthorityClient) listByServiceHandleResponse(resp *http.Response) (GatewayCertificateAuthorityListByServiceResponse, error) { result := GatewayCertificateAuthorityListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GatewayCertificateAuthorityCollection); err != nil { - return GatewayCertificateAuthorityListByServiceResponse{}, err + return GatewayCertificateAuthorityListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_gatewayhostnameconfiguration_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_gatewayhostnameconfiguration_client.go index 8ab2c4940bf7..f5ef2e2bd7cd 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_gatewayhostnameconfiguration_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_gatewayhostnameconfiguration_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // GatewayHostnameConfigurationClient contains the methods for the GatewayHostnameConfiguration group. @@ -31,8 +32,15 @@ type GatewayHostnameConfigurationClient struct { } // NewGatewayHostnameConfigurationClient creates a new instance of GatewayHostnameConfigurationClient with the specified values. -func NewGatewayHostnameConfigurationClient(con *arm.Connection, subscriptionID string) *GatewayHostnameConfigurationClient { - return &GatewayHostnameConfigurationClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewGatewayHostnameConfigurationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *GatewayHostnameConfigurationClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &GatewayHostnameConfigurationClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates of updates hostname configuration for a Gateway. @@ -80,7 +88,7 @@ func (client *GatewayHostnameConfigurationClient) createOrUpdateCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -96,7 +104,7 @@ func (client *GatewayHostnameConfigurationClient) createOrUpdateHandleResponse(r result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.GatewayHostnameConfigurationContract); err != nil { - return GatewayHostnameConfigurationCreateOrUpdateResponse{}, err + return GatewayHostnameConfigurationCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -159,7 +167,7 @@ func (client *GatewayHostnameConfigurationClient) deleteCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -224,7 +232,7 @@ func (client *GatewayHostnameConfigurationClient) getCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -237,7 +245,7 @@ func (client *GatewayHostnameConfigurationClient) getHandleResponse(resp *http.R result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.GatewayHostnameConfigurationContract); err != nil { - return GatewayHostnameConfigurationGetResponse{}, err + return GatewayHostnameConfigurationGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -297,7 +305,7 @@ func (client *GatewayHostnameConfigurationClient) getEntityTagCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -362,7 +370,7 @@ func (client *GatewayHostnameConfigurationClient) listByServiceCreateRequest(ctx if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -372,7 +380,7 @@ func (client *GatewayHostnameConfigurationClient) listByServiceCreateRequest(ctx func (client *GatewayHostnameConfigurationClient) listByServiceHandleResponse(resp *http.Response) (GatewayHostnameConfigurationListByServiceResponse, error) { result := GatewayHostnameConfigurationListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GatewayHostnameConfigurationCollection); err != nil { - return GatewayHostnameConfigurationListByServiceResponse{}, err + return GatewayHostnameConfigurationListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_group_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_group_client.go index 1c916cb88a69..a8353291c4e8 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_group_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_group_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // GroupClient contains the methods for the Group group. @@ -31,8 +32,15 @@ type GroupClient struct { } // NewGroupClient creates a new instance of GroupClient with the specified values. -func NewGroupClient(con *arm.Connection, subscriptionID string) *GroupClient { - return &GroupClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewGroupClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *GroupClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &GroupClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or Updates a group. @@ -76,7 +84,7 @@ func (client *GroupClient) createOrUpdateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -92,7 +100,7 @@ func (client *GroupClient) createOrUpdateHandleResponse(resp *http.Response) (Gr result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.GroupContract); err != nil { - return GroupCreateOrUpdateResponse{}, err + return GroupCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -151,7 +159,7 @@ func (client *GroupClient) deleteCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -212,7 +220,7 @@ func (client *GroupClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -225,7 +233,7 @@ func (client *GroupClient) getHandleResponse(resp *http.Response) (GroupGetRespo result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.GroupContract); err != nil { - return GroupGetResponse{}, err + return GroupGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -281,7 +289,7 @@ func (client *GroupClient) getEntityTagCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -342,7 +350,7 @@ func (client *GroupClient) listByServiceCreateRequest(ctx context.Context, resou if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -352,7 +360,7 @@ func (client *GroupClient) listByServiceCreateRequest(ctx context.Context, resou func (client *GroupClient) listByServiceHandleResponse(resp *http.Response) (GroupListByServiceResponse, error) { result := GroupListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GroupCollection); err != nil { - return GroupListByServiceResponse{}, err + return GroupListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -411,7 +419,7 @@ func (client *GroupClient) updateCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -425,7 +433,7 @@ func (client *GroupClient) updateHandleResponse(resp *http.Response) (GroupUpdat result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.GroupContract); err != nil { - return GroupUpdateResponse{}, err + return GroupUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_groupuser_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_groupuser_client.go index 4d1759068bea..269488659cc1 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_groupuser_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_groupuser_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // GroupUserClient contains the methods for the GroupUser group. @@ -31,8 +32,15 @@ type GroupUserClient struct { } // NewGroupUserClient creates a new instance of GroupUserClient with the specified values. -func NewGroupUserClient(con *arm.Connection, subscriptionID string) *GroupUserClient { - return &GroupUserClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewGroupUserClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *GroupUserClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &GroupUserClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckEntityExists - Checks that user entity specified by identifier is associated with the group entity. @@ -81,7 +89,7 @@ func (client *GroupUserClient) checkEntityExistsCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -132,7 +140,7 @@ func (client *GroupUserClient) createCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -142,7 +150,7 @@ func (client *GroupUserClient) createCreateRequest(ctx context.Context, resource func (client *GroupUserClient) createHandleResponse(resp *http.Response) (GroupUserCreateResponse, error) { result := GroupUserCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UserContract); err != nil { - return GroupUserCreateResponse{}, err + return GroupUserCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -205,7 +213,7 @@ func (client *GroupUserClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -271,7 +279,7 @@ func (client *GroupUserClient) listCreateRequest(ctx context.Context, resourceGr if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -281,7 +289,7 @@ func (client *GroupUserClient) listCreateRequest(ctx context.Context, resourceGr func (client *GroupUserClient) listHandleResponse(resp *http.Response) (GroupUserListResponse, error) { result := GroupUserListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UserCollection); err != nil { - return GroupUserListResponse{}, err + return GroupUserListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_identityprovider_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_identityprovider_client.go index 319bdec38a78..dacac80db559 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_identityprovider_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_identityprovider_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // IdentityProviderClient contains the methods for the IdentityProvider group. @@ -30,8 +31,15 @@ type IdentityProviderClient struct { } // NewIdentityProviderClient creates a new instance of IdentityProviderClient with the specified values. -func NewIdentityProviderClient(con *arm.Connection, subscriptionID string) *IdentityProviderClient { - return &IdentityProviderClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIdentityProviderClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IdentityProviderClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IdentityProviderClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or Updates the IdentityProvider configuration. @@ -75,7 +83,7 @@ func (client *IdentityProviderClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -91,7 +99,7 @@ func (client *IdentityProviderClient) createOrUpdateHandleResponse(resp *http.Re result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.IdentityProviderContract); err != nil { - return IdentityProviderCreateOrUpdateResponse{}, err + return IdentityProviderCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -150,7 +158,7 @@ func (client *IdentityProviderClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -211,7 +219,7 @@ func (client *IdentityProviderClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +232,7 @@ func (client *IdentityProviderClient) getHandleResponse(resp *http.Response) (Id result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.IdentityProviderContract); err != nil { - return IdentityProviderGetResponse{}, err + return IdentityProviderGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -280,7 +288,7 @@ func (client *IdentityProviderClient) getEntityTagCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -332,7 +340,7 @@ func (client *IdentityProviderClient) listByServiceCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -342,7 +350,7 @@ func (client *IdentityProviderClient) listByServiceCreateRequest(ctx context.Con func (client *IdentityProviderClient) listByServiceHandleResponse(resp *http.Response) (IdentityProviderListByServiceResponse, error) { result := IdentityProviderListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IdentityProviderList); err != nil { - return IdentityProviderListByServiceResponse{}, err + return IdentityProviderListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -401,7 +409,7 @@ func (client *IdentityProviderClient) listSecretsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -414,7 +422,7 @@ func (client *IdentityProviderClient) listSecretsHandleResponse(resp *http.Respo result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ClientSecretContract); err != nil { - return IdentityProviderListSecretsResponse{}, err + return IdentityProviderListSecretsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -473,7 +481,7 @@ func (client *IdentityProviderClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -487,7 +495,7 @@ func (client *IdentityProviderClient) updateHandleResponse(resp *http.Response) result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.IdentityProviderContract); err != nil { - return IdentityProviderUpdateResponse{}, err + return IdentityProviderUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_issue_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_issue_client.go index c969a83aee87..5267ba7aea82 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_issue_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_issue_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // IssueClient contains the methods for the Issue group. @@ -31,8 +32,15 @@ type IssueClient struct { } // NewIssueClient creates a new instance of IssueClient with the specified values. -func NewIssueClient(con *arm.Connection, subscriptionID string) *IssueClient { - return &IssueClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIssueClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IssueClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IssueClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets API Management issue details @@ -76,7 +84,7 @@ func (client *IssueClient) getCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -89,7 +97,7 @@ func (client *IssueClient) getHandleResponse(resp *http.Response) (IssueGetRespo result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.IssueContract); err != nil { - return IssueGetResponse{}, err + return IssueGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -150,7 +158,7 @@ func (client *IssueClient) listByServiceCreateRequest(ctx context.Context, resou if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -160,7 +168,7 @@ func (client *IssueClient) listByServiceCreateRequest(ctx context.Context, resou func (client *IssueClient) listByServiceHandleResponse(resp *http.Response) (IssueListByServiceResponse, error) { result := IssueListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IssueCollection); err != nil { - return IssueListByServiceResponse{}, err + return IssueListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_logger_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_logger_client.go index 97e75bd84011..89b0613cb2ff 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_logger_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_logger_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // LoggerClient contains the methods for the Logger group. @@ -31,8 +32,15 @@ type LoggerClient struct { } // NewLoggerClient creates a new instance of LoggerClient with the specified values. -func NewLoggerClient(con *arm.Connection, subscriptionID string) *LoggerClient { - return &LoggerClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLoggerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LoggerClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LoggerClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or Updates a logger. @@ -76,7 +84,7 @@ func (client *LoggerClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -92,7 +100,7 @@ func (client *LoggerClient) createOrUpdateHandleResponse(resp *http.Response) (L result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.LoggerContract); err != nil { - return LoggerCreateOrUpdateResponse{}, err + return LoggerCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -151,7 +159,7 @@ func (client *LoggerClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -212,7 +220,7 @@ func (client *LoggerClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -225,7 +233,7 @@ func (client *LoggerClient) getHandleResponse(resp *http.Response) (LoggerGetRes result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.LoggerContract); err != nil { - return LoggerGetResponse{}, err + return LoggerGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -281,7 +289,7 @@ func (client *LoggerClient) getEntityTagCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -342,7 +350,7 @@ func (client *LoggerClient) listByServiceCreateRequest(ctx context.Context, reso if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -352,7 +360,7 @@ func (client *LoggerClient) listByServiceCreateRequest(ctx context.Context, reso func (client *LoggerClient) listByServiceHandleResponse(resp *http.Response) (LoggerListByServiceResponse, error) { result := LoggerListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LoggerCollection); err != nil { - return LoggerListByServiceResponse{}, err + return LoggerListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -411,7 +419,7 @@ func (client *LoggerClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -425,7 +433,7 @@ func (client *LoggerClient) updateHandleResponse(resp *http.Response) (LoggerUpd result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.LoggerContract); err != nil { - return LoggerUpdateResponse{}, err + return LoggerUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_models.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_models.go index 9d0e4fd24f93..7ae61c6fb16c 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_models.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_models.go @@ -10,10 +10,9 @@ package armapimanagement import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // APIBeginCreateOrUpdateOptions contains the optional parameters for the API.BeginCreateOrUpdate method. @@ -855,7 +854,7 @@ func (a APIManagementServiceBaseProperties) marshalInternal(objectMap map[string populate(objectMap, "apiVersionConstraint", a.APIVersionConstraint) populate(objectMap, "additionalLocations", a.AdditionalLocations) populate(objectMap, "certificates", a.Certificates) - populate(objectMap, "createdAtUtc", (*timeRFC3339)(a.CreatedAtUTC)) + populateTimeRFC3339(objectMap, "createdAtUtc", a.CreatedAtUTC) populate(objectMap, "customProperties", a.CustomProperties) populate(objectMap, "developerPortalUrl", a.DeveloperPortalURL) populate(objectMap, "disableGateway", a.DisableGateway) @@ -894,9 +893,7 @@ func (a *APIManagementServiceBaseProperties) unmarshalInternal(rawMsg map[string err = unpopulate(val, &a.Certificates) delete(rawMsg, key) case "createdAtUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.CreatedAtUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.CreatedAtUTC) delete(rawMsg, key) case "customProperties": err = unpopulate(val, &a.CustomProperties) @@ -1450,9 +1447,9 @@ type APIReleaseContractProperties struct { func (a APIReleaseContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "apiId", a.APIID) - populate(objectMap, "createdDateTime", (*timeRFC3339)(a.CreatedDateTime)) + populateTimeRFC3339(objectMap, "createdDateTime", a.CreatedDateTime) populate(objectMap, "notes", a.Notes) - populate(objectMap, "updatedDateTime", (*timeRFC3339)(a.UpdatedDateTime)) + populateTimeRFC3339(objectMap, "updatedDateTime", a.UpdatedDateTime) return json.Marshal(objectMap) } @@ -1469,17 +1466,13 @@ func (a *APIReleaseContractProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.APIID) delete(rawMsg, key) case "createdDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.CreatedDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.CreatedDateTime) delete(rawMsg, key) case "notes": err = unpopulate(val, &a.Notes) delete(rawMsg, key) case "updatedDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.UpdatedDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.UpdatedDateTime) delete(rawMsg, key) } if err != nil { @@ -1579,12 +1572,12 @@ func (a APIRevisionContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "apiId", a.APIID) populate(objectMap, "apiRevision", a.APIRevision) - populate(objectMap, "createdDateTime", (*timeRFC3339)(a.CreatedDateTime)) + populateTimeRFC3339(objectMap, "createdDateTime", a.CreatedDateTime) populate(objectMap, "description", a.Description) populate(objectMap, "isCurrent", a.IsCurrent) populate(objectMap, "isOnline", a.IsOnline) populate(objectMap, "privateUrl", a.PrivateURL) - populate(objectMap, "updatedDateTime", (*timeRFC3339)(a.UpdatedDateTime)) + populateTimeRFC3339(objectMap, "updatedDateTime", a.UpdatedDateTime) return json.Marshal(objectMap) } @@ -1604,9 +1597,7 @@ func (a *APIRevisionContract) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.APIRevision) delete(rawMsg, key) case "createdDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.CreatedDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.CreatedDateTime) delete(rawMsg, key) case "description": err = unpopulate(val, &a.Description) @@ -1621,9 +1612,7 @@ func (a *APIRevisionContract) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.PrivateURL) delete(rawMsg, key) case "updatedDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.UpdatedDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.UpdatedDateTime) delete(rawMsg, key) } if err != nil { @@ -2826,7 +2815,7 @@ type CertificateContractProperties struct { // MarshalJSON implements the json.Marshaller interface for type CertificateContractProperties. func (c CertificateContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "expirationDate", (*timeRFC3339)(c.ExpirationDate)) + populateTimeRFC3339(objectMap, "expirationDate", c.ExpirationDate) populate(objectMap, "keyVault", c.KeyVault) populate(objectMap, "subject", c.Subject) populate(objectMap, "thumbprint", c.Thumbprint) @@ -2843,9 +2832,7 @@ func (c *CertificateContractProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "expirationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.ExpirationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.ExpirationDate) delete(rawMsg, key) case "keyVault": err = unpopulate(val, &c.KeyVault) @@ -2918,7 +2905,7 @@ type CertificateInformation struct { // MarshalJSON implements the json.Marshaller interface for type CertificateInformation. func (c CertificateInformation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "expiry", (*timeRFC3339)(c.Expiry)) + populateTimeRFC3339(objectMap, "expiry", c.Expiry) populate(objectMap, "subject", c.Subject) populate(objectMap, "thumbprint", c.Thumbprint) return json.Marshal(objectMap) @@ -2934,9 +2921,7 @@ func (c *CertificateInformation) UnmarshalJSON(data []byte) error { var err error switch key { case "expiry": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.Expiry = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.Expiry) delete(rawMsg, key) case "subject": err = unpopulate(val, &c.Subject) @@ -3172,8 +3157,8 @@ func (c ConnectivityStatusContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "error", c.Error) populate(objectMap, "isOptional", c.IsOptional) - populate(objectMap, "lastStatusChange", (*timeRFC3339)(c.LastStatusChange)) - populate(objectMap, "lastUpdated", (*timeRFC3339)(c.LastUpdated)) + populateTimeRFC3339(objectMap, "lastStatusChange", c.LastStatusChange) + populateTimeRFC3339(objectMap, "lastUpdated", c.LastUpdated) populate(objectMap, "name", c.Name) populate(objectMap, "resourceType", c.ResourceType) populate(objectMap, "status", c.Status) @@ -3196,14 +3181,10 @@ func (c *ConnectivityStatusContract) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.IsOptional) delete(rawMsg, key) case "lastStatusChange": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.LastStatusChange = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.LastStatusChange) delete(rawMsg, key) case "lastUpdated": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.LastUpdated = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.LastUpdated) delete(rawMsg, key) case "name": err = unpopulate(val, &c.Name) @@ -3434,8 +3415,8 @@ type DeletedServiceContractProperties struct { // MarshalJSON implements the json.Marshaller interface for type DeletedServiceContractProperties. func (d DeletedServiceContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "deletionDate", (*timeRFC3339)(d.DeletionDate)) - populate(objectMap, "scheduledPurgeDate", (*timeRFC3339)(d.ScheduledPurgeDate)) + populateTimeRFC3339(objectMap, "deletionDate", d.DeletionDate) + populateTimeRFC3339(objectMap, "scheduledPurgeDate", d.ScheduledPurgeDate) populate(objectMap, "serviceId", d.ServiceID) return json.Marshal(objectMap) } @@ -3450,14 +3431,10 @@ func (d *DeletedServiceContractProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "deletionDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.DeletionDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.DeletionDate) delete(rawMsg, key) case "scheduledPurgeDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.ScheduledPurgeDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.ScheduledPurgeDate) delete(rawMsg, key) case "serviceId": err = unpopulate(val, &d.ServiceID) @@ -4162,7 +4139,7 @@ type GatewayTokenRequestContract struct { // MarshalJSON implements the json.Marshaller interface for type GatewayTokenRequestContract. func (g GatewayTokenRequestContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "expiry", (*timeRFC3339)(g.Expiry)) + populateTimeRFC3339(objectMap, "expiry", g.Expiry) populate(objectMap, "keyType", g.KeyType) return json.Marshal(objectMap) } @@ -4177,9 +4154,7 @@ func (g *GatewayTokenRequestContract) UnmarshalJSON(data []byte) error { var err error switch key { case "expiry": - var aux timeRFC3339 - err = unpopulate(val, &aux) - g.Expiry = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &g.Expiry) delete(rawMsg, key) case "keyType": err = unpopulate(val, &g.KeyType) @@ -4780,7 +4755,7 @@ type IssueCommentContractProperties struct { // MarshalJSON implements the json.Marshaller interface for type IssueCommentContractProperties. func (i IssueCommentContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdDate", (*timeRFC3339)(i.CreatedDate)) + populateTimeRFC3339(objectMap, "createdDate", i.CreatedDate) populate(objectMap, "text", i.Text) populate(objectMap, "userId", i.UserID) return json.Marshal(objectMap) @@ -4796,9 +4771,7 @@ func (i *IssueCommentContractProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "createdDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.CreatedDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.CreatedDate) delete(rawMsg, key) case "text": err = unpopulate(val, &i.Text) @@ -4859,7 +4832,7 @@ func (i *IssueContractBaseProperties) UnmarshalJSON(data []byte) error { func (i IssueContractBaseProperties) marshalInternal(objectMap map[string]interface{}) { populate(objectMap, "apiId", i.APIID) - populate(objectMap, "createdDate", (*timeRFC3339)(i.CreatedDate)) + populateTimeRFC3339(objectMap, "createdDate", i.CreatedDate) populate(objectMap, "state", i.State) } @@ -4871,9 +4844,7 @@ func (i *IssueContractBaseProperties) unmarshalInternal(rawMsg map[string]json.R err = unpopulate(val, &i.APIID) delete(rawMsg, key) case "createdDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.CreatedDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.CreatedDate) delete(rawMsg, key) case "state": err = unpopulate(val, &i.State) @@ -5056,7 +5027,7 @@ func (k KeyVaultLastAccessStatusContractProperties) MarshalJSON() ([]byte, error objectMap := make(map[string]interface{}) populate(objectMap, "code", k.Code) populate(objectMap, "message", k.Message) - populate(objectMap, "timeStampUtc", (*timeRFC3339)(k.TimeStampUTC)) + populateTimeRFC3339(objectMap, "timeStampUtc", k.TimeStampUTC) return json.Marshal(objectMap) } @@ -5076,9 +5047,7 @@ func (k *KeyVaultLastAccessStatusContractProperties) UnmarshalJSON(data []byte) err = unpopulate(val, &k.Message) delete(rawMsg, key) case "timeStampUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - k.TimeStampUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &k.TimeStampUTC) delete(rawMsg, key) } if err != nil { @@ -5944,9 +5913,9 @@ func (o OperationResultContractProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "error", o.Error) populate(objectMap, "id", o.ID) populate(objectMap, "resultInfo", o.ResultInfo) - populate(objectMap, "started", (*timeRFC3339)(o.Started)) + populateTimeRFC3339(objectMap, "started", o.Started) populate(objectMap, "status", o.Status) - populate(objectMap, "updated", (*timeRFC3339)(o.Updated)) + populateTimeRFC3339(objectMap, "updated", o.Updated) return json.Marshal(objectMap) } @@ -5972,17 +5941,13 @@ func (o *OperationResultContractProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &o.ResultInfo) delete(rawMsg, key) case "started": - var aux timeRFC3339 - err = unpopulate(val, &aux) - o.Started = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &o.Started) delete(rawMsg, key) case "status": err = unpopulate(val, &o.Status) delete(rawMsg, key) case "updated": - var aux timeRFC3339 - err = unpopulate(val, &aux) - o.Updated = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &o.Updated) delete(rawMsg, key) } if err != nil { @@ -6390,12 +6355,12 @@ type PortalRevisionContractProperties struct { // MarshalJSON implements the json.Marshaller interface for type PortalRevisionContractProperties. func (p PortalRevisionContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdDateTime", (*timeRFC3339)(p.CreatedDateTime)) + populateTimeRFC3339(objectMap, "createdDateTime", p.CreatedDateTime) populate(objectMap, "description", p.Description) populate(objectMap, "isCurrent", p.IsCurrent) populate(objectMap, "status", p.Status) populate(objectMap, "statusDetails", p.StatusDetails) - populate(objectMap, "updatedDateTime", (*timeRFC3339)(p.UpdatedDateTime)) + populateTimeRFC3339(objectMap, "updatedDateTime", p.UpdatedDateTime) return json.Marshal(objectMap) } @@ -6409,9 +6374,7 @@ func (p *PortalRevisionContractProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "createdDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - p.CreatedDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &p.CreatedDateTime) delete(rawMsg, key) case "description": err = unpopulate(val, &p.Description) @@ -6426,9 +6389,7 @@ func (p *PortalRevisionContractProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &p.StatusDetails) delete(rawMsg, key) case "updatedDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - p.UpdatedDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &p.UpdatedDateTime) delete(rawMsg, key) } if err != nil { @@ -7075,9 +7036,9 @@ type QuotaCounterContract struct { func (q QuotaCounterContract) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "counterKey", q.CounterKey) - populate(objectMap, "periodEndTime", (*timeRFC3339)(q.PeriodEndTime)) + populateTimeRFC3339(objectMap, "periodEndTime", q.PeriodEndTime) populate(objectMap, "periodKey", q.PeriodKey) - populate(objectMap, "periodStartTime", (*timeRFC3339)(q.PeriodStartTime)) + populateTimeRFC3339(objectMap, "periodStartTime", q.PeriodStartTime) populate(objectMap, "value", q.Value) return json.Marshal(objectMap) } @@ -7095,17 +7056,13 @@ func (q *QuotaCounterContract) UnmarshalJSON(data []byte) error { err = unpopulate(val, &q.CounterKey) delete(rawMsg, key) case "periodEndTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - q.PeriodEndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &q.PeriodEndTime) delete(rawMsg, key) case "periodKey": err = unpopulate(val, &q.PeriodKey) delete(rawMsg, key) case "periodStartTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - q.PeriodStartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &q.PeriodStartTime) delete(rawMsg, key) case "value": err = unpopulate(val, &q.Value) @@ -7435,7 +7392,7 @@ func (r ReportRecordContract) MarshalJSON() ([]byte, error) { populate(objectMap, "serviceTimeMax", r.ServiceTimeMax) populate(objectMap, "serviceTimeMin", r.ServiceTimeMin) populate(objectMap, "subscriptionId", r.SubscriptionID) - populate(objectMap, "timestamp", (*timeRFC3339)(r.Timestamp)) + populateTimeRFC3339(objectMap, "timestamp", r.Timestamp) populate(objectMap, "userId", r.UserID) populate(objectMap, "zip", r.Zip) return json.Marshal(objectMap) @@ -7520,9 +7477,7 @@ func (r *ReportRecordContract) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.SubscriptionID) delete(rawMsg, key) case "timestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.Timestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.Timestamp) delete(rawMsg, key) case "userId": err = unpopulate(val, &r.UserID) @@ -7762,7 +7717,7 @@ func (r RequestReportRecordContract) MarshalJSON() ([]byte, error) { populate(objectMap, "responseSize", r.ResponseSize) populate(objectMap, "serviceTime", r.ServiceTime) populate(objectMap, "subscriptionId", r.SubscriptionID) - populate(objectMap, "timestamp", (*timeRFC3339)(r.Timestamp)) + populateTimeRFC3339(objectMap, "timestamp", r.Timestamp) populate(objectMap, "url", r.URL) populate(objectMap, "userId", r.UserID) return json.Marshal(objectMap) @@ -7823,9 +7778,7 @@ func (r *RequestReportRecordContract) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.SubscriptionID) delete(rawMsg, key) case "timestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.Timestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.Timestamp) delete(rawMsg, key) case "url": err = unpopulate(val, &r.URL) @@ -8177,16 +8130,16 @@ type SubscriptionContractProperties struct { func (s SubscriptionContractProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "allowTracing", s.AllowTracing) - populate(objectMap, "createdDate", (*timeRFC3339)(s.CreatedDate)) + populateTimeRFC3339(objectMap, "createdDate", s.CreatedDate) populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "endDate", (*timeRFC3339)(s.EndDate)) - populate(objectMap, "expirationDate", (*timeRFC3339)(s.ExpirationDate)) - populate(objectMap, "notificationDate", (*timeRFC3339)(s.NotificationDate)) + populateTimeRFC3339(objectMap, "endDate", s.EndDate) + populateTimeRFC3339(objectMap, "expirationDate", s.ExpirationDate) + populateTimeRFC3339(objectMap, "notificationDate", s.NotificationDate) populate(objectMap, "ownerId", s.OwnerID) populate(objectMap, "primaryKey", s.PrimaryKey) populate(objectMap, "scope", s.Scope) populate(objectMap, "secondaryKey", s.SecondaryKey) - populate(objectMap, "startDate", (*timeRFC3339)(s.StartDate)) + populateTimeRFC3339(objectMap, "startDate", s.StartDate) populate(objectMap, "state", s.State) populate(objectMap, "stateComment", s.StateComment) return json.Marshal(objectMap) @@ -8205,27 +8158,19 @@ func (s *SubscriptionContractProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.AllowTracing) delete(rawMsg, key) case "createdDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedDate) delete(rawMsg, key) case "displayName": err = unpopulate(val, &s.DisplayName) delete(rawMsg, key) case "endDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.EndDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.EndDate) delete(rawMsg, key) case "expirationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.ExpirationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.ExpirationDate) delete(rawMsg, key) case "notificationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.NotificationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.NotificationDate) delete(rawMsg, key) case "ownerId": err = unpopulate(val, &s.OwnerID) @@ -8240,9 +8185,7 @@ func (s *SubscriptionContractProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.SecondaryKey) delete(rawMsg, key) case "startDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.StartDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.StartDate) delete(rawMsg, key) case "state": err = unpopulate(val, &s.State) @@ -8420,7 +8363,7 @@ func (s SubscriptionUpdateParameterProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "allowTracing", s.AllowTracing) populate(objectMap, "displayName", s.DisplayName) - populate(objectMap, "expirationDate", (*timeRFC3339)(s.ExpirationDate)) + populateTimeRFC3339(objectMap, "expirationDate", s.ExpirationDate) populate(objectMap, "ownerId", s.OwnerID) populate(objectMap, "primaryKey", s.PrimaryKey) populate(objectMap, "scope", s.Scope) @@ -8446,9 +8389,7 @@ func (s *SubscriptionUpdateParameterProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, &s.DisplayName) delete(rawMsg, key) case "expirationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.ExpirationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.ExpirationDate) delete(rawMsg, key) case "ownerId": err = unpopulate(val, &s.OwnerID) @@ -8519,10 +8460,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -8538,9 +8479,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -8549,9 +8488,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) @@ -9003,12 +8940,12 @@ func (t TenantConfigurationSyncStateContractProperties) MarshalJSON() ([]byte, e objectMap := make(map[string]interface{}) populate(objectMap, "branch", t.Branch) populate(objectMap, "commitId", t.CommitID) - populate(objectMap, "configurationChangeDate", (*timeRFC3339)(t.ConfigurationChangeDate)) + populateTimeRFC3339(objectMap, "configurationChangeDate", t.ConfigurationChangeDate) populate(objectMap, "isExport", t.IsExport) populate(objectMap, "isGitEnabled", t.IsGitEnabled) populate(objectMap, "isSynced", t.IsSynced) populate(objectMap, "lastOperationId", t.LastOperationID) - populate(objectMap, "syncDate", (*timeRFC3339)(t.SyncDate)) + populateTimeRFC3339(objectMap, "syncDate", t.SyncDate) return json.Marshal(objectMap) } @@ -9028,9 +8965,7 @@ func (t *TenantConfigurationSyncStateContractProperties) UnmarshalJSON(data []by err = unpopulate(val, &t.CommitID) delete(rawMsg, key) case "configurationChangeDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.ConfigurationChangeDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.ConfigurationChangeDate) delete(rawMsg, key) case "isExport": err = unpopulate(val, &t.IsExport) @@ -9045,9 +8980,7 @@ func (t *TenantConfigurationSyncStateContractProperties) UnmarshalJSON(data []by err = unpopulate(val, &t.LastOperationID) delete(rawMsg, key) case "syncDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.SyncDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.SyncDate) delete(rawMsg, key) } if err != nil { @@ -9203,7 +9136,7 @@ func (u UserContractProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "firstName", u.FirstName) populate(objectMap, "groups", u.Groups) populate(objectMap, "lastName", u.LastName) - populate(objectMap, "registrationDate", (*timeRFC3339)(u.RegistrationDate)) + populateTimeRFC3339(objectMap, "registrationDate", u.RegistrationDate) return json.Marshal(objectMap) } @@ -9229,9 +9162,7 @@ func (u *UserContractProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &u.LastName) delete(rawMsg, key) case "registrationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - u.RegistrationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &u.RegistrationDate) delete(rawMsg, key) } if err != nil { @@ -9521,7 +9452,7 @@ type UserTokenParameterProperties struct { // MarshalJSON implements the json.Marshaller interface for type UserTokenParameterProperties. func (u UserTokenParameterProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "expiry", (*timeRFC3339)(u.Expiry)) + populateTimeRFC3339(objectMap, "expiry", u.Expiry) populate(objectMap, "keyType", u.KeyType) return json.Marshal(objectMap) } @@ -9536,9 +9467,7 @@ func (u *UserTokenParameterProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "expiry": - var aux timeRFC3339 - err = unpopulate(val, &aux) - u.Expiry = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &u.Expiry) delete(rawMsg, key) case "keyType": err = unpopulate(val, &u.KeyType) diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_namedvalue_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_namedvalue_client.go index d89067c83270..cb1a32f768e3 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_namedvalue_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_namedvalue_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // NamedValueClient contains the methods for the NamedValue group. @@ -32,8 +32,15 @@ type NamedValueClient struct { } // NewNamedValueClient creates a new instance of NamedValueClient with the specified values. -func NewNamedValueClient(con *arm.Connection, subscriptionID string) *NamedValueClient { - return &NamedValueClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNamedValueClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NamedValueClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NamedValueClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates named value. @@ -97,7 +104,7 @@ func (client *NamedValueClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -160,7 +167,7 @@ func (client *NamedValueClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -221,7 +228,7 @@ func (client *NamedValueClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +241,7 @@ func (client *NamedValueClient) getHandleResponse(resp *http.Response) (NamedVal result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.NamedValueContract); err != nil { - return NamedValueGetResponse{}, err + return NamedValueGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -290,7 +297,7 @@ func (client *NamedValueClient) getEntityTagCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -354,7 +361,7 @@ func (client *NamedValueClient) listByServiceCreateRequest(ctx context.Context, if options != nil && options.IsKeyVaultRefreshFailed != nil { reqQP.Set("isKeyVaultRefreshFailed", strconv.FormatBool(*options.IsKeyVaultRefreshFailed)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -364,7 +371,7 @@ func (client *NamedValueClient) listByServiceCreateRequest(ctx context.Context, func (client *NamedValueClient) listByServiceHandleResponse(resp *http.Response) (NamedValueListByServiceResponse, error) { result := NamedValueListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NamedValueCollection); err != nil { - return NamedValueListByServiceResponse{}, err + return NamedValueListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -423,7 +430,7 @@ func (client *NamedValueClient) listValueCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -436,7 +443,7 @@ func (client *NamedValueClient) listValueHandleResponse(resp *http.Response) (Na result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.NamedValueSecretContract); err != nil { - return NamedValueListValueResponse{}, err + return NamedValueListValueResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -515,7 +522,7 @@ func (client *NamedValueClient) refreshSecretCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -595,7 +602,7 @@ func (client *NamedValueClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_networkstatus_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_networkstatus_client.go index f3b8c40d0678..a9278d646978 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_networkstatus_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_networkstatus_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NetworkStatusClient contains the methods for the NetworkStatus group. @@ -30,8 +31,15 @@ type NetworkStatusClient struct { } // NewNetworkStatusClient creates a new instance of NetworkStatusClient with the specified values. -func NewNetworkStatusClient(con *arm.Connection, subscriptionID string) *NetworkStatusClient { - return &NetworkStatusClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNetworkStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NetworkStatusClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NetworkStatusClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByLocation - Gets the Connectivity Status to the external resources on which the Api Management service depends from inside the Cloud Service. This @@ -76,7 +84,7 @@ func (client *NetworkStatusClient) listByLocationCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -86,7 +94,7 @@ func (client *NetworkStatusClient) listByLocationCreateRequest(ctx context.Conte func (client *NetworkStatusClient) listByLocationHandleResponse(resp *http.Response) (NetworkStatusListByLocationResponse, error) { result := NetworkStatusListByLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkStatusContract); err != nil { - return NetworkStatusListByLocationResponse{}, err + return NetworkStatusListByLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -142,7 +150,7 @@ func (client *NetworkStatusClient) listByServiceCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -152,7 +160,7 @@ func (client *NetworkStatusClient) listByServiceCreateRequest(ctx context.Contex func (client *NetworkStatusClient) listByServiceHandleResponse(resp *http.Response) (NetworkStatusListByServiceResponse, error) { result := NetworkStatusListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkStatusContractByLocationArray); err != nil { - return NetworkStatusListByServiceResponse{}, err + return NetworkStatusListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_notification_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_notification_client.go index e90a76488b81..945f9e6d4b24 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_notification_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_notification_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // NotificationClient contains the methods for the Notification group. @@ -31,8 +32,15 @@ type NotificationClient struct { } // NewNotificationClient creates a new instance of NotificationClient with the specified values. -func NewNotificationClient(con *arm.Connection, subscriptionID string) *NotificationClient { - return &NotificationClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNotificationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NotificationClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NotificationClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or Update API Management publisher notification. @@ -76,7 +84,7 @@ func (client *NotificationClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -89,7 +97,7 @@ func (client *NotificationClient) createOrUpdateCreateRequest(ctx context.Contex func (client *NotificationClient) createOrUpdateHandleResponse(resp *http.Response) (NotificationCreateOrUpdateResponse, error) { result := NotificationCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NotificationContract); err != nil { - return NotificationCreateOrUpdateResponse{}, err + return NotificationCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -148,7 +156,7 @@ func (client *NotificationClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -158,7 +166,7 @@ func (client *NotificationClient) getCreateRequest(ctx context.Context, resource func (client *NotificationClient) getHandleResponse(resp *http.Response) (NotificationGetResponse, error) { result := NotificationGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NotificationContract); err != nil { - return NotificationGetResponse{}, err + return NotificationGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -216,7 +224,7 @@ func (client *NotificationClient) listByServiceCreateRequest(ctx context.Context if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -226,7 +234,7 @@ func (client *NotificationClient) listByServiceCreateRequest(ctx context.Context func (client *NotificationClient) listByServiceHandleResponse(resp *http.Response) (NotificationListByServiceResponse, error) { result := NotificationListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NotificationCollection); err != nil { - return NotificationListByServiceResponse{}, err + return NotificationListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_notificationrecipientemail_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_notificationrecipientemail_client.go index 302348917b7c..6e3902270660 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_notificationrecipientemail_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_notificationrecipientemail_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NotificationRecipientEmailClient contains the methods for the NotificationRecipientEmail group. @@ -30,8 +31,15 @@ type NotificationRecipientEmailClient struct { } // NewNotificationRecipientEmailClient creates a new instance of NotificationRecipientEmailClient with the specified values. -func NewNotificationRecipientEmailClient(con *arm.Connection, subscriptionID string) *NotificationRecipientEmailClient { - return &NotificationRecipientEmailClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNotificationRecipientEmailClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NotificationRecipientEmailClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NotificationRecipientEmailClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckEntityExists - Determine if Notification Recipient Email subscribed to the notification. @@ -80,7 +88,7 @@ func (client *NotificationRecipientEmailClient) checkEntityExistsCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -131,7 +139,7 @@ func (client *NotificationRecipientEmailClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -141,7 +149,7 @@ func (client *NotificationRecipientEmailClient) createOrUpdateCreateRequest(ctx func (client *NotificationRecipientEmailClient) createOrUpdateHandleResponse(resp *http.Response) (NotificationRecipientEmailCreateOrUpdateResponse, error) { result := NotificationRecipientEmailCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecipientEmailContract); err != nil { - return NotificationRecipientEmailCreateOrUpdateResponse{}, err + return NotificationRecipientEmailCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -204,7 +212,7 @@ func (client *NotificationRecipientEmailClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -264,7 +272,7 @@ func (client *NotificationRecipientEmailClient) listByNotificationCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -274,7 +282,7 @@ func (client *NotificationRecipientEmailClient) listByNotificationCreateRequest( func (client *NotificationRecipientEmailClient) listByNotificationHandleResponse(resp *http.Response) (NotificationRecipientEmailListByNotificationResponse, error) { result := NotificationRecipientEmailListByNotificationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecipientEmailCollection); err != nil { - return NotificationRecipientEmailListByNotificationResponse{}, err + return NotificationRecipientEmailListByNotificationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_notificationrecipientuser_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_notificationrecipientuser_client.go index ea43f8d56f98..76f61fc2149d 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_notificationrecipientuser_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_notificationrecipientuser_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NotificationRecipientUserClient contains the methods for the NotificationRecipientUser group. @@ -30,8 +31,15 @@ type NotificationRecipientUserClient struct { } // NewNotificationRecipientUserClient creates a new instance of NotificationRecipientUserClient with the specified values. -func NewNotificationRecipientUserClient(con *arm.Connection, subscriptionID string) *NotificationRecipientUserClient { - return &NotificationRecipientUserClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNotificationRecipientUserClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NotificationRecipientUserClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NotificationRecipientUserClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckEntityExists - Determine if the Notification Recipient User is subscribed to the notification. @@ -80,7 +88,7 @@ func (client *NotificationRecipientUserClient) checkEntityExistsCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -131,7 +139,7 @@ func (client *NotificationRecipientUserClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -141,7 +149,7 @@ func (client *NotificationRecipientUserClient) createOrUpdateCreateRequest(ctx c func (client *NotificationRecipientUserClient) createOrUpdateHandleResponse(resp *http.Response) (NotificationRecipientUserCreateOrUpdateResponse, error) { result := NotificationRecipientUserCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecipientUserContract); err != nil { - return NotificationRecipientUserCreateOrUpdateResponse{}, err + return NotificationRecipientUserCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -204,7 +212,7 @@ func (client *NotificationRecipientUserClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -264,7 +272,7 @@ func (client *NotificationRecipientUserClient) listByNotificationCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -274,7 +282,7 @@ func (client *NotificationRecipientUserClient) listByNotificationCreateRequest(c func (client *NotificationRecipientUserClient) listByNotificationHandleResponse(resp *http.Response) (NotificationRecipientUserListByNotificationResponse, error) { result := NotificationRecipientUserListByNotificationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecipientUserCollection); err != nil { - return NotificationRecipientUserListByNotificationResponse{}, err + return NotificationRecipientUserListByNotificationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_openidconnectprovider_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_openidconnectprovider_client.go index 93716604ec06..1c1055ba635c 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_openidconnectprovider_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_openidconnectprovider_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // OpenIDConnectProviderClient contains the methods for the OpenIDConnectProvider group. @@ -31,8 +32,15 @@ type OpenIDConnectProviderClient struct { } // NewOpenIDConnectProviderClient creates a new instance of OpenIDConnectProviderClient with the specified values. -func NewOpenIDConnectProviderClient(con *arm.Connection, subscriptionID string) *OpenIDConnectProviderClient { - return &OpenIDConnectProviderClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewOpenIDConnectProviderClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OpenIDConnectProviderClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OpenIDConnectProviderClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the OpenID Connect Provider. @@ -76,7 +84,7 @@ func (client *OpenIDConnectProviderClient) createOrUpdateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -92,7 +100,7 @@ func (client *OpenIDConnectProviderClient) createOrUpdateHandleResponse(resp *ht result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.OpenidConnectProviderContract); err != nil { - return OpenIDConnectProviderCreateOrUpdateResponse{}, err + return OpenIDConnectProviderCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -151,7 +159,7 @@ func (client *OpenIDConnectProviderClient) deleteCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -212,7 +220,7 @@ func (client *OpenIDConnectProviderClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -225,7 +233,7 @@ func (client *OpenIDConnectProviderClient) getHandleResponse(resp *http.Response result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.OpenidConnectProviderContract); err != nil { - return OpenIDConnectProviderGetResponse{}, err + return OpenIDConnectProviderGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -281,7 +289,7 @@ func (client *OpenIDConnectProviderClient) getEntityTagCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -342,7 +350,7 @@ func (client *OpenIDConnectProviderClient) listByServiceCreateRequest(ctx contex if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -352,7 +360,7 @@ func (client *OpenIDConnectProviderClient) listByServiceCreateRequest(ctx contex func (client *OpenIDConnectProviderClient) listByServiceHandleResponse(resp *http.Response) (OpenIDConnectProviderListByServiceResponse, error) { result := OpenIDConnectProviderListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OpenIDConnectProviderCollection); err != nil { - return OpenIDConnectProviderListByServiceResponse{}, err + return OpenIDConnectProviderListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -411,7 +419,7 @@ func (client *OpenIDConnectProviderClient) listSecretsCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -424,7 +432,7 @@ func (client *OpenIDConnectProviderClient) listSecretsHandleResponse(resp *http. result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ClientSecretContract); err != nil { - return OpenIDConnectProviderListSecretsResponse{}, err + return OpenIDConnectProviderListSecretsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -483,7 +491,7 @@ func (client *OpenIDConnectProviderClient) updateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -497,7 +505,7 @@ func (client *OpenIDConnectProviderClient) updateHandleResponse(resp *http.Respo result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.OpenidConnectProviderContract); err != nil { - return OpenIDConnectProviderUpdateResponse{}, err + return OpenIDConnectProviderUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_operation_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_operation_client.go index 762db516027e..5047b0fcc617 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_operation_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_operation_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // OperationClient contains the methods for the Operation group. @@ -31,8 +32,15 @@ type OperationClient struct { } // NewOperationClient creates a new instance of OperationClient with the specified values. -func NewOperationClient(con *arm.Connection, subscriptionID string) *OperationClient { - return &OperationClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewOperationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OperationClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByTags - Lists a collection of operations associated with tags. @@ -85,7 +93,7 @@ func (client *OperationClient) listByTagsCreateRequest(ctx context.Context, reso if options != nil && options.IncludeNotTaggedOperations != nil { reqQP.Set("includeNotTaggedOperations", strconv.FormatBool(*options.IncludeNotTaggedOperations)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -95,7 +103,7 @@ func (client *OperationClient) listByTagsCreateRequest(ctx context.Context, reso func (client *OperationClient) listByTagsHandleResponse(resp *http.Response) (OperationListByTagsResponse, error) { result := OperationListByTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TagResourceCollection); err != nil { - return OperationListByTagsResponse{}, err + return OperationListByTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_outboundnetworkdependenciesendpoints_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_outboundnetworkdependenciesendpoints_client.go index 729bbd6c9aad..f4060c7308b8 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_outboundnetworkdependenciesendpoints_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_outboundnetworkdependenciesendpoints_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // OutboundNetworkDependenciesEndpointsClient contains the methods for the OutboundNetworkDependenciesEndpoints group. @@ -30,8 +31,15 @@ type OutboundNetworkDependenciesEndpointsClient struct { } // NewOutboundNetworkDependenciesEndpointsClient creates a new instance of OutboundNetworkDependenciesEndpointsClient with the specified values. -func NewOutboundNetworkDependenciesEndpointsClient(con *arm.Connection, subscriptionID string) *OutboundNetworkDependenciesEndpointsClient { - return &OutboundNetworkDependenciesEndpointsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewOutboundNetworkDependenciesEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OutboundNetworkDependenciesEndpointsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OutboundNetworkDependenciesEndpointsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByService - Gets the network endpoints of all outbound dependencies of a ApiManagement service. @@ -71,7 +79,7 @@ func (client *OutboundNetworkDependenciesEndpointsClient) listByServiceCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -81,7 +89,7 @@ func (client *OutboundNetworkDependenciesEndpointsClient) listByServiceCreateReq func (client *OutboundNetworkDependenciesEndpointsClient) listByServiceHandleResponse(resp *http.Response) (OutboundNetworkDependenciesEndpointsListByServiceResponse, error) { result := OutboundNetworkDependenciesEndpointsListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OutboundEnvironmentEndpointList); err != nil { - return OutboundNetworkDependenciesEndpointsListByServiceResponse{}, err + return OutboundNetworkDependenciesEndpointsListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_pagers.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_pagers.go index eb31e95c4a07..f84ab9bc7726 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_pagers.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armapimanagement import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // APIDiagnosticListByServicePager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_policy_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_policy_client.go index 2eb1d2cf0909..209fe6c3bd1a 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_policy_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_policy_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PolicyClient contains the methods for the Policy group. @@ -30,8 +31,15 @@ type PolicyClient struct { } // NewPolicyClient creates a new instance of PolicyClient with the specified values. -func NewPolicyClient(con *arm.Connection, subscriptionID string) *PolicyClient { - return &PolicyClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPolicyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PolicyClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PolicyClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the global policy configuration of the Api Management service. @@ -75,7 +83,7 @@ func (client *PolicyClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -91,7 +99,7 @@ func (client *PolicyClient) createOrUpdateHandleResponse(resp *http.Response) (P result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.PolicyContract); err != nil { - return PolicyCreateOrUpdateResponse{}, err + return PolicyCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -150,7 +158,7 @@ func (client *PolicyClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -214,7 +222,7 @@ func (client *PolicyClient) getCreateRequest(ctx context.Context, resourceGroupN if options != nil && options.Format != nil { reqQP.Set("format", string(*options.Format)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -227,7 +235,7 @@ func (client *PolicyClient) getHandleResponse(resp *http.Response) (PolicyGetRes result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.PolicyContract); err != nil { - return PolicyGetResponse{}, err + return PolicyGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -283,7 +291,7 @@ func (client *PolicyClient) getEntityTagCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -338,7 +346,7 @@ func (client *PolicyClient) listByServiceCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -348,7 +356,7 @@ func (client *PolicyClient) listByServiceCreateRequest(ctx context.Context, reso func (client *PolicyClient) listByServiceHandleResponse(resp *http.Response) (PolicyListByServiceResponse, error) { result := PolicyListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PolicyCollection); err != nil { - return PolicyListByServiceResponse{}, err + return PolicyListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_policydescription_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_policydescription_client.go index 97383892bac5..276bab10061a 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_policydescription_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_policydescription_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PolicyDescriptionClient contains the methods for the PolicyDescription group. @@ -30,8 +31,15 @@ type PolicyDescriptionClient struct { } // NewPolicyDescriptionClient creates a new instance of PolicyDescriptionClient with the specified values. -func NewPolicyDescriptionClient(con *arm.Connection, subscriptionID string) *PolicyDescriptionClient { - return &PolicyDescriptionClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPolicyDescriptionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PolicyDescriptionClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PolicyDescriptionClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByService - Lists all policy descriptions. @@ -74,7 +82,7 @@ func (client *PolicyDescriptionClient) listByServiceCreateRequest(ctx context.Co if options != nil && options.Scope != nil { reqQP.Set("scope", string(*options.Scope)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -84,7 +92,7 @@ func (client *PolicyDescriptionClient) listByServiceCreateRequest(ctx context.Co func (client *PolicyDescriptionClient) listByServiceHandleResponse(resp *http.Response) (PolicyDescriptionListByServiceResponse, error) { result := PolicyDescriptionListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PolicyDescriptionCollection); err != nil { - return PolicyDescriptionListByServiceResponse{}, err + return PolicyDescriptionListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_pollers.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_pollers.go index 12c520ea103a..541c7df6ff99 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_pollers.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armapimanagement import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // APICreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_portalrevision_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_portalrevision_client.go index 5c929d4ea9c9..4b2c990f70f2 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_portalrevision_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_portalrevision_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // PortalRevisionClient contains the methods for the PortalRevision group. @@ -32,8 +32,15 @@ type PortalRevisionClient struct { } // NewPortalRevisionClient creates a new instance of PortalRevisionClient with the specified values. -func NewPortalRevisionClient(con *arm.Connection, subscriptionID string) *PortalRevisionClient { - return &PortalRevisionClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPortalRevisionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PortalRevisionClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PortalRevisionClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a new developer portal's revision by running the portal's publishing. The isCurrent property indicates if the revision @@ -99,7 +106,7 @@ func (client *PortalRevisionClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -159,7 +166,7 @@ func (client *PortalRevisionClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -172,7 +179,7 @@ func (client *PortalRevisionClient) getHandleResponse(resp *http.Response) (Port result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.PortalRevisionContract); err != nil { - return PortalRevisionGetResponse{}, err + return PortalRevisionGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -228,7 +235,7 @@ func (client *PortalRevisionClient) getEntityTagCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -289,7 +296,7 @@ func (client *PortalRevisionClient) listByServiceCreateRequest(ctx context.Conte if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -299,7 +306,7 @@ func (client *PortalRevisionClient) listByServiceCreateRequest(ctx context.Conte func (client *PortalRevisionClient) listByServiceHandleResponse(resp *http.Response) (PortalRevisionListByServiceResponse, error) { result := PortalRevisionListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PortalRevisionCollection); err != nil { - return PortalRevisionListByServiceResponse{}, err + return PortalRevisionListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -378,7 +385,7 @@ func (client *PortalRevisionClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_portalsettings_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_portalsettings_client.go index 022ea63631b0..194526daf151 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_portalsettings_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_portalsettings_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PortalSettingsClient contains the methods for the PortalSettings group. @@ -30,8 +31,15 @@ type PortalSettingsClient struct { } // NewPortalSettingsClient creates a new instance of PortalSettingsClient with the specified values. -func NewPortalSettingsClient(con *arm.Connection, subscriptionID string) *PortalSettingsClient { - return &PortalSettingsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPortalSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PortalSettingsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PortalSettingsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByService - Lists a collection of portalsettings defined within a service instance.. @@ -71,7 +79,7 @@ func (client *PortalSettingsClient) listByServiceCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -81,7 +89,7 @@ func (client *PortalSettingsClient) listByServiceCreateRequest(ctx context.Conte func (client *PortalSettingsClient) listByServiceHandleResponse(resp *http.Response) (PortalSettingsListByServiceResponse, error) { result := PortalSettingsListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PortalSettingsCollection); err != nil { - return PortalSettingsListByServiceResponse{}, err + return PortalSettingsListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_privateendpointconnection_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_privateendpointconnection_client.go index 2f9281e502d5..b484dc11ccc4 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_privateendpointconnection_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_privateendpointconnection_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateEndpointConnectionClient contains the methods for the PrivateEndpointConnection group. @@ -31,8 +31,15 @@ type PrivateEndpointConnectionClient struct { } // NewPrivateEndpointConnectionClient creates a new instance of PrivateEndpointConnectionClient with the specified values. -func NewPrivateEndpointConnectionClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionClient { - return &PrivateEndpointConnectionClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a new Private Endpoint Connection or updates an existing one. @@ -96,7 +103,7 @@ func (client *PrivateEndpointConnectionClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, privateEndpointConnectionRequest) @@ -176,7 +183,7 @@ func (client *PrivateEndpointConnectionClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *PrivateEndpointConnectionClient) getByNameCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *PrivateEndpointConnectionClient) getByNameCreateRequest(ctx contex func (client *PrivateEndpointConnectionClient) getByNameHandleResponse(resp *http.Response) (PrivateEndpointConnectionGetByNameResponse, error) { result := PrivateEndpointConnectionGetByNameResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionGetByNameResponse{}, err + return PrivateEndpointConnectionGetByNameResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -305,7 +312,7 @@ func (client *PrivateEndpointConnectionClient) getPrivateLinkResourceCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -315,7 +322,7 @@ func (client *PrivateEndpointConnectionClient) getPrivateLinkResourceCreateReque func (client *PrivateEndpointConnectionClient) getPrivateLinkResourceHandleResponse(resp *http.Response) (PrivateEndpointConnectionGetPrivateLinkResourceResponse, error) { result := PrivateEndpointConnectionGetPrivateLinkResourceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { - return PrivateEndpointConnectionGetPrivateLinkResourceResponse{}, err + return PrivateEndpointConnectionGetPrivateLinkResourceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -370,7 +377,7 @@ func (client *PrivateEndpointConnectionClient) listByServiceCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -380,7 +387,7 @@ func (client *PrivateEndpointConnectionClient) listByServiceCreateRequest(ctx co func (client *PrivateEndpointConnectionClient) listByServiceHandleResponse(resp *http.Response) (PrivateEndpointConnectionListByServiceResponse, error) { result := PrivateEndpointConnectionListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionListByServiceResponse{}, err + return PrivateEndpointConnectionListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -435,7 +442,7 @@ func (client *PrivateEndpointConnectionClient) listPrivateLinkResourcesCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -445,7 +452,7 @@ func (client *PrivateEndpointConnectionClient) listPrivateLinkResourcesCreateReq func (client *PrivateEndpointConnectionClient) listPrivateLinkResourcesHandleResponse(resp *http.Response) (PrivateEndpointConnectionListPrivateLinkResourcesResponse, error) { result := PrivateEndpointConnectionListPrivateLinkResourcesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { - return PrivateEndpointConnectionListPrivateLinkResourcesResponse{}, err + return PrivateEndpointConnectionListPrivateLinkResourcesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_product_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_product_client.go index 77a799f07be1..45f5c2ed2f49 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_product_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_product_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // ProductClient contains the methods for the Product group. @@ -31,8 +32,15 @@ type ProductClient struct { } // NewProductClient creates a new instance of ProductClient with the specified values. -func NewProductClient(con *arm.Connection, subscriptionID string) *ProductClient { - return &ProductClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewProductClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ProductClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ProductClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or Updates a product. @@ -76,7 +84,7 @@ func (client *ProductClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -92,7 +100,7 @@ func (client *ProductClient) createOrUpdateHandleResponse(resp *http.Response) ( result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ProductContract); err != nil { - return ProductCreateOrUpdateResponse{}, err + return ProductCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -154,7 +162,7 @@ func (client *ProductClient) deleteCreateRequest(ctx context.Context, resourceGr if options != nil && options.DeleteSubscriptions != nil { reqQP.Set("deleteSubscriptions", strconv.FormatBool(*options.DeleteSubscriptions)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -215,7 +223,7 @@ func (client *ProductClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -228,7 +236,7 @@ func (client *ProductClient) getHandleResponse(resp *http.Response) (ProductGetR result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ProductContract); err != nil { - return ProductGetResponse{}, err + return ProductGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -284,7 +292,7 @@ func (client *ProductClient) getEntityTagCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -351,7 +359,7 @@ func (client *ProductClient) listByServiceCreateRequest(ctx context.Context, res if options != nil && options.Tags != nil { reqQP.Set("tags", *options.Tags) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -361,7 +369,7 @@ func (client *ProductClient) listByServiceCreateRequest(ctx context.Context, res func (client *ProductClient) listByServiceHandleResponse(resp *http.Response) (ProductListByServiceResponse, error) { result := ProductListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProductCollection); err != nil { - return ProductListByServiceResponse{}, err + return ProductListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -425,7 +433,7 @@ func (client *ProductClient) listByTagsCreateRequest(ctx context.Context, resour if options != nil && options.IncludeNotTaggedProducts != nil { reqQP.Set("includeNotTaggedProducts", strconv.FormatBool(*options.IncludeNotTaggedProducts)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -435,7 +443,7 @@ func (client *ProductClient) listByTagsCreateRequest(ctx context.Context, resour func (client *ProductClient) listByTagsHandleResponse(resp *http.Response) (ProductListByTagsResponse, error) { result := ProductListByTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TagResourceCollection); err != nil { - return ProductListByTagsResponse{}, err + return ProductListByTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -494,7 +502,7 @@ func (client *ProductClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -508,7 +516,7 @@ func (client *ProductClient) updateHandleResponse(resp *http.Response) (ProductU result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ProductContract); err != nil { - return ProductUpdateResponse{}, err + return ProductUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_productapi_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_productapi_client.go index 528722d8b08f..045365f9d1e0 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_productapi_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_productapi_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // ProductAPIClient contains the methods for the ProductAPI group. @@ -31,8 +32,15 @@ type ProductAPIClient struct { } // NewProductAPIClient creates a new instance of ProductAPIClient with the specified values. -func NewProductAPIClient(con *arm.Connection, subscriptionID string) *ProductAPIClient { - return &ProductAPIClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewProductAPIClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ProductAPIClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ProductAPIClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckEntityExists - Checks that API entity specified by identifier is associated with the Product entity. @@ -81,7 +89,7 @@ func (client *ProductAPIClient) checkEntityExistsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -132,7 +140,7 @@ func (client *ProductAPIClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -142,7 +150,7 @@ func (client *ProductAPIClient) createOrUpdateCreateRequest(ctx context.Context, func (client *ProductAPIClient) createOrUpdateHandleResponse(resp *http.Response) (ProductAPICreateOrUpdateResponse, error) { result := ProductAPICreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIContract); err != nil { - return ProductAPICreateOrUpdateResponse{}, err + return ProductAPICreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -205,7 +213,7 @@ func (client *ProductAPIClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -271,7 +279,7 @@ func (client *ProductAPIClient) listByProductCreateRequest(ctx context.Context, if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -281,7 +289,7 @@ func (client *ProductAPIClient) listByProductCreateRequest(ctx context.Context, func (client *ProductAPIClient) listByProductHandleResponse(resp *http.Response) (ProductAPIListByProductResponse, error) { result := ProductAPIListByProductResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APICollection); err != nil { - return ProductAPIListByProductResponse{}, err + return ProductAPIListByProductResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_productgroup_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_productgroup_client.go index c37130dff752..edaaec06bd2d 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_productgroup_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_productgroup_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // ProductGroupClient contains the methods for the ProductGroup group. @@ -31,8 +32,15 @@ type ProductGroupClient struct { } // NewProductGroupClient creates a new instance of ProductGroupClient with the specified values. -func NewProductGroupClient(con *arm.Connection, subscriptionID string) *ProductGroupClient { - return &ProductGroupClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewProductGroupClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ProductGroupClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ProductGroupClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckEntityExists - Checks that Group entity specified by identifier is associated with the Product entity. @@ -81,7 +89,7 @@ func (client *ProductGroupClient) checkEntityExistsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -132,7 +140,7 @@ func (client *ProductGroupClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -142,7 +150,7 @@ func (client *ProductGroupClient) createOrUpdateCreateRequest(ctx context.Contex func (client *ProductGroupClient) createOrUpdateHandleResponse(resp *http.Response) (ProductGroupCreateOrUpdateResponse, error) { result := ProductGroupCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GroupContract); err != nil { - return ProductGroupCreateOrUpdateResponse{}, err + return ProductGroupCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -205,7 +213,7 @@ func (client *ProductGroupClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -271,7 +279,7 @@ func (client *ProductGroupClient) listByProductCreateRequest(ctx context.Context if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -281,7 +289,7 @@ func (client *ProductGroupClient) listByProductCreateRequest(ctx context.Context func (client *ProductGroupClient) listByProductHandleResponse(resp *http.Response) (ProductGroupListByProductResponse, error) { result := ProductGroupListByProductResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GroupCollection); err != nil { - return ProductGroupListByProductResponse{}, err + return ProductGroupListByProductResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_productpolicy_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_productpolicy_client.go index 74f9ee37b37e..5aac3ca28717 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_productpolicy_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_productpolicy_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ProductPolicyClient contains the methods for the ProductPolicy group. @@ -30,8 +31,15 @@ type ProductPolicyClient struct { } // NewProductPolicyClient creates a new instance of ProductPolicyClient with the specified values. -func NewProductPolicyClient(con *arm.Connection, subscriptionID string) *ProductPolicyClient { - return &ProductPolicyClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewProductPolicyClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ProductPolicyClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ProductPolicyClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates policy configuration for the Product. @@ -79,7 +87,7 @@ func (client *ProductPolicyClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -95,7 +103,7 @@ func (client *ProductPolicyClient) createOrUpdateHandleResponse(resp *http.Respo result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.PolicyContract); err != nil { - return ProductPolicyCreateOrUpdateResponse{}, err + return ProductPolicyCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -158,7 +166,7 @@ func (client *ProductPolicyClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -226,7 +234,7 @@ func (client *ProductPolicyClient) getCreateRequest(ctx context.Context, resourc if options != nil && options.Format != nil { reqQP.Set("format", string(*options.Format)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -239,7 +247,7 @@ func (client *ProductPolicyClient) getHandleResponse(resp *http.Response) (Produ result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.PolicyContract); err != nil { - return ProductPolicyGetResponse{}, err + return ProductPolicyGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -299,7 +307,7 @@ func (client *ProductPolicyClient) getEntityTagCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -358,7 +366,7 @@ func (client *ProductPolicyClient) listByProductCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -368,7 +376,7 @@ func (client *ProductPolicyClient) listByProductCreateRequest(ctx context.Contex func (client *ProductPolicyClient) listByProductHandleResponse(resp *http.Response) (ProductPolicyListByProductResponse, error) { result := ProductPolicyListByProductResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PolicyCollection); err != nil { - return ProductPolicyListByProductResponse{}, err + return ProductPolicyListByProductResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_productsubscriptions_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_productsubscriptions_client.go index 7cfa40c12fd4..7291170ee351 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_productsubscriptions_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_productsubscriptions_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // ProductSubscriptionsClient contains the methods for the ProductSubscriptions group. @@ -31,8 +32,15 @@ type ProductSubscriptionsClient struct { } // NewProductSubscriptionsClient creates a new instance of ProductSubscriptionsClient with the specified values. -func NewProductSubscriptionsClient(con *arm.Connection, subscriptionID string) *ProductSubscriptionsClient { - return &ProductSubscriptionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewProductSubscriptionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ProductSubscriptionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ProductSubscriptionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists the collection of subscriptions to the specified product. @@ -82,7 +90,7 @@ func (client *ProductSubscriptionsClient) listCreateRequest(ctx context.Context, if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -92,7 +100,7 @@ func (client *ProductSubscriptionsClient) listCreateRequest(ctx context.Context, func (client *ProductSubscriptionsClient) listHandleResponse(resp *http.Response) (ProductSubscriptionsListResponse, error) { result := ProductSubscriptionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionCollection); err != nil { - return ProductSubscriptionsListResponse{}, err + return ProductSubscriptionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_quotabycounterkeys_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_quotabycounterkeys_client.go index 8e3e84a0ce7f..2583803e7126 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_quotabycounterkeys_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_quotabycounterkeys_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // QuotaByCounterKeysClient contains the methods for the QuotaByCounterKeys group. @@ -30,8 +31,15 @@ type QuotaByCounterKeysClient struct { } // NewQuotaByCounterKeysClient creates a new instance of QuotaByCounterKeysClient with the specified values. -func NewQuotaByCounterKeysClient(con *arm.Connection, subscriptionID string) *QuotaByCounterKeysClient { - return &QuotaByCounterKeysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewQuotaByCounterKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *QuotaByCounterKeysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &QuotaByCounterKeysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByService - Lists a collection of current quota counter periods associated with the counter-key configured in the policy on the specified service @@ -76,7 +84,7 @@ func (client *QuotaByCounterKeysClient) listByServiceCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -86,7 +94,7 @@ func (client *QuotaByCounterKeysClient) listByServiceCreateRequest(ctx context.C func (client *QuotaByCounterKeysClient) listByServiceHandleResponse(resp *http.Response) (QuotaByCounterKeysListByServiceResponse, error) { result := QuotaByCounterKeysListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.QuotaCounterCollection); err != nil { - return QuotaByCounterKeysListByServiceResponse{}, err + return QuotaByCounterKeysListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -146,7 +154,7 @@ func (client *QuotaByCounterKeysClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -156,7 +164,7 @@ func (client *QuotaByCounterKeysClient) updateCreateRequest(ctx context.Context, func (client *QuotaByCounterKeysClient) updateHandleResponse(resp *http.Response) (QuotaByCounterKeysUpdateResponse, error) { result := QuotaByCounterKeysUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.QuotaCounterCollection); err != nil { - return QuotaByCounterKeysUpdateResponse{}, err + return QuotaByCounterKeysUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_quotabyperiodkeys_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_quotabyperiodkeys_client.go index 0776bd7b7d4e..542071919227 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_quotabyperiodkeys_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_quotabyperiodkeys_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // QuotaByPeriodKeysClient contains the methods for the QuotaByPeriodKeys group. @@ -30,8 +31,15 @@ type QuotaByPeriodKeysClient struct { } // NewQuotaByPeriodKeysClient creates a new instance of QuotaByPeriodKeysClient with the specified values. -func NewQuotaByPeriodKeysClient(con *arm.Connection, subscriptionID string) *QuotaByPeriodKeysClient { - return &QuotaByPeriodKeysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewQuotaByPeriodKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *QuotaByPeriodKeysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &QuotaByPeriodKeysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the value of the quota counter associated with the counter-key in the policy for the specific period in service instance. @@ -79,7 +87,7 @@ func (client *QuotaByPeriodKeysClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -89,7 +97,7 @@ func (client *QuotaByPeriodKeysClient) getCreateRequest(ctx context.Context, res func (client *QuotaByPeriodKeysClient) getHandleResponse(resp *http.Response) (QuotaByPeriodKeysGetResponse, error) { result := QuotaByPeriodKeysGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.QuotaCounterContract); err != nil { - return QuotaByPeriodKeysGetResponse{}, err + return QuotaByPeriodKeysGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -152,7 +160,7 @@ func (client *QuotaByPeriodKeysClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -162,7 +170,7 @@ func (client *QuotaByPeriodKeysClient) updateCreateRequest(ctx context.Context, func (client *QuotaByPeriodKeysClient) updateHandleResponse(resp *http.Response) (QuotaByPeriodKeysUpdateResponse, error) { result := QuotaByPeriodKeysUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.QuotaCounterContract); err != nil { - return QuotaByPeriodKeysUpdateResponse{}, err + return QuotaByPeriodKeysUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_region_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_region_client.go index b097b67b5fa5..aa7ba87c1916 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_region_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_region_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RegionClient contains the methods for the Region group. @@ -30,8 +31,15 @@ type RegionClient struct { } // NewRegionClient creates a new instance of RegionClient with the specified values. -func NewRegionClient(con *arm.Connection, subscriptionID string) *RegionClient { - return &RegionClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRegionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RegionClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RegionClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByService - Lists all azure regions in which the service exists. @@ -68,7 +76,7 @@ func (client *RegionClient) listByServiceCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -78,7 +86,7 @@ func (client *RegionClient) listByServiceCreateRequest(ctx context.Context, reso func (client *RegionClient) listByServiceHandleResponse(resp *http.Response) (RegionListByServiceResponse, error) { result := RegionListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RegionListResult); err != nil { - return RegionListByServiceResponse{}, err + return RegionListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_reports_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_reports_client.go index de6b9d3b7bb9..9c785734b6ee 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_reports_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_reports_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // ReportsClient contains the methods for the Reports group. @@ -31,8 +32,15 @@ type ReportsClient struct { } // NewReportsClient creates a new instance of ReportsClient with the specified values. -func NewReportsClient(con *arm.Connection, subscriptionID string) *ReportsClient { - return &ReportsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewReportsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ReportsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ReportsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByAPI - Lists report records by API. @@ -79,7 +87,7 @@ func (client *ReportsClient) listByAPICreateRequest(ctx context.Context, resourc if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -89,7 +97,7 @@ func (client *ReportsClient) listByAPICreateRequest(ctx context.Context, resourc func (client *ReportsClient) listByAPIHandleResponse(resp *http.Response) (ReportsListByAPIResponse, error) { result := ReportsListByAPIResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReportCollection); err != nil { - return ReportsListByAPIResponse{}, err + return ReportsListByAPIResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -148,7 +156,7 @@ func (client *ReportsClient) listByGeoCreateRequest(ctx context.Context, resourc if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -158,7 +166,7 @@ func (client *ReportsClient) listByGeoCreateRequest(ctx context.Context, resourc func (client *ReportsClient) listByGeoHandleResponse(resp *http.Response) (ReportsListByGeoResponse, error) { result := ReportsListByGeoResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReportCollection); err != nil { - return ReportsListByGeoResponse{}, err + return ReportsListByGeoResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -220,7 +228,7 @@ func (client *ReportsClient) listByOperationCreateRequest(ctx context.Context, r if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -230,7 +238,7 @@ func (client *ReportsClient) listByOperationCreateRequest(ctx context.Context, r func (client *ReportsClient) listByOperationHandleResponse(resp *http.Response) (ReportsListByOperationResponse, error) { result := ReportsListByOperationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReportCollection); err != nil { - return ReportsListByOperationResponse{}, err + return ReportsListByOperationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -292,7 +300,7 @@ func (client *ReportsClient) listByProductCreateRequest(ctx context.Context, res if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -302,7 +310,7 @@ func (client *ReportsClient) listByProductCreateRequest(ctx context.Context, res func (client *ReportsClient) listByProductHandleResponse(resp *http.Response) (ReportsListByProductResponse, error) { result := ReportsListByProductResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReportCollection); err != nil { - return ReportsListByProductResponse{}, err + return ReportsListByProductResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -364,7 +372,7 @@ func (client *ReportsClient) listByRequestCreateRequest(ctx context.Context, res if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -374,7 +382,7 @@ func (client *ReportsClient) listByRequestCreateRequest(ctx context.Context, res func (client *ReportsClient) listByRequestHandleResponse(resp *http.Response) (ReportsListByRequestResponse, error) { result := ReportsListByRequestResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RequestReportCollection); err != nil { - return ReportsListByRequestResponse{}, err + return ReportsListByRequestResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -436,7 +444,7 @@ func (client *ReportsClient) listBySubscriptionCreateRequest(ctx context.Context if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -446,7 +454,7 @@ func (client *ReportsClient) listBySubscriptionCreateRequest(ctx context.Context func (client *ReportsClient) listBySubscriptionHandleResponse(resp *http.Response) (ReportsListBySubscriptionResponse, error) { result := ReportsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReportCollection); err != nil { - return ReportsListBySubscriptionResponse{}, err + return ReportsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -509,7 +517,7 @@ func (client *ReportsClient) listByTimeCreateRequest(ctx context.Context, resour reqQP.Set("$orderby", *options.Orderby) } reqQP.Set("interval", interval) - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -519,7 +527,7 @@ func (client *ReportsClient) listByTimeCreateRequest(ctx context.Context, resour func (client *ReportsClient) listByTimeHandleResponse(resp *http.Response) (ReportsListByTimeResponse, error) { result := ReportsListByTimeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReportCollection); err != nil { - return ReportsListByTimeResponse{}, err + return ReportsListByTimeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -581,7 +589,7 @@ func (client *ReportsClient) listByUserCreateRequest(ctx context.Context, resour if options != nil && options.Orderby != nil { reqQP.Set("$orderby", *options.Orderby) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -591,7 +599,7 @@ func (client *ReportsClient) listByUserCreateRequest(ctx context.Context, resour func (client *ReportsClient) listByUserHandleResponse(resp *http.Response) (ReportsListByUserResponse, error) { result := ReportsListByUserResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReportCollection); err != nil { - return ReportsListByUserResponse{}, err + return ReportsListByUserResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_response_types.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_response_types.go index a768992d2b1e..b8ea7fc8af19 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_response_types.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armapimanagement import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // APICreateOrUpdatePollerResponse contains the response from method API.CreateOrUpdate. @@ -26,6 +25,8 @@ type APICreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l APICreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (APICreateOrUpdateResponse, error) { respType := APICreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.APIContract) @@ -424,6 +425,8 @@ type APIManagementClientPerformConnectivityCheckAsyncPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l APIManagementClientPerformConnectivityCheckAsyncPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (APIManagementClientPerformConnectivityCheckAsyncResponse, error) { respType := APIManagementClientPerformConnectivityCheckAsyncResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ConnectivityCheckResponse) @@ -498,6 +501,8 @@ type APIManagementServiceApplyNetworkConfigurationUpdatesPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l APIManagementServiceApplyNetworkConfigurationUpdatesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (APIManagementServiceApplyNetworkConfigurationUpdatesResponse, error) { respType := APIManagementServiceApplyNetworkConfigurationUpdatesResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.APIManagementServiceResource) @@ -548,6 +553,8 @@ type APIManagementServiceBackupPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l APIManagementServiceBackupPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (APIManagementServiceBackupResponse, error) { respType := APIManagementServiceBackupResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.APIManagementServiceResource) @@ -610,6 +617,8 @@ type APIManagementServiceCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l APIManagementServiceCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (APIManagementServiceCreateOrUpdateResponse, error) { respType := APIManagementServiceCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.APIManagementServiceResource) @@ -660,6 +669,8 @@ type APIManagementServiceDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l APIManagementServiceDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (APIManagementServiceDeleteResponse, error) { respType := APIManagementServiceDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.APIManagementServiceResource) @@ -770,6 +781,8 @@ type APIManagementServiceRestorePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l APIManagementServiceRestorePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (APIManagementServiceRestoreResponse, error) { respType := APIManagementServiceRestoreResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.APIManagementServiceResource) @@ -832,6 +845,8 @@ type APIManagementServiceUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l APIManagementServiceUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (APIManagementServiceUpdateResponse, error) { respType := APIManagementServiceUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.APIManagementServiceResource) @@ -1182,6 +1197,8 @@ type APISchemaCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l APISchemaCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (APISchemaCreateOrUpdateResponse, error) { respType := APISchemaCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SchemaContract) @@ -1948,6 +1965,8 @@ type DeletedServicesPurgePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeletedServicesPurgePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeletedServicesPurgeResponse, error) { respType := DeletedServicesPurgeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DeletedServiceContract) @@ -2737,6 +2756,8 @@ type NamedValueCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NamedValueCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NamedValueCreateOrUpdateResponse, error) { respType := NamedValueCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.NamedValueContract) @@ -2849,6 +2870,8 @@ type NamedValueRefreshSecretPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NamedValueRefreshSecretPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NamedValueRefreshSecretResponse, error) { respType := NamedValueRefreshSecretResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.NamedValueContract) @@ -2899,6 +2922,8 @@ type NamedValueUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NamedValueUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NamedValueUpdateResponse, error) { respType := NamedValueUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.NamedValueContract) @@ -3284,6 +3309,8 @@ type PortalRevisionCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PortalRevisionCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PortalRevisionCreateOrUpdateResponse, error) { respType := PortalRevisionCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PortalRevisionContract) @@ -3376,6 +3403,8 @@ type PortalRevisionUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PortalRevisionUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PortalRevisionUpdateResponse, error) { respType := PortalRevisionUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PortalRevisionContract) @@ -3438,6 +3467,8 @@ type PrivateEndpointConnectionCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionCreateOrUpdateResponse, error) { respType := PrivateEndpointConnectionCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) @@ -3488,6 +3519,8 @@ type PrivateEndpointConnectionDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionDeleteResponse, error) { respType := PrivateEndpointConnectionDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4560,6 +4593,8 @@ type TenantConfigurationDeployPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TenantConfigurationDeployPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TenantConfigurationDeployResponse, error) { respType := TenantConfigurationDeployResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.OperationResultContract) @@ -4622,6 +4657,8 @@ type TenantConfigurationSavePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TenantConfigurationSavePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TenantConfigurationSaveResponse, error) { respType := TenantConfigurationSaveResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.OperationResultContract) @@ -4672,6 +4709,8 @@ type TenantConfigurationValidatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TenantConfigurationValidatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TenantConfigurationValidateResponse, error) { respType := TenantConfigurationValidateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.OperationResultContract) diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_signinsettings_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_signinsettings_client.go index 76e7b3494dc2..efe071c8a81b 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_signinsettings_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_signinsettings_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SignInSettingsClient contains the methods for the SignInSettings group. @@ -30,8 +31,15 @@ type SignInSettingsClient struct { } // NewSignInSettingsClient creates a new instance of SignInSettingsClient with the specified values. -func NewSignInSettingsClient(con *arm.Connection, subscriptionID string) *SignInSettingsClient { - return &SignInSettingsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSignInSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SignInSettingsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SignInSettingsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or Update Sign-In settings. @@ -71,7 +79,7 @@ func (client *SignInSettingsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -84,7 +92,7 @@ func (client *SignInSettingsClient) createOrUpdateCreateRequest(ctx context.Cont func (client *SignInSettingsClient) createOrUpdateHandleResponse(resp *http.Response) (SignInSettingsCreateOrUpdateResponse, error) { result := SignInSettingsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PortalSigninSettings); err != nil { - return SignInSettingsCreateOrUpdateResponse{}, err + return SignInSettingsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -139,7 +147,7 @@ func (client *SignInSettingsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -152,7 +160,7 @@ func (client *SignInSettingsClient) getHandleResponse(resp *http.Response) (Sign result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.PortalSigninSettings); err != nil { - return SignInSettingsGetResponse{}, err + return SignInSettingsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -204,7 +212,7 @@ func (client *SignInSettingsClient) getEntityTagCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -259,7 +267,7 @@ func (client *SignInSettingsClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_signupsettings_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_signupsettings_client.go index ab0fc2762dee..abefcbecb34b 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_signupsettings_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_signupsettings_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SignUpSettingsClient contains the methods for the SignUpSettings group. @@ -30,8 +31,15 @@ type SignUpSettingsClient struct { } // NewSignUpSettingsClient creates a new instance of SignUpSettingsClient with the specified values. -func NewSignUpSettingsClient(con *arm.Connection, subscriptionID string) *SignUpSettingsClient { - return &SignUpSettingsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSignUpSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SignUpSettingsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SignUpSettingsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or Update Sign-Up settings. @@ -71,7 +79,7 @@ func (client *SignUpSettingsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -84,7 +92,7 @@ func (client *SignUpSettingsClient) createOrUpdateCreateRequest(ctx context.Cont func (client *SignUpSettingsClient) createOrUpdateHandleResponse(resp *http.Response) (SignUpSettingsCreateOrUpdateResponse, error) { result := SignUpSettingsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PortalSignupSettings); err != nil { - return SignUpSettingsCreateOrUpdateResponse{}, err + return SignUpSettingsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -139,7 +147,7 @@ func (client *SignUpSettingsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -152,7 +160,7 @@ func (client *SignUpSettingsClient) getHandleResponse(resp *http.Response) (Sign result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.PortalSignupSettings); err != nil { - return SignUpSettingsGetResponse{}, err + return SignUpSettingsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -204,7 +212,7 @@ func (client *SignUpSettingsClient) getEntityTagCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -259,7 +267,7 @@ func (client *SignUpSettingsClient) updateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_subscription_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_subscription_client.go index 4b733ed35785..71475476f907 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_subscription_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_subscription_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // SubscriptionClient contains the methods for the Subscription group. @@ -31,8 +32,15 @@ type SubscriptionClient struct { } // NewSubscriptionClient creates a new instance of SubscriptionClient with the specified values. -func NewSubscriptionClient(con *arm.Connection, subscriptionID string) *SubscriptionClient { - return &SubscriptionClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSubscriptionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SubscriptionClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SubscriptionClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the subscription of specified user to the specified product. @@ -79,7 +87,7 @@ func (client *SubscriptionClient) createOrUpdateCreateRequest(ctx context.Contex if options != nil && options.Notify != nil { reqQP.Set("notify", strconv.FormatBool(*options.Notify)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") if options != nil && options.AppType != nil { reqQP.Set("appType", string(*options.AppType)) } @@ -98,7 +106,7 @@ func (client *SubscriptionClient) createOrUpdateHandleResponse(resp *http.Respon result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionContract); err != nil { - return SubscriptionCreateOrUpdateResponse{}, err + return SubscriptionCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -157,7 +165,7 @@ func (client *SubscriptionClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -218,7 +226,7 @@ func (client *SubscriptionClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -231,7 +239,7 @@ func (client *SubscriptionClient) getHandleResponse(resp *http.Response) (Subscr result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionContract); err != nil { - return SubscriptionGetResponse{}, err + return SubscriptionGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -287,7 +295,7 @@ func (client *SubscriptionClient) getEntityTagCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -348,7 +356,7 @@ func (client *SubscriptionClient) listCreateRequest(ctx context.Context, resourc if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -358,7 +366,7 @@ func (client *SubscriptionClient) listCreateRequest(ctx context.Context, resourc func (client *SubscriptionClient) listHandleResponse(resp *http.Response) (SubscriptionListResponse, error) { result := SubscriptionListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionCollection); err != nil { - return SubscriptionListResponse{}, err + return SubscriptionListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -417,7 +425,7 @@ func (client *SubscriptionClient) listSecretsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -430,7 +438,7 @@ func (client *SubscriptionClient) listSecretsHandleResponse(resp *http.Response) result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionKeysContract); err != nil { - return SubscriptionListSecretsResponse{}, err + return SubscriptionListSecretsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -489,7 +497,7 @@ func (client *SubscriptionClient) regeneratePrimaryKeyCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -549,7 +557,7 @@ func (client *SubscriptionClient) regenerateSecondaryKeyCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -612,7 +620,7 @@ func (client *SubscriptionClient) updateCreateRequest(ctx context.Context, resou if options != nil && options.Notify != nil { reqQP.Set("notify", strconv.FormatBool(*options.Notify)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") if options != nil && options.AppType != nil { reqQP.Set("appType", string(*options.AppType)) } @@ -629,7 +637,7 @@ func (client *SubscriptionClient) updateHandleResponse(resp *http.Response) (Sub result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionContract); err != nil { - return SubscriptionUpdateResponse{}, err + return SubscriptionUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tag_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tag_client.go index 3c733775662f..5bd53a241bd2 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tag_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tag_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // TagClient contains the methods for the Tag group. @@ -31,8 +32,15 @@ type TagClient struct { } // NewTagClient creates a new instance of TagClient with the specified values. -func NewTagClient(con *arm.Connection, subscriptionID string) *TagClient { - return &TagClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTagClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TagClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TagClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // AssignToAPI - Assign tag to the Api. @@ -80,7 +88,7 @@ func (client *TagClient) assignToAPICreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -93,7 +101,7 @@ func (client *TagClient) assignToAPIHandleResponse(resp *http.Response) (TagAssi result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.TagContract); err != nil { - return TagAssignToAPIResponse{}, err + return TagAssignToAPIResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -160,7 +168,7 @@ func (client *TagClient) assignToOperationCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -170,7 +178,7 @@ func (client *TagClient) assignToOperationCreateRequest(ctx context.Context, res func (client *TagClient) assignToOperationHandleResponse(resp *http.Response) (TagAssignToOperationResponse, error) { result := TagAssignToOperationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TagContract); err != nil { - return TagAssignToOperationResponse{}, err + return TagAssignToOperationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -233,7 +241,7 @@ func (client *TagClient) assignToProductCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -243,7 +251,7 @@ func (client *TagClient) assignToProductCreateRequest(ctx context.Context, resou func (client *TagClient) assignToProductHandleResponse(resp *http.Response) (TagAssignToProductResponse, error) { result := TagAssignToProductResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TagContract); err != nil { - return TagAssignToProductResponse{}, err + return TagAssignToProductResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -302,7 +310,7 @@ func (client *TagClient) createOrUpdateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -318,7 +326,7 @@ func (client *TagClient) createOrUpdateHandleResponse(resp *http.Response) (TagC result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.TagContract); err != nil { - return TagCreateOrUpdateResponse{}, err + return TagCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -377,7 +385,7 @@ func (client *TagClient) deleteCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -442,7 +450,7 @@ func (client *TagClient) detachFromAPICreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -510,7 +518,7 @@ func (client *TagClient) detachFromOperationCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -574,7 +582,7 @@ func (client *TagClient) detachFromProductCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -634,7 +642,7 @@ func (client *TagClient) getCreateRequest(ctx context.Context, resourceGroupName return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -647,7 +655,7 @@ func (client *TagClient) getHandleResponse(resp *http.Response) (TagGetResponse, result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.TagContract); err != nil { - return TagGetResponse{}, err + return TagGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -710,7 +718,7 @@ func (client *TagClient) getByAPICreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -723,7 +731,7 @@ func (client *TagClient) getByAPIHandleResponse(resp *http.Response) (TagGetByAP result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.TagContract); err != nil { - return TagGetByAPIResponse{}, err + return TagGetByAPIResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -790,7 +798,7 @@ func (client *TagClient) getByOperationCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -803,7 +811,7 @@ func (client *TagClient) getByOperationHandleResponse(resp *http.Response) (TagG result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.TagContract); err != nil { - return TagGetByOperationResponse{}, err + return TagGetByOperationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -866,7 +874,7 @@ func (client *TagClient) getByProductCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -879,7 +887,7 @@ func (client *TagClient) getByProductHandleResponse(resp *http.Response) (TagGet result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.TagContract); err != nil { - return TagGetByProductResponse{}, err + return TagGetByProductResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -935,7 +943,7 @@ func (client *TagClient) getEntityStateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -995,7 +1003,7 @@ func (client *TagClient) getEntityStateByAPICreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1059,7 +1067,7 @@ func (client *TagClient) getEntityStateByOperationCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1119,7 +1127,7 @@ func (client *TagClient) getEntityStateByProductCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1184,7 +1192,7 @@ func (client *TagClient) listByAPICreateRequest(ctx context.Context, resourceGro if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1194,7 +1202,7 @@ func (client *TagClient) listByAPICreateRequest(ctx context.Context, resourceGro func (client *TagClient) listByAPIHandleResponse(resp *http.Response) (TagListByAPIResponse, error) { result := TagListByAPIResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TagCollection); err != nil { - return TagListByAPIResponse{}, err + return TagListByAPIResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1263,7 +1271,7 @@ func (client *TagClient) listByOperationCreateRequest(ctx context.Context, resou if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1273,7 +1281,7 @@ func (client *TagClient) listByOperationCreateRequest(ctx context.Context, resou func (client *TagClient) listByOperationHandleResponse(resp *http.Response) (TagListByOperationResponse, error) { result := TagListByOperationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TagCollection); err != nil { - return TagListByOperationResponse{}, err + return TagListByOperationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1338,7 +1346,7 @@ func (client *TagClient) listByProductCreateRequest(ctx context.Context, resourc if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1348,7 +1356,7 @@ func (client *TagClient) listByProductCreateRequest(ctx context.Context, resourc func (client *TagClient) listByProductHandleResponse(resp *http.Response) (TagListByProductResponse, error) { result := TagListByProductResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TagCollection); err != nil { - return TagListByProductResponse{}, err + return TagListByProductResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1412,7 +1420,7 @@ func (client *TagClient) listByServiceCreateRequest(ctx context.Context, resourc if options != nil && options.Scope != nil { reqQP.Set("scope", *options.Scope) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1422,7 +1430,7 @@ func (client *TagClient) listByServiceCreateRequest(ctx context.Context, resourc func (client *TagClient) listByServiceHandleResponse(resp *http.Response) (TagListByServiceResponse, error) { result := TagListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TagCollection); err != nil { - return TagListByServiceResponse{}, err + return TagListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1481,7 +1489,7 @@ func (client *TagClient) updateCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -1495,7 +1503,7 @@ func (client *TagClient) updateHandleResponse(resp *http.Response) (TagUpdateRes result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.TagContract); err != nil { - return TagUpdateResponse{}, err + return TagUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tagresource_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tagresource_client.go index c4694807565b..8b109d707601 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tagresource_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tagresource_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // TagResourceClient contains the methods for the TagResource group. @@ -31,8 +32,15 @@ type TagResourceClient struct { } // NewTagResourceClient creates a new instance of TagResourceClient with the specified values. -func NewTagResourceClient(con *arm.Connection, subscriptionID string) *TagResourceClient { - return &TagResourceClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTagResourceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TagResourceClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TagResourceClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByService - Lists a collection of resources associated with tags. @@ -78,7 +86,7 @@ func (client *TagResourceClient) listByServiceCreateRequest(ctx context.Context, if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -88,7 +96,7 @@ func (client *TagResourceClient) listByServiceCreateRequest(ctx context.Context, func (client *TagResourceClient) listByServiceHandleResponse(resp *http.Response) (TagResourceListByServiceResponse, error) { result := TagResourceListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TagResourceCollection); err != nil { - return TagResourceListByServiceResponse{}, err + return TagResourceListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tenantaccess_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tenantaccess_client.go index 0e4b223b716e..885a4f6b74ac 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tenantaccess_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tenantaccess_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TenantAccessClient contains the methods for the TenantAccess group. @@ -30,8 +31,15 @@ type TenantAccessClient struct { } // NewTenantAccessClient creates a new instance of TenantAccessClient with the specified values. -func NewTenantAccessClient(con *arm.Connection, subscriptionID string) *TenantAccessClient { - return &TenantAccessClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTenantAccessClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TenantAccessClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TenantAccessClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Update tenant access information details. @@ -75,7 +83,7 @@ func (client *TenantAccessClient) createCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -89,7 +97,7 @@ func (client *TenantAccessClient) createHandleResponse(resp *http.Response) (Ten result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.AccessInformationContract); err != nil { - return TenantAccessCreateResponse{}, err + return TenantAccessCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -148,7 +156,7 @@ func (client *TenantAccessClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -161,7 +169,7 @@ func (client *TenantAccessClient) getHandleResponse(resp *http.Response) (Tenant result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.AccessInformationContract); err != nil { - return TenantAccessGetResponse{}, err + return TenantAccessGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -217,7 +225,7 @@ func (client *TenantAccessClient) getEntityTagCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -272,7 +280,7 @@ func (client *TenantAccessClient) listByServiceCreateRequest(ctx context.Context if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -282,7 +290,7 @@ func (client *TenantAccessClient) listByServiceCreateRequest(ctx context.Context func (client *TenantAccessClient) listByServiceHandleResponse(resp *http.Response) (TenantAccessListByServiceResponse, error) { result := TenantAccessListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessInformationCollection); err != nil { - return TenantAccessListByServiceResponse{}, err + return TenantAccessListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -341,7 +349,7 @@ func (client *TenantAccessClient) listSecretsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -354,7 +362,7 @@ func (client *TenantAccessClient) listSecretsHandleResponse(resp *http.Response) result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.AccessInformationSecretsContract); err != nil { - return TenantAccessListSecretsResponse{}, err + return TenantAccessListSecretsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -413,7 +421,7 @@ func (client *TenantAccessClient) regeneratePrimaryKeyCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -473,7 +481,7 @@ func (client *TenantAccessClient) regenerateSecondaryKeyCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -533,7 +541,7 @@ func (client *TenantAccessClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -547,7 +555,7 @@ func (client *TenantAccessClient) updateHandleResponse(resp *http.Response) (Ten result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.AccessInformationContract); err != nil { - return TenantAccessUpdateResponse{}, err + return TenantAccessUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tenantaccessgit_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tenantaccessgit_client.go index 73483c168aac..0f59c590da7b 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tenantaccessgit_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tenantaccessgit_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TenantAccessGitClient contains the methods for the TenantAccessGit group. @@ -30,8 +31,15 @@ type TenantAccessGitClient struct { } // NewTenantAccessGitClient creates a new instance of TenantAccessGitClient with the specified values. -func NewTenantAccessGitClient(con *arm.Connection, subscriptionID string) *TenantAccessGitClient { - return &TenantAccessGitClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTenantAccessGitClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TenantAccessGitClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TenantAccessGitClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // RegeneratePrimaryKey - Regenerate primary access key for GIT. @@ -75,7 +83,7 @@ func (client *TenantAccessGitClient) regeneratePrimaryKeyCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -135,7 +143,7 @@ func (client *TenantAccessGitClient) regenerateSecondaryKeyCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tenantconfiguration_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tenantconfiguration_client.go index a72f25602f88..797af2aa442b 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tenantconfiguration_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tenantconfiguration_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TenantConfigurationClient contains the methods for the TenantConfiguration group. @@ -31,8 +31,15 @@ type TenantConfigurationClient struct { } // NewTenantConfigurationClient creates a new instance of TenantConfigurationClient with the specified values. -func NewTenantConfigurationClient(con *arm.Connection, subscriptionID string) *TenantConfigurationClient { - return &TenantConfigurationClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTenantConfigurationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TenantConfigurationClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TenantConfigurationClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginDeploy - This operation applies changes from the specified Git branch to the configuration database. This is a long running operation and could @@ -98,7 +105,7 @@ func (client *TenantConfigurationClient) deployCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -158,7 +165,7 @@ func (client *TenantConfigurationClient) getSyncStateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -168,7 +175,7 @@ func (client *TenantConfigurationClient) getSyncStateCreateRequest(ctx context.C func (client *TenantConfigurationClient) getSyncStateHandleResponse(resp *http.Response) (TenantConfigurationGetSyncStateResponse, error) { result := TenantConfigurationGetSyncStateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TenantConfigurationSyncStateContract); err != nil { - return TenantConfigurationGetSyncStateResponse{}, err + return TenantConfigurationGetSyncStateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -249,7 +256,7 @@ func (client *TenantConfigurationClient) saveCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -330,7 +337,7 @@ func (client *TenantConfigurationClient) validateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tenantsettings_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tenantsettings_client.go index f04fa9b96fce..9dea61abc6a8 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tenantsettings_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_tenantsettings_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TenantSettingsClient contains the methods for the TenantSettings group. @@ -30,8 +31,15 @@ type TenantSettingsClient struct { } // NewTenantSettingsClient creates a new instance of TenantSettingsClient with the specified values. -func NewTenantSettingsClient(con *arm.Connection, subscriptionID string) *TenantSettingsClient { - return &TenantSettingsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTenantSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TenantSettingsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TenantSettingsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get tenant settings. @@ -75,7 +83,7 @@ func (client *TenantSettingsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -88,7 +96,7 @@ func (client *TenantSettingsClient) getHandleResponse(resp *http.Response) (Tena result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.TenantSettingsContract); err != nil { - return TenantSettingsGetResponse{}, err + return TenantSettingsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -143,7 +151,7 @@ func (client *TenantSettingsClient) listByServiceCreateRequest(ctx context.Conte if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -153,7 +161,7 @@ func (client *TenantSettingsClient) listByServiceCreateRequest(ctx context.Conte func (client *TenantSettingsClient) listByServiceHandleResponse(resp *http.Response) (TenantSettingsListByServiceResponse, error) { result := TenantSettingsListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TenantSettingsCollection); err != nil { - return TenantSettingsListByServiceResponse{}, err + return TenantSettingsListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_time_rfc3339.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_time_rfc3339.go index dff7f6d34f39..e26f0669e448 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armapimanagement import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_user_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_user_client.go index f41c679756ca..2c7708f54768 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_user_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_user_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // UserClient contains the methods for the User group. @@ -31,8 +32,15 @@ type UserClient struct { } // NewUserClient creates a new instance of UserClient with the specified values. -func NewUserClient(con *arm.Connection, subscriptionID string) *UserClient { - return &UserClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewUserClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UserClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &UserClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or Updates a user. @@ -79,7 +87,7 @@ func (client *UserClient) createOrUpdateCreateRequest(ctx context.Context, resou if options != nil && options.Notify != nil { reqQP.Set("notify", strconv.FormatBool(*options.Notify)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() if options != nil && options.IfMatch != nil { req.Raw().Header.Set("If-Match", *options.IfMatch) @@ -95,7 +103,7 @@ func (client *UserClient) createOrUpdateHandleResponse(resp *http.Response) (Use result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.UserContract); err != nil { - return UserCreateOrUpdateResponse{}, err + return UserCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -160,7 +168,7 @@ func (client *UserClient) deleteCreateRequest(ctx context.Context, resourceGroup if options != nil && options.Notify != nil { reqQP.Set("notify", strconv.FormatBool(*options.Notify)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") if options != nil && options.AppType != nil { reqQP.Set("appType", string(*options.AppType)) } @@ -224,7 +232,7 @@ func (client *UserClient) generateSsoURLCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +242,7 @@ func (client *UserClient) generateSsoURLCreateRequest(ctx context.Context, resou func (client *UserClient) generateSsoURLHandleResponse(resp *http.Response) (UserGenerateSsoURLResponse, error) { result := UserGenerateSsoURLResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GenerateSsoURLResult); err != nil { - return UserGenerateSsoURLResponse{}, err + return UserGenerateSsoURLResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -293,7 +301,7 @@ func (client *UserClient) getCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -306,7 +314,7 @@ func (client *UserClient) getHandleResponse(resp *http.Response) (UserGetRespons result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.UserContract); err != nil { - return UserGetResponse{}, err + return UserGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -362,7 +370,7 @@ func (client *UserClient) getEntityTagCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -421,7 +429,7 @@ func (client *UserClient) getSharedAccessTokenCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -431,7 +439,7 @@ func (client *UserClient) getSharedAccessTokenCreateRequest(ctx context.Context, func (client *UserClient) getSharedAccessTokenHandleResponse(resp *http.Response) (UserGetSharedAccessTokenResponse, error) { result := UserGetSharedAccessTokenResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UserTokenResult); err != nil { - return UserGetSharedAccessTokenResponse{}, err + return UserGetSharedAccessTokenResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -495,7 +503,7 @@ func (client *UserClient) listByServiceCreateRequest(ctx context.Context, resour if options != nil && options.ExpandGroups != nil { reqQP.Set("expandGroups", strconv.FormatBool(*options.ExpandGroups)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -505,7 +513,7 @@ func (client *UserClient) listByServiceCreateRequest(ctx context.Context, resour func (client *UserClient) listByServiceHandleResponse(resp *http.Response) (UserListByServiceResponse, error) { result := UserListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UserCollection); err != nil { - return UserListByServiceResponse{}, err + return UserListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -564,7 +572,7 @@ func (client *UserClient) updateCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("If-Match", ifMatch) req.Raw().Header.Set("Accept", "application/json") @@ -578,7 +586,7 @@ func (client *UserClient) updateHandleResponse(resp *http.Response) (UserUpdateR result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.UserContract); err != nil { - return UserUpdateResponse{}, err + return UserUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_userconfirmationpassword_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_userconfirmationpassword_client.go index 262c2f92c08d..9cb66d1262c1 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_userconfirmationpassword_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_userconfirmationpassword_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // UserConfirmationPasswordClient contains the methods for the UserConfirmationPassword group. @@ -30,8 +31,15 @@ type UserConfirmationPasswordClient struct { } // NewUserConfirmationPasswordClient creates a new instance of UserConfirmationPasswordClient with the specified values. -func NewUserConfirmationPasswordClient(con *arm.Connection, subscriptionID string) *UserConfirmationPasswordClient { - return &UserConfirmationPasswordClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewUserConfirmationPasswordClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UserConfirmationPasswordClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &UserConfirmationPasswordClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Send - Sends confirmation @@ -75,7 +83,7 @@ func (client *UserConfirmationPasswordClient) sendCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") if options != nil && options.AppType != nil { reqQP.Set("appType", string(*options.AppType)) } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_usergroup_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_usergroup_client.go index 702bf66a1a53..ddf8bc246828 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_usergroup_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_usergroup_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // UserGroupClient contains the methods for the UserGroup group. @@ -31,8 +32,15 @@ type UserGroupClient struct { } // NewUserGroupClient creates a new instance of UserGroupClient with the specified values. -func NewUserGroupClient(con *arm.Connection, subscriptionID string) *UserGroupClient { - return &UserGroupClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewUserGroupClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UserGroupClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &UserGroupClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all user groups. @@ -82,7 +90,7 @@ func (client *UserGroupClient) listCreateRequest(ctx context.Context, resourceGr if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -92,7 +100,7 @@ func (client *UserGroupClient) listCreateRequest(ctx context.Context, resourceGr func (client *UserGroupClient) listHandleResponse(resp *http.Response) (UserGroupListResponse, error) { result := UserGroupListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GroupCollection); err != nil { - return UserGroupListResponse{}, err + return UserGroupListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_useridentities_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_useridentities_client.go index 32e26742761d..9cedba884dae 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_useridentities_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_useridentities_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // UserIdentitiesClient contains the methods for the UserIdentities group. @@ -30,8 +31,15 @@ type UserIdentitiesClient struct { } // NewUserIdentitiesClient creates a new instance of UserIdentitiesClient with the specified values. -func NewUserIdentitiesClient(con *arm.Connection, subscriptionID string) *UserIdentitiesClient { - return &UserIdentitiesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewUserIdentitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UserIdentitiesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &UserIdentitiesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - List of all user identities. @@ -72,7 +80,7 @@ func (client *UserIdentitiesClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -82,7 +90,7 @@ func (client *UserIdentitiesClient) listCreateRequest(ctx context.Context, resou func (client *UserIdentitiesClient) listHandleResponse(resp *http.Response) (UserIdentitiesListResponse, error) { result := UserIdentitiesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UserIdentityCollection); err != nil { - return UserIdentitiesListResponse{}, err + return UserIdentitiesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_usersubscription_client.go b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_usersubscription_client.go index fdc3b928f2ed..b5dacee63344 100644 --- a/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_usersubscription_client.go +++ b/sdk/resourcemanager/apimanagement/armapimanagement/zz_generated_usersubscription_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // UserSubscriptionClient contains the methods for the UserSubscription group. @@ -31,8 +32,15 @@ type UserSubscriptionClient struct { } // NewUserSubscriptionClient creates a new instance of UserSubscriptionClient with the specified values. -func NewUserSubscriptionClient(con *arm.Connection, subscriptionID string) *UserSubscriptionClient { - return &UserSubscriptionClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewUserSubscriptionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UserSubscriptionClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &UserSubscriptionClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the specified Subscription entity associated with a particular user. @@ -80,7 +88,7 @@ func (client *UserSubscriptionClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -93,7 +101,7 @@ func (client *UserSubscriptionClient) getHandleResponse(resp *http.Response) (Us result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionContract); err != nil { - return UserSubscriptionGetResponse{}, err + return UserSubscriptionGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -158,7 +166,7 @@ func (client *UserSubscriptionClient) listCreateRequest(ctx context.Context, res if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } - reqQP.Set("api-version", "2021-04-01-preview") + reqQP.Set("api-version", "2021-08-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -168,7 +176,7 @@ func (client *UserSubscriptionClient) listCreateRequest(ctx context.Context, res func (client *UserSubscriptionClient) listHandleResponse(resp *http.Response) (UserSubscriptionListResponse, error) { result := UserSubscriptionListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionCollection); err != nil { - return UserSubscriptionListResponse{}, err + return UserSubscriptionListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/appplatform/armappplatform/CHANGELOG.md b/sdk/resourcemanager/appplatform/armappplatform/CHANGELOG.md index 2276a757fdd8..626bf7231e27 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/CHANGELOG.md +++ b/sdk/resourcemanager/appplatform/armappplatform/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-20) diff --git a/sdk/resourcemanager/appplatform/armappplatform/README.md b/sdk/resourcemanager/appplatform/armappplatform/README.md index b60d1935692e..734b413f945c 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/README.md +++ b/sdk/resourcemanager/appplatform/armappplatform/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure App Platform +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure App Platform modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armappplatform.NewSKUsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure App Platform modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armappplatform.NewSKUsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armappplatform.NewSKUsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/appplatform/armappplatform/autorest.md b/sdk/resourcemanager/appplatform/armappplatform/autorest.md index da4e074660fa..df465eb67d23 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/autorest.md +++ b/sdk/resourcemanager/appplatform/armappplatform/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/3eaa729b3686f20817145e771a8ab707c739dbbd/specification/appplatform/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/3eaa729b3686f20817145e771a8ab707c739dbbd/specification/appplatform/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/appplatform/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/appplatform/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/appplatform/armappplatform/go.mod b/sdk/resourcemanager/appplatform/armappplatform/go.mod index cbe0741dc952..29441f1e1f2f 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/go.mod +++ b/sdk/resourcemanager/appplatform/armappplatform/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/appplatform/armappp go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.1.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/appplatform/armappplatform/go.sum b/sdk/resourcemanager/appplatform/armappplatform/go.sum index f37ba2aef08b..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/go.sum +++ b/sdk/resourcemanager/appplatform/armappplatform/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible h1:WFsr3Efy7uweykOAEfOHO3ACtuwIv+rrFmSn9K48VnA= -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_apps_client.go b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_apps_client.go index e17278c82999..53ac69733e8a 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_apps_client.go +++ b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_apps_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AppsClient contains the methods for the Apps group. @@ -31,8 +31,15 @@ type AppsClient struct { } // NewAppsClient creates a new instance of AppsClient with the specified values. -func NewAppsClient(con *arm.Connection, subscriptionID string) *AppsClient { - return &AppsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAppsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AppsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AppsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create a new App or update an exiting App. @@ -96,7 +103,7 @@ func (client *AppsClient) createOrUpdateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, appResource) @@ -176,7 +183,7 @@ func (client *AppsClient) deleteCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *AppsClient) getCreateRequest(ctx context.Context, resourceGroupNam return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") if options != nil && options.SyncStatus != nil { reqQP.Set("syncStatus", *options.SyncStatus) } @@ -249,7 +256,7 @@ func (client *AppsClient) getCreateRequest(ctx context.Context, resourceGroupNam func (client *AppsClient) getHandleResponse(resp *http.Response) (AppsGetResponse, error) { result := AppsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AppResource); err != nil { - return AppsGetResponse{}, err + return AppsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -308,7 +315,7 @@ func (client *AppsClient) getResourceUploadURLCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -318,7 +325,7 @@ func (client *AppsClient) getResourceUploadURLCreateRequest(ctx context.Context, func (client *AppsClient) getResourceUploadURLHandleResponse(resp *http.Response) (AppsGetResourceUploadURLResponse, error) { result := AppsGetResourceUploadURLResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceUploadDefinition); err != nil { - return AppsGetResourceUploadURLResponse{}, err + return AppsGetResourceUploadURLResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -370,7 +377,7 @@ func (client *AppsClient) listCreateRequest(ctx context.Context, resourceGroupNa return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -380,7 +387,7 @@ func (client *AppsClient) listCreateRequest(ctx context.Context, resourceGroupNa func (client *AppsClient) listHandleResponse(resp *http.Response) (AppsListResponse, error) { result := AppsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AppResourceCollection); err != nil { - return AppsListResponse{}, err + return AppsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -459,7 +466,7 @@ func (client *AppsClient) updateCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, appResource) @@ -519,7 +526,7 @@ func (client *AppsClient) validateDomainCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, validatePayload) @@ -529,7 +536,7 @@ func (client *AppsClient) validateDomainCreateRequest(ctx context.Context, resou func (client *AppsClient) validateDomainHandleResponse(resp *http.Response) (AppsValidateDomainResponse, error) { result := AppsValidateDomainResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CustomDomainValidateResult); err != nil { - return AppsValidateDomainResponse{}, err + return AppsValidateDomainResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_bindings_client.go b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_bindings_client.go index 409b8d9a334b..fbef3082e1fc 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_bindings_client.go +++ b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_bindings_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // BindingsClient contains the methods for the Bindings group. @@ -31,8 +31,15 @@ type BindingsClient struct { } // NewBindingsClient creates a new instance of BindingsClient with the specified values. -func NewBindingsClient(con *arm.Connection, subscriptionID string) *BindingsClient { - return &BindingsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewBindingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *BindingsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &BindingsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create a new Binding or update an exiting Binding. @@ -100,7 +107,7 @@ func (client *BindingsClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, bindingResource) @@ -184,7 +191,7 @@ func (client *BindingsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -248,7 +255,7 @@ func (client *BindingsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -258,7 +265,7 @@ func (client *BindingsClient) getCreateRequest(ctx context.Context, resourceGrou func (client *BindingsClient) getHandleResponse(resp *http.Response) (BindingsGetResponse, error) { result := BindingsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BindingResource); err != nil { - return BindingsGetResponse{}, err + return BindingsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -314,7 +321,7 @@ func (client *BindingsClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -324,7 +331,7 @@ func (client *BindingsClient) listCreateRequest(ctx context.Context, resourceGro func (client *BindingsClient) listHandleResponse(resp *http.Response) (BindingsListResponse, error) { result := BindingsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BindingResourceCollection); err != nil { - return BindingsListResponse{}, err + return BindingsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -407,7 +414,7 @@ func (client *BindingsClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, bindingResource) diff --git a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_certificates_client.go b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_certificates_client.go index 885c6f6695c6..d41994e145cf 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_certificates_client.go +++ b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_certificates_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CertificatesClient contains the methods for the Certificates group. @@ -31,8 +31,15 @@ type CertificatesClient struct { } // NewCertificatesClient creates a new instance of CertificatesClient with the specified values. -func NewCertificatesClient(con *arm.Connection, subscriptionID string) *CertificatesClient { - return &CertificatesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CertificatesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CertificatesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update certificate resource. @@ -96,7 +103,7 @@ func (client *CertificatesClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, certificateResource) @@ -176,7 +183,7 @@ func (client *CertificatesClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *CertificatesClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *CertificatesClient) getCreateRequest(ctx context.Context, resource func (client *CertificatesClient) getHandleResponse(resp *http.Response) (CertificatesGetResponse, error) { result := CertificatesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CertificateResource); err != nil { - return CertificatesGetResponse{}, err + return CertificatesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *CertificatesClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *CertificatesClient) listCreateRequest(ctx context.Context, resourc func (client *CertificatesClient) listHandleResponse(resp *http.Response) (CertificatesListResponse, error) { result := CertificatesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CertificateResourceCollection); err != nil { - return CertificatesListResponse{}, err + return CertificatesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_configservers_client.go b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_configservers_client.go index 70d2ba1041d0..2af2c9731834 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_configservers_client.go +++ b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_configservers_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ConfigServersClient contains the methods for the ConfigServers group. @@ -31,8 +31,15 @@ type ConfigServersClient struct { } // NewConfigServersClient creates a new instance of ConfigServersClient with the specified values. -func NewConfigServersClient(con *arm.Connection, subscriptionID string) *ConfigServersClient { - return &ConfigServersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewConfigServersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ConfigServersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ConfigServersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get the config server and its properties. @@ -72,7 +79,7 @@ func (client *ConfigServersClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -82,7 +89,7 @@ func (client *ConfigServersClient) getCreateRequest(ctx context.Context, resourc func (client *ConfigServersClient) getHandleResponse(resp *http.Response) (ConfigServersGetResponse, error) { result := ConfigServersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConfigServerResource); err != nil { - return ConfigServersGetResponse{}, err + return ConfigServersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -157,7 +164,7 @@ func (client *ConfigServersClient) updatePatchCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, configServerResource) @@ -233,7 +240,7 @@ func (client *ConfigServersClient) updatePutCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, configServerResource) @@ -309,7 +316,7 @@ func (client *ConfigServersClient) validateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, configServerSettings) diff --git a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_constants.go b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_constants.go index 7797c82d8a84..23ae3d669352 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_constants.go +++ b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_constants.go @@ -10,7 +10,7 @@ package armappplatform const ( module = "armappplatform" - version = "v0.1.1" + version = "v0.2.0" ) // AppResourceProvisioningState - Provisioning state of the App @@ -65,6 +65,50 @@ func (c ConfigServerState) ToPtr() *ConfigServerState { return &c } +// CreatedByType - The type of identity that created the resource. +type CreatedByType string + +const ( + CreatedByTypeApplication CreatedByType = "Application" + CreatedByTypeKey CreatedByType = "Key" + CreatedByTypeManagedIdentity CreatedByType = "ManagedIdentity" + CreatedByTypeUser CreatedByType = "User" +) + +// PossibleCreatedByTypeValues returns the possible values for the CreatedByType const type. +func PossibleCreatedByTypeValues() []CreatedByType { + return []CreatedByType{ + CreatedByTypeApplication, + CreatedByTypeKey, + CreatedByTypeManagedIdentity, + CreatedByTypeUser, + } +} + +// ToPtr returns a *CreatedByType pointing to the current value. +func (c CreatedByType) ToPtr() *CreatedByType { + return &c +} + +// CustomPersistentDiskPropertiesType - The type of the underlying resource to mount as a persistent disk. +type CustomPersistentDiskPropertiesType string + +const ( + CustomPersistentDiskPropertiesTypeAzureFileVolume CustomPersistentDiskPropertiesType = "AzureFileVolume" +) + +// PossibleCustomPersistentDiskPropertiesTypeValues returns the possible values for the CustomPersistentDiskPropertiesType const type. +func PossibleCustomPersistentDiskPropertiesTypeValues() []CustomPersistentDiskPropertiesType { + return []CustomPersistentDiskPropertiesType{ + CustomPersistentDiskPropertiesTypeAzureFileVolume, + } +} + +// ToPtr returns a *CustomPersistentDiskPropertiesType pointing to the current value. +func (c CustomPersistentDiskPropertiesType) ToPtr() *CustomPersistentDiskPropertiesType { + return &c +} + // DeploymentResourceProvisioningState - Provisioning state of the Deployment type DeploymentResourceProvisioningState string @@ -171,6 +215,27 @@ func (c MonitoringSettingState) ToPtr() *MonitoringSettingState { return &c } +// PowerState - Power state of the Service +type PowerState string + +const ( + PowerStateRunning PowerState = "Running" + PowerStateStopped PowerState = "Stopped" +) + +// PossiblePowerStateValues returns the possible values for the PowerState const type. +func PossiblePowerStateValues() []PowerState { + return []PowerState{ + PowerStateRunning, + PowerStateStopped, + } +} + +// ToPtr returns a *PowerState pointing to the current value. +func (c PowerState) ToPtr() *PowerState { + return &c +} + // ProvisioningState - Provisioning state of the Service type ProvisioningState string @@ -294,6 +359,25 @@ func (c SKUScaleType) ToPtr() *SKUScaleType { return &c } +// StoragePropertiesStorageType - The type of the storage. +type StoragePropertiesStorageType string + +const ( + StoragePropertiesStorageTypeStorageAccount StoragePropertiesStorageType = "StorageAccount" +) + +// PossibleStoragePropertiesStorageTypeValues returns the possible values for the StoragePropertiesStorageType const type. +func PossibleStoragePropertiesStorageTypeValues() []StoragePropertiesStorageType { + return []StoragePropertiesStorageType{ + StoragePropertiesStorageTypeStorageAccount, + } +} + +// ToPtr returns a *StoragePropertiesStorageType pointing to the current value. +func (c StoragePropertiesStorageType) ToPtr() *StoragePropertiesStorageType { + return &c +} + // SupportedRuntimePlatform - The platform of this runtime version (possible values: "Java" or ".NET"). type SupportedRuntimePlatform string diff --git a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_customdomains_client.go b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_customdomains_client.go index 6c00912161fb..fb5b2ac27e1a 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_customdomains_client.go +++ b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_customdomains_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CustomDomainsClient contains the methods for the CustomDomains group. @@ -31,8 +31,15 @@ type CustomDomainsClient struct { } // NewCustomDomainsClient creates a new instance of CustomDomainsClient with the specified values. -func NewCustomDomainsClient(con *arm.Connection, subscriptionID string) *CustomDomainsClient { - return &CustomDomainsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCustomDomainsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CustomDomainsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CustomDomainsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update custom domain of one lifecycle application. @@ -100,7 +107,7 @@ func (client *CustomDomainsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, domainResource) @@ -184,7 +191,7 @@ func (client *CustomDomainsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -248,7 +255,7 @@ func (client *CustomDomainsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -258,7 +265,7 @@ func (client *CustomDomainsClient) getCreateRequest(ctx context.Context, resourc func (client *CustomDomainsClient) getHandleResponse(resp *http.Response) (CustomDomainsGetResponse, error) { result := CustomDomainsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CustomDomainResource); err != nil { - return CustomDomainsGetResponse{}, err + return CustomDomainsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -314,7 +321,7 @@ func (client *CustomDomainsClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -324,7 +331,7 @@ func (client *CustomDomainsClient) listCreateRequest(ctx context.Context, resour func (client *CustomDomainsClient) listHandleResponse(resp *http.Response) (CustomDomainsListResponse, error) { result := CustomDomainsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CustomDomainResourceCollection); err != nil { - return CustomDomainsListResponse{}, err + return CustomDomainsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -407,7 +414,7 @@ func (client *CustomDomainsClient) updateCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, domainResource) diff --git a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_deployments_client.go b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_deployments_client.go index a68b5ec615e0..d5e57d71e9a0 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_deployments_client.go +++ b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_deployments_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DeploymentsClient contains the methods for the Deployments group. @@ -31,8 +31,15 @@ type DeploymentsClient struct { } // NewDeploymentsClient creates a new instance of DeploymentsClient with the specified values. -func NewDeploymentsClient(con *arm.Connection, subscriptionID string) *DeploymentsClient { - return &DeploymentsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDeploymentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DeploymentsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DeploymentsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create a new Deployment or update an exiting Deployment. @@ -100,7 +107,7 @@ func (client *DeploymentsClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, deploymentResource) @@ -184,7 +191,7 @@ func (client *DeploymentsClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -203,6 +210,174 @@ func (client *DeploymentsClient) deleteHandleError(resp *http.Response) error { return runtime.NewResponseError(&errType, resp) } +// BeginGenerateHeapDump - Generate Heap Dump +// If the operation fails it returns the *CloudError error type. +func (client *DeploymentsClient) BeginGenerateHeapDump(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters, options *DeploymentsBeginGenerateHeapDumpOptions) (DeploymentsGenerateHeapDumpPollerResponse, error) { + resp, err := client.generateHeapDump(ctx, resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters, options) + if err != nil { + return DeploymentsGenerateHeapDumpPollerResponse{}, err + } + result := DeploymentsGenerateHeapDumpPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("DeploymentsClient.GenerateHeapDump", "azure-async-operation", resp, client.pl, client.generateHeapDumpHandleError) + if err != nil { + return DeploymentsGenerateHeapDumpPollerResponse{}, err + } + result.Poller = &DeploymentsGenerateHeapDumpPoller{ + pt: pt, + } + return result, nil +} + +// GenerateHeapDump - Generate Heap Dump +// If the operation fails it returns the *CloudError error type. +func (client *DeploymentsClient) generateHeapDump(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters, options *DeploymentsBeginGenerateHeapDumpOptions) (*http.Response, error) { + req, err := client.generateHeapDumpCreateRequest(ctx, resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.generateHeapDumpHandleError(resp) + } + return resp, nil +} + +// generateHeapDumpCreateRequest creates the GenerateHeapDump request. +func (client *DeploymentsClient) generateHeapDumpCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters, options *DeploymentsBeginGenerateHeapDumpOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateHeapDump" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if appName == "" { + return nil, errors.New("parameter appName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{appName}", url.PathEscape(appName)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, diagnosticParameters) +} + +// generateHeapDumpHandleError handles the GenerateHeapDump error response. +func (client *DeploymentsClient) generateHeapDumpHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginGenerateThreadDump - Generate Thread Dump +// If the operation fails it returns the *CloudError error type. +func (client *DeploymentsClient) BeginGenerateThreadDump(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters, options *DeploymentsBeginGenerateThreadDumpOptions) (DeploymentsGenerateThreadDumpPollerResponse, error) { + resp, err := client.generateThreadDump(ctx, resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters, options) + if err != nil { + return DeploymentsGenerateThreadDumpPollerResponse{}, err + } + result := DeploymentsGenerateThreadDumpPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("DeploymentsClient.GenerateThreadDump", "azure-async-operation", resp, client.pl, client.generateThreadDumpHandleError) + if err != nil { + return DeploymentsGenerateThreadDumpPollerResponse{}, err + } + result.Poller = &DeploymentsGenerateThreadDumpPoller{ + pt: pt, + } + return result, nil +} + +// GenerateThreadDump - Generate Thread Dump +// If the operation fails it returns the *CloudError error type. +func (client *DeploymentsClient) generateThreadDump(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters, options *DeploymentsBeginGenerateThreadDumpOptions) (*http.Response, error) { + req, err := client.generateThreadDumpCreateRequest(ctx, resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.generateThreadDumpHandleError(resp) + } + return resp, nil +} + +// generateThreadDumpCreateRequest creates the GenerateThreadDump request. +func (client *DeploymentsClient) generateThreadDumpCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters, options *DeploymentsBeginGenerateThreadDumpOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/generateThreadDump" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if appName == "" { + return nil, errors.New("parameter appName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{appName}", url.PathEscape(appName)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, diagnosticParameters) +} + +// generateThreadDumpHandleError handles the GenerateThreadDump error response. +func (client *DeploymentsClient) generateThreadDumpHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + // Get - Get a Deployment and its properties. // If the operation fails it returns the *CloudError error type. func (client *DeploymentsClient) Get(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, options *DeploymentsGetOptions) (DeploymentsGetResponse, error) { @@ -248,7 +423,7 @@ func (client *DeploymentsClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -258,7 +433,7 @@ func (client *DeploymentsClient) getCreateRequest(ctx context.Context, resourceG func (client *DeploymentsClient) getHandleResponse(resp *http.Response) (DeploymentsGetResponse, error) { result := DeploymentsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentResource); err != nil { - return DeploymentsGetResponse{}, err + return DeploymentsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -321,7 +496,7 @@ func (client *DeploymentsClient) getLogFileURLCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -331,7 +506,7 @@ func (client *DeploymentsClient) getLogFileURLCreateRequest(ctx context.Context, func (client *DeploymentsClient) getLogFileURLHandleResponse(resp *http.Response) (DeploymentsGetLogFileURLResponse, error) { result := DeploymentsGetLogFileURLResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LogFileURLResponse); err != nil { - return DeploymentsGetLogFileURLResponse{}, err + return DeploymentsGetLogFileURLResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -387,7 +562,7 @@ func (client *DeploymentsClient) listCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") if options != nil && options.Version != nil { for _, qv := range options.Version { reqQP.Add("version", qv) @@ -402,7 +577,7 @@ func (client *DeploymentsClient) listCreateRequest(ctx context.Context, resource func (client *DeploymentsClient) listHandleResponse(resp *http.Response) (DeploymentsListResponse, error) { result := DeploymentsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentResourceCollection); err != nil { - return DeploymentsListResponse{}, err + return DeploymentsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -454,7 +629,7 @@ func (client *DeploymentsClient) listForClusterCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") if options != nil && options.Version != nil { for _, qv := range options.Version { reqQP.Add("version", qv) @@ -469,7 +644,7 @@ func (client *DeploymentsClient) listForClusterCreateRequest(ctx context.Context func (client *DeploymentsClient) listForClusterHandleResponse(resp *http.Response) (DeploymentsListForClusterResponse, error) { result := DeploymentsListForClusterResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentResourceCollection); err != nil { - return DeploymentsListForClusterResponse{}, err + return DeploymentsListForClusterResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -552,7 +727,7 @@ func (client *DeploymentsClient) restartCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -636,7 +811,7 @@ func (client *DeploymentsClient) startCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -655,6 +830,90 @@ func (client *DeploymentsClient) startHandleError(resp *http.Response) error { return runtime.NewResponseError(&errType, resp) } +// BeginStartJFR - Start JFR +// If the operation fails it returns the *CloudError error type. +func (client *DeploymentsClient) BeginStartJFR(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters, options *DeploymentsBeginStartJFROptions) (DeploymentsStartJFRPollerResponse, error) { + resp, err := client.startJFR(ctx, resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters, options) + if err != nil { + return DeploymentsStartJFRPollerResponse{}, err + } + result := DeploymentsStartJFRPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("DeploymentsClient.StartJFR", "azure-async-operation", resp, client.pl, client.startJFRHandleError) + if err != nil { + return DeploymentsStartJFRPollerResponse{}, err + } + result.Poller = &DeploymentsStartJFRPoller{ + pt: pt, + } + return result, nil +} + +// StartJFR - Start JFR +// If the operation fails it returns the *CloudError error type. +func (client *DeploymentsClient) startJFR(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters, options *DeploymentsBeginStartJFROptions) (*http.Response, error) { + req, err := client.startJFRCreateRequest(ctx, resourceGroupName, serviceName, appName, deploymentName, diagnosticParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.startJFRHandleError(resp) + } + return resp, nil +} + +// startJFRCreateRequest creates the StartJFR request. +func (client *DeploymentsClient) startJFRCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, diagnosticParameters DiagnosticParameters, options *DeploymentsBeginStartJFROptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/apps/{appName}/deployments/{deploymentName}/StartJFR" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if appName == "" { + return nil, errors.New("parameter appName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{appName}", url.PathEscape(appName)) + if deploymentName == "" { + return nil, errors.New("parameter deploymentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{deploymentName}", url.PathEscape(deploymentName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, diagnosticParameters) +} + +// startJFRHandleError handles the StartJFR error response. +func (client *DeploymentsClient) startJFRHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + // BeginStop - Stop the deployment. // If the operation fails it returns the *CloudError error type. func (client *DeploymentsClient) BeginStop(ctx context.Context, resourceGroupName string, serviceName string, appName string, deploymentName string, options *DeploymentsBeginStopOptions) (DeploymentsStopPollerResponse, error) { @@ -720,7 +979,7 @@ func (client *DeploymentsClient) stopCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -804,7 +1063,7 @@ func (client *DeploymentsClient) updateCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, deploymentResource) diff --git a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_models.go b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_models.go index 7a57b1561236..95ebbbd918fc 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_models.go +++ b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_models.go @@ -10,10 +10,9 @@ package armappplatform import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // AppResource - App resource payload @@ -39,6 +38,35 @@ func (a AppResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// UnmarshalJSON implements the json.Unmarshaller interface for type AppResource. +func (a *AppResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "identity": + err = unpopulate(val, &a.Identity) + delete(rawMsg, key) + case "location": + err = unpopulate(val, &a.Location) + delete(rawMsg, key) + case "properties": + err = unpopulate(val, &a.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.ProxyResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + // AppResourceCollection - Object that includes an array of App resources and a possible link for next set type AppResourceCollection struct { // URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. @@ -61,6 +89,9 @@ type AppResourceProperties struct { // Name of the active deployment of the App ActiveDeploymentName *string `json:"activeDeploymentName,omitempty"` + // List of custom persistent disks + CustomPersistentDisks []*CustomPersistentDiskResource `json:"customPersistentDisks,omitempty"` + // Indicate if end to end TLS is enabled. EnableEndToEndTLS *bool `json:"enableEndToEndTLS,omitempty"` @@ -70,6 +101,9 @@ type AppResourceProperties struct { // Indicate if only https is allowed. HTTPSOnly *bool `json:"httpsOnly,omitempty"` + // Collection of loaded certificates + LoadedCertificates []*LoadedCertificate `json:"loadedCertificates,omitempty"` + // Persistent disk settings PersistentDisk *PersistentDisk `json:"persistentDisk,omitempty"` @@ -93,10 +127,12 @@ type AppResourceProperties struct { func (a AppResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "activeDeploymentName", a.ActiveDeploymentName) - populate(objectMap, "createdTime", (*timeRFC3339)(a.CreatedTime)) + populateTimeRFC3339(objectMap, "createdTime", a.CreatedTime) + populate(objectMap, "customPersistentDisks", a.CustomPersistentDisks) populate(objectMap, "enableEndToEndTLS", a.EnableEndToEndTLS) populate(objectMap, "fqdn", a.Fqdn) populate(objectMap, "httpsOnly", a.HTTPSOnly) + populate(objectMap, "loadedCertificates", a.LoadedCertificates) populate(objectMap, "persistentDisk", a.PersistentDisk) populate(objectMap, "provisioningState", a.ProvisioningState) populate(objectMap, "public", a.Public) @@ -118,9 +154,10 @@ func (a *AppResourceProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.ActiveDeploymentName) delete(rawMsg, key) case "createdTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.CreatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.CreatedTime) + delete(rawMsg, key) + case "customPersistentDisks": + err = unpopulate(val, &a.CustomPersistentDisks) delete(rawMsg, key) case "enableEndToEndTLS": err = unpopulate(val, &a.EnableEndToEndTLS) @@ -131,6 +168,9 @@ func (a *AppResourceProperties) UnmarshalJSON(data []byte) error { case "httpsOnly": err = unpopulate(val, &a.HTTPSOnly) delete(rawMsg, key) + case "loadedCertificates": + err = unpopulate(val, &a.LoadedCertificates) + delete(rawMsg, key) case "persistentDisk": err = unpopulate(val, &a.PersistentDisk) delete(rawMsg, key) @@ -225,6 +265,44 @@ func (a AvailableRuntimeVersions) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// AzureFileVolume - The properties of the Azure File volume. Azure File shares are mounted as volumes. +type AzureFileVolume struct { + CustomPersistentDiskProperties + // REQUIRED; The share name of the Azure File share. + ShareName *string `json:"shareName,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type AzureFileVolume. +func (a AzureFileVolume) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + a.CustomPersistentDiskProperties.marshalInternal(objectMap, CustomPersistentDiskPropertiesTypeAzureFileVolume) + populate(objectMap, "shareName", a.ShareName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type AzureFileVolume. +func (a *AzureFileVolume) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "shareName": + err = unpopulate(val, &a.ShareName) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := a.CustomPersistentDiskProperties.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + // BindingResource - Binding resource payload type BindingResource struct { ProxyResource @@ -240,6 +318,29 @@ func (b BindingResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// UnmarshalJSON implements the json.Unmarshaller interface for type BindingResource. +func (b *BindingResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &b.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := b.ProxyResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + // BindingResourceCollection - Object that includes an array of Binding resources and a possible link for next set type BindingResourceCollection struct { // URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. @@ -323,16 +424,19 @@ type BindingsListOptions struct { // placeholder for future optional parameters } +// CertificatePropertiesClassification provides polymorphic access to related types. +// Call the interface's GetCertificateProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *CertificateProperties, *ContentCertificateProperties, *KeyVaultCertificateProperties +type CertificatePropertiesClassification interface { + // GetCertificateProperties returns the CertificateProperties content of the underlying type. + GetCertificateProperties() *CertificateProperties +} + // CertificateProperties - Certificate resource payload. type CertificateProperties struct { - // REQUIRED; The certificate name of key vault. - KeyVaultCertName *string `json:"keyVaultCertName,omitempty"` - - // REQUIRED; The vault uri of user key vault. - VaultURI *string `json:"vaultUri,omitempty"` - - // The certificate version of key vault. - CertVersion *string `json:"certVersion,omitempty"` + // REQUIRED; The type of the certificate source. + Type *string `json:"type,omitempty"` // READ-ONLY; The activate date of certificate. ActivateDate *string `json:"activateDate,omitempty" azure:"ro"` @@ -356,27 +460,71 @@ type CertificateProperties struct { Thumbprint *string `json:"thumbprint,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type CertificateProperties. -func (c CertificateProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) +// GetCertificateProperties implements the CertificatePropertiesClassification interface for type CertificateProperties. +func (c *CertificateProperties) GetCertificateProperties() *CertificateProperties { return c } + +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateProperties. +func (c *CertificateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return c.unmarshalInternal(rawMsg) +} + +func (c CertificateProperties) marshalInternal(objectMap map[string]interface{}, discValue string) { populate(objectMap, "activateDate", c.ActivateDate) - populate(objectMap, "certVersion", c.CertVersion) populate(objectMap, "dnsNames", c.DNSNames) populate(objectMap, "expirationDate", c.ExpirationDate) populate(objectMap, "issuedDate", c.IssuedDate) populate(objectMap, "issuer", c.Issuer) - populate(objectMap, "keyVaultCertName", c.KeyVaultCertName) populate(objectMap, "subjectName", c.SubjectName) populate(objectMap, "thumbprint", c.Thumbprint) - populate(objectMap, "vaultUri", c.VaultURI) - return json.Marshal(objectMap) + c.Type = &discValue + objectMap["type"] = c.Type +} + +func (c *CertificateProperties) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "activateDate": + err = unpopulate(val, &c.ActivateDate) + delete(rawMsg, key) + case "dnsNames": + err = unpopulate(val, &c.DNSNames) + delete(rawMsg, key) + case "expirationDate": + err = unpopulate(val, &c.ExpirationDate) + delete(rawMsg, key) + case "issuedDate": + err = unpopulate(val, &c.IssuedDate) + delete(rawMsg, key) + case "issuer": + err = unpopulate(val, &c.Issuer) + delete(rawMsg, key) + case "subjectName": + err = unpopulate(val, &c.SubjectName) + delete(rawMsg, key) + case "thumbprint": + err = unpopulate(val, &c.Thumbprint) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &c.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil } // CertificateResource - Certificate resource payload. type CertificateResource struct { ProxyResource // Properties of the certificate resource payload. - Properties *CertificateProperties `json:"properties,omitempty"` + Properties CertificatePropertiesClassification `json:"properties,omitempty"` } // MarshalJSON implements the json.Marshaller interface for type CertificateResource. @@ -387,6 +535,29 @@ func (c CertificateResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// UnmarshalJSON implements the json.Unmarshaller interface for type CertificateResource. +func (c *CertificateResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + c.Properties, err = unmarshalCertificatePropertiesClassification(val) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.ProxyResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + // CertificateResourceCollection - Collection compose of certificate resources list and a possible link for next page. type CertificateResourceCollection struct { // The link to next page of certificate list. @@ -468,6 +639,9 @@ type ClusterResourceProperties struct { // Network profile of the Service NetworkProfile *NetworkProfile `json:"networkProfile,omitempty"` + // READ-ONLY; Power state of the Service + PowerState *PowerState `json:"powerState,omitempty" azure:"ro"` + // READ-ONLY; Provisioning state of the Service ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` @@ -554,6 +728,29 @@ func (c ConfigServerResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// UnmarshalJSON implements the json.Unmarshaller interface for type ConfigServerResource. +func (c *ConfigServerResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.ProxyResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + // ConfigServerSettings - The settings of config server. type ConfigServerSettings struct { // Property of git environment. @@ -618,6 +815,44 @@ type ConfigServersGetOptions struct { // placeholder for future optional parameters } +// ContentCertificateProperties - Properties of certificate imported from key vault. +type ContentCertificateProperties struct { + CertificateProperties + // REQUIRED; The content of uploaded certificate. + Content *string `json:"content,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ContentCertificateProperties. +func (c ContentCertificateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.CertificateProperties.marshalInternal(objectMap, "ContentCertificate") + populate(objectMap, "content", c.Content) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type ContentCertificateProperties. +func (c *ContentCertificateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "content": + err = unpopulate(val, &c.Content) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.CertificateProperties.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + // CustomContainer - Custom container payload type CustomContainer struct { // Arguments to the entrypoint. The docker image's CMD is used if this is not provided. @@ -674,6 +909,29 @@ func (c CustomDomainResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomDomainResource. +func (c *CustomDomainResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.ProxyResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + // CustomDomainResourceCollection - Collection compose of a custom domain resources list and a possible link for next page. type CustomDomainResourceCollection struct { // The link to next page of custom domain list. @@ -731,6 +989,116 @@ type CustomDomainsListOptions struct { // placeholder for future optional parameters } +// CustomPersistentDiskPropertiesClassification provides polymorphic access to related types. +// Call the interface's GetCustomPersistentDiskProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *AzureFileVolume, *CustomPersistentDiskProperties +type CustomPersistentDiskPropertiesClassification interface { + // GetCustomPersistentDiskProperties returns the CustomPersistentDiskProperties content of the underlying type. + GetCustomPersistentDiskProperties() *CustomPersistentDiskProperties +} + +// CustomPersistentDiskProperties - Custom persistent disk resource payload. +type CustomPersistentDiskProperties struct { + // REQUIRED; The mount path of the persistent disk. + MountPath *string `json:"mountPath,omitempty"` + + // REQUIRED; The type of the underlying resource to mount as a persistent disk. + Type *CustomPersistentDiskPropertiesType `json:"type,omitempty"` + + // These are the mount options for a persistent disk. + MountOptions []*string `json:"mountOptions,omitempty"` + + // Indicates whether the persistent disk is a readOnly one. + ReadOnly *bool `json:"readOnly,omitempty"` +} + +// GetCustomPersistentDiskProperties implements the CustomPersistentDiskPropertiesClassification interface for type CustomPersistentDiskProperties. +func (c *CustomPersistentDiskProperties) GetCustomPersistentDiskProperties() *CustomPersistentDiskProperties { + return c +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomPersistentDiskProperties. +func (c *CustomPersistentDiskProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return c.unmarshalInternal(rawMsg) +} + +func (c CustomPersistentDiskProperties) marshalInternal(objectMap map[string]interface{}, discValue CustomPersistentDiskPropertiesType) { + populate(objectMap, "mountOptions", c.MountOptions) + populate(objectMap, "mountPath", c.MountPath) + populate(objectMap, "readOnly", c.ReadOnly) + c.Type = &discValue + objectMap["type"] = c.Type +} + +func (c *CustomPersistentDiskProperties) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "mountOptions": + err = unpopulate(val, &c.MountOptions) + delete(rawMsg, key) + case "mountPath": + err = unpopulate(val, &c.MountPath) + delete(rawMsg, key) + case "readOnly": + err = unpopulate(val, &c.ReadOnly) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &c.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// CustomPersistentDiskResource - Custom persistent disk resource payload. +type CustomPersistentDiskResource struct { + // REQUIRED; The resource id of Azure Spring Cloud Storage resource. + StorageID *string `json:"storageId,omitempty"` + + // Properties of the custom persistent disk resource payload. + CustomPersistentDiskProperties CustomPersistentDiskPropertiesClassification `json:"customPersistentDiskProperties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CustomPersistentDiskResource. +func (c CustomPersistentDiskResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customPersistentDiskProperties", c.CustomPersistentDiskProperties) + populate(objectMap, "storageId", c.StorageID) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomPersistentDiskResource. +func (c *CustomPersistentDiskResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "customPersistentDiskProperties": + c.CustomPersistentDiskProperties, err = unmarshalCustomPersistentDiskPropertiesClassification(val) + delete(rawMsg, key) + case "storageId": + err = unpopulate(val, &c.StorageID) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + // DeploymentInstance - Deployment instance payload type DeploymentInstance struct { // READ-ONLY; Discovery status of the deployment instance @@ -768,18 +1136,44 @@ func (d DeploymentResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// DeploymentResourceCollection - Object that includes an array of App resources and a possible link for next set -type DeploymentResourceCollection struct { - // URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. - NextLink *string `json:"nextLink,omitempty"` - - // Collection of Deployment resources - Value []*DeploymentResource `json:"value,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type DeploymentResourceCollection. -func (d DeploymentResourceCollection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) +// UnmarshalJSON implements the json.Unmarshaller interface for type DeploymentResource. +func (d *DeploymentResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &d.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, &d.SKU) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := d.ProxyResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// DeploymentResourceCollection - Object that includes an array of App resources and a possible link for next set +type DeploymentResourceCollection struct { + // URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. + NextLink *string `json:"nextLink,omitempty"` + + // Collection of Deployment resources + Value []*DeploymentResource `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type DeploymentResourceCollection. +func (d DeploymentResourceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) populate(objectMap, "nextLink", d.NextLink) populate(objectMap, "value", d.Value) return json.Marshal(objectMap) @@ -817,7 +1211,7 @@ func (d DeploymentResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "active", d.Active) populate(objectMap, "appName", d.AppName) - populate(objectMap, "createdTime", (*timeRFC3339)(d.CreatedTime)) + populateTimeRFC3339(objectMap, "createdTime", d.CreatedTime) populate(objectMap, "deploymentSettings", d.DeploymentSettings) populate(objectMap, "instances", d.Instances) populate(objectMap, "provisioningState", d.ProvisioningState) @@ -842,9 +1236,7 @@ func (d *DeploymentResourceProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.AppName) delete(rawMsg, key) case "createdTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.CreatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.CreatedTime) delete(rawMsg, key) case "deploymentSettings": err = unpopulate(val, &d.DeploymentSettings) @@ -871,11 +1263,14 @@ func (d *DeploymentResourceProperties) UnmarshalJSON(data []byte) error { // DeploymentSettings - Deployment settings payload type DeploymentSettings struct { - // Required CPU. This should be 1 for Basic tier, and in range [1, 4] for Standard tier. This is deprecated starting from API version 2021-06-01-preview. + // Required CPU. This should be 1 for Basic tier, and in range [1, 4] for Standard tier. This is deprecated starting from API version 2021-09-01-preview. // Please use the resourceRequests field to set the // CPU size. CPU *int32 `json:"cpu,omitempty"` + // Container liveness and readiness probe settings + ContainerProbeSettings *DeploymentSettingsContainerProbeSettings `json:"containerProbeSettings,omitempty"` + // Collection of environment variables EnvironmentVariables map[string]*string `json:"environmentVariables,omitempty"` @@ -883,7 +1278,7 @@ type DeploymentSettings struct { JvmOptions *string `json:"jvmOptions,omitempty"` // Required Memory size in GB. This should be in range [1, 2] for Basic tier, and in range [1, 8] for Standard tier. This is deprecated starting from API - // version 2021-06-01-preview. Please use the + // version 2021-09-01-preview. Please use the // resourceRequests field to set the the memory size. MemoryInGB *int32 `json:"memoryInGB,omitempty"` @@ -903,6 +1298,7 @@ type DeploymentSettings struct { func (d DeploymentSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "cpu", d.CPU) + populate(objectMap, "containerProbeSettings", d.ContainerProbeSettings) populate(objectMap, "environmentVariables", d.EnvironmentVariables) populate(objectMap, "jvmOptions", d.JvmOptions) populate(objectMap, "memoryInGB", d.MemoryInGB) @@ -912,6 +1308,12 @@ func (d DeploymentSettings) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// DeploymentSettingsContainerProbeSettings - Container liveness and readiness probe settings +type DeploymentSettingsContainerProbeSettings struct { + // Indicates whether disable the liveness and readiness probe + DisableProbe *bool `json:"disableProbe,omitempty"` +} + // DeploymentsBeginCreateOrUpdateOptions contains the optional parameters for the Deployments.BeginCreateOrUpdate method. type DeploymentsBeginCreateOrUpdateOptions struct { // placeholder for future optional parameters @@ -922,11 +1324,26 @@ type DeploymentsBeginDeleteOptions struct { // placeholder for future optional parameters } +// DeploymentsBeginGenerateHeapDumpOptions contains the optional parameters for the Deployments.BeginGenerateHeapDump method. +type DeploymentsBeginGenerateHeapDumpOptions struct { + // placeholder for future optional parameters +} + +// DeploymentsBeginGenerateThreadDumpOptions contains the optional parameters for the Deployments.BeginGenerateThreadDump method. +type DeploymentsBeginGenerateThreadDumpOptions struct { + // placeholder for future optional parameters +} + // DeploymentsBeginRestartOptions contains the optional parameters for the Deployments.BeginRestart method. type DeploymentsBeginRestartOptions struct { // placeholder for future optional parameters } +// DeploymentsBeginStartJFROptions contains the optional parameters for the Deployments.BeginStartJFR method. +type DeploymentsBeginStartJFROptions struct { + // placeholder for future optional parameters +} + // DeploymentsBeginStartOptions contains the optional parameters for the Deployments.BeginStart method. type DeploymentsBeginStartOptions struct { // placeholder for future optional parameters @@ -964,6 +1381,18 @@ type DeploymentsListOptions struct { Version []string } +// DiagnosticParameters - Diagnostic parameters of diagnostic operations +type DiagnosticParameters struct { + // App instance name + AppInstance *string `json:"appInstance,omitempty"` + + // Duration of your JFR. 1 min can be represented by 1m or 60s. + Duration *string `json:"duration,omitempty"` + + // Your target file path in your own BYOS + FilePath *string `json:"filePath,omitempty"` +} + // Error - The error code compose of code and message. type Error struct { // The code of error. @@ -1035,6 +1464,74 @@ type ImageRegistryCredential struct { Username *string `json:"username,omitempty"` } +// KeyVaultCertificateProperties - Properties of certificate imported from key vault. +type KeyVaultCertificateProperties struct { + CertificateProperties + // REQUIRED; The certificate name of key vault. + KeyVaultCertName *string `json:"keyVaultCertName,omitempty"` + + // REQUIRED; The vault uri of user key vault. + VaultURI *string `json:"vaultUri,omitempty"` + + // The certificate version of key vault. + CertVersion *string `json:"certVersion,omitempty"` + + // Optional. If set to true, it will not import private key from key vault. + ExcludePrivateKey *bool `json:"excludePrivateKey,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type KeyVaultCertificateProperties. +func (k KeyVaultCertificateProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + k.CertificateProperties.marshalInternal(objectMap, "KeyVaultCertificate") + populate(objectMap, "certVersion", k.CertVersion) + populate(objectMap, "excludePrivateKey", k.ExcludePrivateKey) + populate(objectMap, "keyVaultCertName", k.KeyVaultCertName) + populate(objectMap, "vaultUri", k.VaultURI) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type KeyVaultCertificateProperties. +func (k *KeyVaultCertificateProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "certVersion": + err = unpopulate(val, &k.CertVersion) + delete(rawMsg, key) + case "excludePrivateKey": + err = unpopulate(val, &k.ExcludePrivateKey) + delete(rawMsg, key) + case "keyVaultCertName": + err = unpopulate(val, &k.KeyVaultCertName) + delete(rawMsg, key) + case "vaultUri": + err = unpopulate(val, &k.VaultURI) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := k.CertificateProperties.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// LoadedCertificate - Loaded certificate payload +type LoadedCertificate struct { + // REQUIRED; Resource Id of loaded certificate + ResourceID *string `json:"resourceId,omitempty"` + + // Indicate whether the certificate will be loaded into default trust store, only work for Java runtime. + LoadTrustStore *bool `json:"loadTrustStore,omitempty"` +} + // LogFileURLResponse - Log file URL payload type LogFileURLResponse struct { // REQUIRED; URL of the log file @@ -1168,6 +1665,29 @@ func (m MonitoringSettingResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// UnmarshalJSON implements the json.Unmarshaller interface for type MonitoringSettingResource. +func (m *MonitoringSettingResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &m.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := m.ProxyResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + // MonitoringSettingsBeginUpdatePatchOptions contains the optional parameters for the MonitoringSettings.BeginUpdatePatch method. type MonitoringSettingsBeginUpdatePatchOptions struct { // placeholder for future optional parameters @@ -1319,6 +1839,13 @@ func (p ProxyResource) marshalInternal(objectMap map[string]interface{}) { p.Resource.marshalInternal(objectMap) } +func (p *ProxyResource) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + if err := p.Resource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + // RegenerateTestKeyRequestPayload - Regenerate test key request payload type RegenerateTestKeyRequestPayload struct { // REQUIRED; Type of the test key @@ -1373,12 +1900,42 @@ func (r Resource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// UnmarshalJSON implements the json.Unmarshaller interface for type Resource. +func (r *Resource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return r.unmarshalInternal(rawMsg) +} + func (r Resource) marshalInternal(objectMap map[string]interface{}) { populate(objectMap, "id", r.ID) populate(objectMap, "name", r.Name) populate(objectMap, "type", r.Type) } +func (r *Resource) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "id": + err = unpopulate(val, &r.ID) + delete(rawMsg, key) + case "name": + err = unpopulate(val, &r.Name) + delete(rawMsg, key) + case "type": + err = unpopulate(val, &r.Type) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + // ResourceRequests - Deployment resource request payload type ResourceRequests struct { // Required CPU. 1 core can be represented by 1 or 1000m. This should be 500m or 1 for Basic tier, and {500m, 1, 2, 3, 4} for Standard tier. @@ -1596,6 +2153,32 @@ func (s ServiceResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceResource. +func (s *ServiceResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &s.Properties) + delete(rawMsg, key) + case "sku": + err = unpopulate(val, &s.SKU) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := s.TrackedResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + // ServiceResourceList - Object that includes an array of Service resources and a possible link for next set type ServiceResourceList struct { // URL client should use to fetch the next page (per server side paging). It's null for now, added for future use. @@ -1640,6 +2223,16 @@ type ServicesBeginDeleteOptions struct { // placeholder for future optional parameters } +// ServicesBeginStartOptions contains the optional parameters for the Services.BeginStart method. +type ServicesBeginStartOptions struct { + // placeholder for future optional parameters +} + +// ServicesBeginStopOptions contains the optional parameters for the Services.BeginStop method. +type ServicesBeginStopOptions struct { + // placeholder for future optional parameters +} + // ServicesBeginUpdateOptions contains the optional parameters for the Services.BeginUpdate method. type ServicesBeginUpdateOptions struct { // placeholder for future optional parameters @@ -1685,6 +2278,180 @@ type ServicesRegenerateTestKeyOptions struct { // placeholder for future optional parameters } +// StorageAccount - storage resource of type Azure Storage Account. +type StorageAccount struct { + StorageProperties + // REQUIRED; The account key of the Azure Storage Account. + AccountKey *string `json:"accountKey,omitempty"` + + // REQUIRED; The account name of the Azure Storage Account. + AccountName *string `json:"accountName,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type StorageAccount. +func (s StorageAccount) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.StorageProperties.marshalInternal(objectMap, StoragePropertiesStorageTypeStorageAccount) + populate(objectMap, "accountKey", s.AccountKey) + populate(objectMap, "accountName", s.AccountName) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageAccount. +func (s *StorageAccount) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "accountKey": + err = unpopulate(val, &s.AccountKey) + delete(rawMsg, key) + case "accountName": + err = unpopulate(val, &s.AccountName) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := s.StorageProperties.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// StoragePropertiesClassification provides polymorphic access to related types. +// Call the interface's GetStorageProperties() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *StorageAccount, *StorageProperties +type StoragePropertiesClassification interface { + // GetStorageProperties returns the StorageProperties content of the underlying type. + GetStorageProperties() *StorageProperties +} + +// StorageProperties - Storage resource payload. +type StorageProperties struct { + // REQUIRED; The type of the storage. + StorageType *StoragePropertiesStorageType `json:"storageType,omitempty"` +} + +// GetStorageProperties implements the StoragePropertiesClassification interface for type StorageProperties. +func (s *StorageProperties) GetStorageProperties() *StorageProperties { return s } + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageProperties. +func (s *StorageProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return s.unmarshalInternal(rawMsg) +} + +func (s StorageProperties) marshalInternal(objectMap map[string]interface{}, discValue StoragePropertiesStorageType) { + s.StorageType = &discValue + objectMap["storageType"] = s.StorageType +} + +func (s *StorageProperties) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "storageType": + err = unpopulate(val, &s.StorageType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// StorageResource - Storage resource payload. +type StorageResource struct { + ProxyResource + // Properties of the storage resource payload. + Properties StoragePropertiesClassification `json:"properties,omitempty"` + + // READ-ONLY; Metadata pertaining to creation and last modification of the resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type StorageResource. +func (s StorageResource) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.ProxyResource.marshalInternal(objectMap) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type StorageResource. +func (s *StorageResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + s.Properties, err = unmarshalStoragePropertiesClassification(val) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &s.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := s.ProxyResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// StorageResourceCollection - Collection compose of storage resources list and a possible link for next page. +type StorageResourceCollection struct { + // The link to next page of storage list. + NextLink *string `json:"nextLink,omitempty"` + + // The storage resources list. + Value []*StorageResource `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type StorageResourceCollection. +func (s StorageResourceCollection) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// StoragesBeginCreateOrUpdateOptions contains the optional parameters for the Storages.BeginCreateOrUpdate method. +type StoragesBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// StoragesBeginDeleteOptions contains the optional parameters for the Storages.BeginDelete method. +type StoragesBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// StoragesGetOptions contains the optional parameters for the Storages.Get method. +type StoragesGetOptions struct { + // placeholder for future optional parameters +} + +// StoragesListOptions contains the optional parameters for the Storages.List method. +type StoragesListOptions struct { + // placeholder for future optional parameters +} + // SupportedRuntimeVersion - Supported deployment runtime version descriptor. type SupportedRuntimeVersion struct { // The platform of this runtime version (possible values: "Java" or ".NET"). @@ -1697,6 +2464,74 @@ type SupportedRuntimeVersion struct { Version *string `json:"version,omitempty"` } +// SystemData - Metadata pertaining to creation and last modification of the resource. +type SystemData struct { + // The timestamp of resource creation (UTC). + CreatedAt *time.Time `json:"createdAt,omitempty"` + + // The identity that created the resource. + CreatedBy *string `json:"createdBy,omitempty"` + + // The type of identity that created the resource. + CreatedByType *CreatedByType `json:"createdByType,omitempty"` + + // The timestamp of resource last modification (UTC) + LastModifiedAt *time.Time `json:"lastModifiedAt,omitempty"` + + // The identity that last modified the resource. + LastModifiedBy *string `json:"lastModifiedBy,omitempty"` + + // The type of identity that last modified the resource. + LastModifiedByType *CreatedByType `json:"lastModifiedByType,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SystemData. +func (s SystemData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) + populate(objectMap, "createdBy", s.CreatedBy) + populate(objectMap, "createdByType", s.CreatedByType) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) + populate(objectMap, "lastModifiedBy", s.LastModifiedBy) + populate(objectMap, "lastModifiedByType", s.LastModifiedByType) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SystemData. +func (s *SystemData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAt": + err = unpopulateTimeRFC3339(val, &s.CreatedAt) + delete(rawMsg, key) + case "createdBy": + err = unpopulate(val, &s.CreatedBy) + delete(rawMsg, key) + case "createdByType": + err = unpopulate(val, &s.CreatedByType) + delete(rawMsg, key) + case "lastModifiedAt": + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) + delete(rawMsg, key) + case "lastModifiedBy": + err = unpopulate(val, &s.LastModifiedBy) + delete(rawMsg, key) + case "lastModifiedByType": + err = unpopulate(val, &s.LastModifiedByType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + // TemporaryDisk - Temporary disk payload type TemporaryDisk struct { // Mount path of the temporary disk @@ -1741,12 +2576,42 @@ func (t TrackedResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// UnmarshalJSON implements the json.Unmarshaller interface for type TrackedResource. +func (t *TrackedResource) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return t.unmarshalInternal(rawMsg) +} + func (t TrackedResource) marshalInternal(objectMap map[string]interface{}) { t.Resource.marshalInternal(objectMap) populate(objectMap, "location", t.Location) populate(objectMap, "tags", t.Tags) } +func (t *TrackedResource) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "location": + err = unpopulate(val, &t.Location) + delete(rawMsg, key) + case "tags": + err = unpopulate(val, &t.Tags) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := t.Resource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + // UserSourceInfo - Source information for a deployment type UserSourceInfo struct { // Selector for the artifact to be used for the deployment for multi-module projects. This should be the relative path to the target module/project. diff --git a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_monitoringsettings_client.go b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_monitoringsettings_client.go index 115b2d99380a..30557b99b6e5 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_monitoringsettings_client.go +++ b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_monitoringsettings_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // MonitoringSettingsClient contains the methods for the MonitoringSettings group. @@ -31,8 +31,15 @@ type MonitoringSettingsClient struct { } // NewMonitoringSettingsClient creates a new instance of MonitoringSettingsClient with the specified values. -func NewMonitoringSettingsClient(con *arm.Connection, subscriptionID string) *MonitoringSettingsClient { - return &MonitoringSettingsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewMonitoringSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *MonitoringSettingsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MonitoringSettingsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get the Monitoring Setting and its properties. @@ -72,7 +79,7 @@ func (client *MonitoringSettingsClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -82,7 +89,7 @@ func (client *MonitoringSettingsClient) getCreateRequest(ctx context.Context, re func (client *MonitoringSettingsClient) getHandleResponse(resp *http.Response) (MonitoringSettingsGetResponse, error) { result := MonitoringSettingsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MonitoringSettingResource); err != nil { - return MonitoringSettingsGetResponse{}, err + return MonitoringSettingsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -157,7 +164,7 @@ func (client *MonitoringSettingsClient) updatePatchCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, monitoringSettingResource) @@ -233,7 +240,7 @@ func (client *MonitoringSettingsClient) updatePutCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, monitoringSettingResource) diff --git a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_operations_client.go b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_operations_client.go index 481a98f58cdf..cde6b1c175af 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_operations_client.go +++ b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armappplatform import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available REST API operations of the Microsoft.AppPlatform provider. @@ -52,7 +60,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailableOperations); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_pagers.go b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_pagers.go index 1a655a14257a..b09399f8edef 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_pagers.go +++ b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armappplatform import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // AppsListPager provides operations for iterating over paged responses. @@ -556,3 +555,57 @@ func (p *ServicesListPager) NextPage(ctx context.Context) bool { func (p *ServicesListPager) PageResponse() ServicesListResponse { return p.current } + +// StoragesListPager provides operations for iterating over paged responses. +type StoragesListPager struct { + client *StoragesClient + current StoragesListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, StoragesListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *StoragesListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *StoragesListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.StorageResourceCollection.NextLink == nil || len(*p.current.StorageResourceCollection.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current StoragesListResponse page. +func (p *StoragesListPager) PageResponse() StoragesListResponse { + return p.current +} diff --git a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_pollers.go b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_pollers.go index 83245b44f58f..2d9a78de0540 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_pollers.go +++ b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armappplatform import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // AppsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. @@ -703,6 +702,92 @@ func (p *DeploymentsDeletePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } +// DeploymentsGenerateHeapDumpPoller provides polling facilities until the operation reaches a terminal state. +type DeploymentsGenerateHeapDumpPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DeploymentsGenerateHeapDumpPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DeploymentsGenerateHeapDumpPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DeploymentsGenerateHeapDumpResponse will be returned. +func (p *DeploymentsGenerateHeapDumpPoller) FinalResponse(ctx context.Context) (DeploymentsGenerateHeapDumpResponse, error) { + respType := DeploymentsGenerateHeapDumpResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return DeploymentsGenerateHeapDumpResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DeploymentsGenerateHeapDumpPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// DeploymentsGenerateThreadDumpPoller provides polling facilities until the operation reaches a terminal state. +type DeploymentsGenerateThreadDumpPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DeploymentsGenerateThreadDumpPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DeploymentsGenerateThreadDumpPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DeploymentsGenerateThreadDumpResponse will be returned. +func (p *DeploymentsGenerateThreadDumpPoller) FinalResponse(ctx context.Context) (DeploymentsGenerateThreadDumpResponse, error) { + respType := DeploymentsGenerateThreadDumpResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return DeploymentsGenerateThreadDumpResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DeploymentsGenerateThreadDumpPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + // DeploymentsRestartPoller provides polling facilities until the operation reaches a terminal state. type DeploymentsRestartPoller struct { pt *azcore.Poller @@ -746,6 +831,49 @@ func (p *DeploymentsRestartPoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } +// DeploymentsStartJFRPoller provides polling facilities until the operation reaches a terminal state. +type DeploymentsStartJFRPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *DeploymentsStartJFRPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *DeploymentsStartJFRPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final DeploymentsStartJFRResponse will be returned. +func (p *DeploymentsStartJFRPoller) FinalResponse(ctx context.Context) (DeploymentsStartJFRResponse, error) { + respType := DeploymentsStartJFRResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return DeploymentsStartJFRResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *DeploymentsStartJFRPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + // DeploymentsStartPoller provides polling facilities until the operation reaches a terminal state. type DeploymentsStartPoller struct { pt *azcore.Poller @@ -1047,6 +1175,92 @@ func (p *ServicesDeletePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } +// ServicesStartPoller provides polling facilities until the operation reaches a terminal state. +type ServicesStartPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *ServicesStartPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ServicesStartPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ServicesStartResponse will be returned. +func (p *ServicesStartPoller) FinalResponse(ctx context.Context) (ServicesStartResponse, error) { + respType := ServicesStartResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return ServicesStartResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ServicesStartPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// ServicesStopPoller provides polling facilities until the operation reaches a terminal state. +type ServicesStopPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *ServicesStopPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *ServicesStopPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final ServicesStopResponse will be returned. +func (p *ServicesStopPoller) FinalResponse(ctx context.Context) (ServicesStopResponse, error) { + respType := ServicesStopResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return ServicesStopResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *ServicesStopPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + // ServicesUpdatePoller provides polling facilities until the operation reaches a terminal state. type ServicesUpdatePoller struct { pt *azcore.Poller @@ -1089,3 +1303,89 @@ func (p *ServicesUpdatePoller) FinalResponse(ctx context.Context) (ServicesUpdat func (p *ServicesUpdatePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } + +// StoragesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type StoragesCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *StoragesCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *StoragesCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final StoragesCreateOrUpdateResponse will be returned. +func (p *StoragesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (StoragesCreateOrUpdateResponse, error) { + respType := StoragesCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.StorageResource) + if err != nil { + return StoragesCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *StoragesCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// StoragesDeletePoller provides polling facilities until the operation reaches a terminal state. +type StoragesDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *StoragesDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *StoragesDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final StoragesDeleteResponse will be returned. +func (p *StoragesDeletePoller) FinalResponse(ctx context.Context) (StoragesDeleteResponse, error) { + respType := StoragesDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return StoragesDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *StoragesDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} diff --git a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_polymorphic_helpers.go new file mode 100644 index 000000000000..be741109705b --- /dev/null +++ b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_polymorphic_helpers.go @@ -0,0 +1,181 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armappplatform + +import "encoding/json" + +func unmarshalCertificatePropertiesClassification(rawMsg json.RawMessage) (CertificatePropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b CertificatePropertiesClassification + switch m["type"] { + case "ContentCertificate": + b = &ContentCertificateProperties{} + case "KeyVaultCertificate": + b = &KeyVaultCertificateProperties{} + default: + b = &CertificateProperties{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalCertificatePropertiesClassificationArray(rawMsg json.RawMessage) ([]CertificatePropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]CertificatePropertiesClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalCertificatePropertiesClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalCertificatePropertiesClassificationMap(rawMsg json.RawMessage) (map[string]CertificatePropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]CertificatePropertiesClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalCertificatePropertiesClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + +func unmarshalCustomPersistentDiskPropertiesClassification(rawMsg json.RawMessage) (CustomPersistentDiskPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b CustomPersistentDiskPropertiesClassification + switch m["type"] { + case string(CustomPersistentDiskPropertiesTypeAzureFileVolume): + b = &AzureFileVolume{} + default: + b = &CustomPersistentDiskProperties{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalCustomPersistentDiskPropertiesClassificationArray(rawMsg json.RawMessage) ([]CustomPersistentDiskPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]CustomPersistentDiskPropertiesClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalCustomPersistentDiskPropertiesClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalCustomPersistentDiskPropertiesClassificationMap(rawMsg json.RawMessage) (map[string]CustomPersistentDiskPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]CustomPersistentDiskPropertiesClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalCustomPersistentDiskPropertiesClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + +func unmarshalStoragePropertiesClassification(rawMsg json.RawMessage) (StoragePropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b StoragePropertiesClassification + switch m["storageType"] { + case string(StoragePropertiesStorageTypeStorageAccount): + b = &StorageAccount{} + default: + b = &StorageProperties{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalStoragePropertiesClassificationArray(rawMsg json.RawMessage) ([]StoragePropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]StoragePropertiesClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalStoragePropertiesClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalStoragePropertiesClassificationMap(rawMsg json.RawMessage) (map[string]StoragePropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]StoragePropertiesClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalStoragePropertiesClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_response_types.go b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_response_types.go index dc5ba6f4e193..305bb2eea934 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_response_types.go +++ b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armappplatform import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // AppsCreateOrUpdatePollerResponse contains the response from method Apps.CreateOrUpdate. @@ -26,6 +25,8 @@ type AppsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AppsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AppsCreateOrUpdateResponse, error) { respType := AppsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AppResource) @@ -76,6 +77,8 @@ type AppsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AppsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AppsDeleteResponse, error) { respType := AppsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -156,6 +159,8 @@ type AppsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AppsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AppsUpdateResponse, error) { respType := AppsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AppResource) @@ -218,6 +223,8 @@ type BindingsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l BindingsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BindingsCreateOrUpdateResponse, error) { respType := BindingsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.BindingResource) @@ -268,6 +275,8 @@ type BindingsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l BindingsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BindingsDeleteResponse, error) { respType := BindingsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -336,6 +345,8 @@ type BindingsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l BindingsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BindingsUpdateResponse, error) { respType := BindingsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.BindingResource) @@ -386,6 +397,8 @@ type CertificatesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CertificatesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CertificatesCreateOrUpdateResponse, error) { respType := CertificatesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CertificateResource) @@ -436,6 +449,8 @@ type CertificatesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CertificatesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CertificatesDeleteResponse, error) { respType := CertificatesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -516,6 +531,8 @@ type ConfigServersUpdatePatchPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ConfigServersUpdatePatchPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ConfigServersUpdatePatchResponse, error) { respType := ConfigServersUpdatePatchResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ConfigServerResource) @@ -566,6 +583,8 @@ type ConfigServersUpdatePutPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ConfigServersUpdatePutPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ConfigServersUpdatePutResponse, error) { respType := ConfigServersUpdatePutResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ConfigServerResource) @@ -616,6 +635,8 @@ type ConfigServersValidatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ConfigServersValidatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ConfigServersValidateResponse, error) { respType := ConfigServersValidateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ConfigServerSettingsValidateResult) @@ -666,6 +687,8 @@ type CustomDomainsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CustomDomainsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CustomDomainsCreateOrUpdateResponse, error) { respType := CustomDomainsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CustomDomainResource) @@ -716,6 +739,8 @@ type CustomDomainsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CustomDomainsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CustomDomainsDeleteResponse, error) { respType := CustomDomainsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -784,6 +809,8 @@ type CustomDomainsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CustomDomainsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CustomDomainsUpdateResponse, error) { respType := CustomDomainsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CustomDomainResource) @@ -834,6 +861,8 @@ type DeploymentsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsCreateOrUpdateResponse, error) { respType := DeploymentsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DeploymentResource) @@ -884,6 +913,8 @@ type DeploymentsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsDeleteResponse, error) { respType := DeploymentsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -918,6 +949,98 @@ type DeploymentsDeleteResponse struct { RawResponse *http.Response } +// DeploymentsGenerateHeapDumpPollerResponse contains the response from method Deployments.GenerateHeapDump. +type DeploymentsGenerateHeapDumpPollerResponse struct { + // Poller contains an initialized poller. + Poller *DeploymentsGenerateHeapDumpPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l DeploymentsGenerateHeapDumpPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsGenerateHeapDumpResponse, error) { + respType := DeploymentsGenerateHeapDumpResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DeploymentsGenerateHeapDumpPollerResponse from the provided client and resume token. +func (l *DeploymentsGenerateHeapDumpPollerResponse) Resume(ctx context.Context, client *DeploymentsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DeploymentsClient.GenerateHeapDump", token, client.pl, client.generateHeapDumpHandleError) + if err != nil { + return err + } + poller := &DeploymentsGenerateHeapDumpPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DeploymentsGenerateHeapDumpResponse contains the response from method Deployments.GenerateHeapDump. +type DeploymentsGenerateHeapDumpResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// DeploymentsGenerateThreadDumpPollerResponse contains the response from method Deployments.GenerateThreadDump. +type DeploymentsGenerateThreadDumpPollerResponse struct { + // Poller contains an initialized poller. + Poller *DeploymentsGenerateThreadDumpPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l DeploymentsGenerateThreadDumpPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsGenerateThreadDumpResponse, error) { + respType := DeploymentsGenerateThreadDumpResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DeploymentsGenerateThreadDumpPollerResponse from the provided client and resume token. +func (l *DeploymentsGenerateThreadDumpPollerResponse) Resume(ctx context.Context, client *DeploymentsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DeploymentsClient.GenerateThreadDump", token, client.pl, client.generateThreadDumpHandleError) + if err != nil { + return err + } + poller := &DeploymentsGenerateThreadDumpPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DeploymentsGenerateThreadDumpResponse contains the response from method Deployments.GenerateThreadDump. +type DeploymentsGenerateThreadDumpResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + // DeploymentsGetLogFileURLResponse contains the response from method Deployments.GetLogFileURL. type DeploymentsGetLogFileURLResponse struct { DeploymentsGetLogFileURLResult @@ -976,6 +1099,8 @@ type DeploymentsRestartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsRestartResponse, error) { respType := DeploymentsRestartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1010,6 +1135,52 @@ type DeploymentsRestartResponse struct { RawResponse *http.Response } +// DeploymentsStartJFRPollerResponse contains the response from method Deployments.StartJFR. +type DeploymentsStartJFRPollerResponse struct { + // Poller contains an initialized poller. + Poller *DeploymentsStartJFRPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l DeploymentsStartJFRPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsStartJFRResponse, error) { + respType := DeploymentsStartJFRResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a DeploymentsStartJFRPollerResponse from the provided client and resume token. +func (l *DeploymentsStartJFRPollerResponse) Resume(ctx context.Context, client *DeploymentsClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("DeploymentsClient.StartJFR", token, client.pl, client.startJFRHandleError) + if err != nil { + return err + } + poller := &DeploymentsStartJFRPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// DeploymentsStartJFRResponse contains the response from method Deployments.StartJFR. +type DeploymentsStartJFRResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + // DeploymentsStartPollerResponse contains the response from method Deployments.Start. type DeploymentsStartPollerResponse struct { // Poller contains an initialized poller. @@ -1020,6 +1191,8 @@ type DeploymentsStartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsStartResponse, error) { respType := DeploymentsStartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1064,6 +1237,8 @@ type DeploymentsStopPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsStopResponse, error) { respType := DeploymentsStopResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1108,6 +1283,8 @@ type DeploymentsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsUpdateResponse, error) { respType := DeploymentsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DeploymentResource) @@ -1170,6 +1347,8 @@ type MonitoringSettingsUpdatePatchPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l MonitoringSettingsUpdatePatchPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MonitoringSettingsUpdatePatchResponse, error) { respType := MonitoringSettingsUpdatePatchResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.MonitoringSettingResource) @@ -1220,6 +1399,8 @@ type MonitoringSettingsUpdatePutPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l MonitoringSettingsUpdatePutPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MonitoringSettingsUpdatePutResponse, error) { respType := MonitoringSettingsUpdatePutResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.MonitoringSettingResource) @@ -1318,6 +1499,8 @@ type ServicesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServicesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServicesCreateOrUpdateResponse, error) { respType := ServicesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServiceResource) @@ -1368,6 +1551,8 @@ type ServicesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServicesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServicesDeleteResponse, error) { respType := ServicesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1480,6 +1665,98 @@ type ServicesRegenerateTestKeyResult struct { TestKeys } +// ServicesStartPollerResponse contains the response from method Services.Start. +type ServicesStartPollerResponse struct { + // Poller contains an initialized poller. + Poller *ServicesStartPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l ServicesStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServicesStartResponse, error) { + respType := ServicesStartResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ServicesStartPollerResponse from the provided client and resume token. +func (l *ServicesStartPollerResponse) Resume(ctx context.Context, client *ServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ServicesClient.Start", token, client.pl, client.startHandleError) + if err != nil { + return err + } + poller := &ServicesStartPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ServicesStartResponse contains the response from method Services.Start. +type ServicesStartResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// ServicesStopPollerResponse contains the response from method Services.Stop. +type ServicesStopPollerResponse struct { + // Poller contains an initialized poller. + Poller *ServicesStopPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l ServicesStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServicesStopResponse, error) { + respType := ServicesStopResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a ServicesStopPollerResponse from the provided client and resume token. +func (l *ServicesStopPollerResponse) Resume(ctx context.Context, client *ServicesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("ServicesClient.Stop", token, client.pl, client.stopHandleError) + if err != nil { + return err + } + poller := &ServicesStopPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// ServicesStopResponse contains the response from method Services.Stop. +type ServicesStopResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + // ServicesUpdatePollerResponse contains the response from method Services.Update. type ServicesUpdatePollerResponse struct { // Poller contains an initialized poller. @@ -1490,6 +1767,8 @@ type ServicesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServicesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServicesUpdateResponse, error) { respType := ServicesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServiceResource) @@ -1529,3 +1808,125 @@ type ServicesUpdateResponse struct { type ServicesUpdateResult struct { ServiceResource } + +// StoragesCreateOrUpdatePollerResponse contains the response from method Storages.CreateOrUpdate. +type StoragesCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *StoragesCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l StoragesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StoragesCreateOrUpdateResponse, error) { + respType := StoragesCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.StorageResource) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a StoragesCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *StoragesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *StoragesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("StoragesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &StoragesCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// StoragesCreateOrUpdateResponse contains the response from method Storages.CreateOrUpdate. +type StoragesCreateOrUpdateResponse struct { + StoragesCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StoragesCreateOrUpdateResult contains the result from method Storages.CreateOrUpdate. +type StoragesCreateOrUpdateResult struct { + StorageResource +} + +// StoragesDeletePollerResponse contains the response from method Storages.Delete. +type StoragesDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *StoragesDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l StoragesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StoragesDeleteResponse, error) { + respType := StoragesDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a StoragesDeletePollerResponse from the provided client and resume token. +func (l *StoragesDeletePollerResponse) Resume(ctx context.Context, client *StoragesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("StoragesClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &StoragesDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// StoragesDeleteResponse contains the response from method Storages.Delete. +type StoragesDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StoragesGetResponse contains the response from method Storages.Get. +type StoragesGetResponse struct { + StoragesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StoragesGetResult contains the result from method Storages.Get. +type StoragesGetResult struct { + StorageResource +} + +// StoragesListResponse contains the response from method Storages.List. +type StoragesListResponse struct { + StoragesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// StoragesListResult contains the result from method Storages.List. +type StoragesListResult struct { + StorageResourceCollection +} diff --git a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_runtimeversions_client.go b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_runtimeversions_client.go index 13ecef57ad3f..70fcea8b8d97 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_runtimeversions_client.go +++ b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_runtimeversions_client.go @@ -11,11 +11,12 @@ package armappplatform import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // RuntimeVersionsClient contains the methods for the RuntimeVersions group. @@ -26,8 +27,15 @@ type RuntimeVersionsClient struct { } // NewRuntimeVersionsClient creates a new instance of RuntimeVersionsClient with the specified values. -func NewRuntimeVersionsClient(con *arm.Connection) *RuntimeVersionsClient { - return &RuntimeVersionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewRuntimeVersionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *RuntimeVersionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RuntimeVersionsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListRuntimeVersions - Lists all of the available runtime versions supported by Microsoft.AppPlatform provider. @@ -55,7 +63,7 @@ func (client *RuntimeVersionsClient) listRuntimeVersionsCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -65,7 +73,7 @@ func (client *RuntimeVersionsClient) listRuntimeVersionsCreateRequest(ctx contex func (client *RuntimeVersionsClient) listRuntimeVersionsHandleResponse(resp *http.Response) (RuntimeVersionsListRuntimeVersionsResponse, error) { result := RuntimeVersionsListRuntimeVersionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailableRuntimeVersions); err != nil { - return RuntimeVersionsListRuntimeVersionsResponse{}, err + return RuntimeVersionsListRuntimeVersionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_services_client.go b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_services_client.go index 738dbed9719f..c5fc0ac62d36 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_services_client.go +++ b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_services_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServicesClient contains the methods for the Services group. @@ -31,8 +31,15 @@ type ServicesClient struct { } // NewServicesClient creates a new instance of ServicesClient with the specified values. -func NewServicesClient(con *arm.Connection, subscriptionID string) *ServicesClient { - return &ServicesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServicesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServicesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNameAvailability - Checks that the resource name is valid and is not already in use. @@ -68,7 +75,7 @@ func (client *ServicesClient) checkNameAvailabilityCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, availabilityParameters) @@ -78,7 +85,7 @@ func (client *ServicesClient) checkNameAvailabilityCreateRequest(ctx context.Con func (client *ServicesClient) checkNameAvailabilityHandleResponse(resp *http.Response) (ServicesCheckNameAvailabilityResponse, error) { result := ServicesCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NameAvailability); err != nil { - return ServicesCheckNameAvailabilityResponse{}, err + return ServicesCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -153,7 +160,7 @@ func (client *ServicesClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, resource) @@ -229,7 +236,7 @@ func (client *ServicesClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -285,7 +292,7 @@ func (client *ServicesClient) disableTestEndpointCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -341,7 +348,7 @@ func (client *ServicesClient) enableTestEndpointCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -351,7 +358,7 @@ func (client *ServicesClient) enableTestEndpointCreateRequest(ctx context.Contex func (client *ServicesClient) enableTestEndpointHandleResponse(resp *http.Response) (ServicesEnableTestEndpointResponse, error) { result := ServicesEnableTestEndpointResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TestKeys); err != nil { - return ServicesEnableTestEndpointResponse{}, err + return ServicesEnableTestEndpointResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -406,7 +413,7 @@ func (client *ServicesClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -416,7 +423,7 @@ func (client *ServicesClient) getCreateRequest(ctx context.Context, resourceGrou func (client *ServicesClient) getHandleResponse(resp *http.Response) (ServicesGetResponse, error) { result := ServicesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServiceResource); err != nil { - return ServicesGetResponse{}, err + return ServicesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -464,7 +471,7 @@ func (client *ServicesClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -474,7 +481,7 @@ func (client *ServicesClient) listCreateRequest(ctx context.Context, resourceGro func (client *ServicesClient) listHandleResponse(resp *http.Response) (ServicesListResponse, error) { result := ServicesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServiceResourceList); err != nil { - return ServicesListResponse{}, err + return ServicesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -518,7 +525,7 @@ func (client *ServicesClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -528,7 +535,7 @@ func (client *ServicesClient) listBySubscriptionCreateRequest(ctx context.Contex func (client *ServicesClient) listBySubscriptionHandleResponse(resp *http.Response) (ServicesListBySubscriptionResponse, error) { result := ServicesListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServiceResourceList); err != nil { - return ServicesListBySubscriptionResponse{}, err + return ServicesListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -583,7 +590,7 @@ func (client *ServicesClient) listTestKeysCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -593,7 +600,7 @@ func (client *ServicesClient) listTestKeysCreateRequest(ctx context.Context, res func (client *ServicesClient) listTestKeysHandleResponse(resp *http.Response) (ServicesListTestKeysResponse, error) { result := ServicesListTestKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TestKeys); err != nil { - return ServicesListTestKeysResponse{}, err + return ServicesListTestKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -648,7 +655,7 @@ func (client *ServicesClient) regenerateTestKeyCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, regenerateTestKeyRequest) @@ -658,7 +665,7 @@ func (client *ServicesClient) regenerateTestKeyCreateRequest(ctx context.Context func (client *ServicesClient) regenerateTestKeyHandleResponse(resp *http.Response) (ServicesRegenerateTestKeyResponse, error) { result := ServicesRegenerateTestKeyResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TestKeys); err != nil { - return ServicesRegenerateTestKeyResponse{}, err + return ServicesRegenerateTestKeyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -676,6 +683,174 @@ func (client *ServicesClient) regenerateTestKeyHandleError(resp *http.Response) return runtime.NewResponseError(&errType, resp) } +// BeginStart - Start a Service. +// If the operation fails it returns the *CloudError error type. +func (client *ServicesClient) BeginStart(ctx context.Context, resourceGroupName string, serviceName string, options *ServicesBeginStartOptions) (ServicesStartPollerResponse, error) { + resp, err := client.start(ctx, resourceGroupName, serviceName, options) + if err != nil { + return ServicesStartPollerResponse{}, err + } + result := ServicesStartPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("ServicesClient.Start", "azure-async-operation", resp, client.pl, client.startHandleError) + if err != nil { + return ServicesStartPollerResponse{}, err + } + result.Poller = &ServicesStartPoller{ + pt: pt, + } + return result, nil +} + +// Start - Start a Service. +// If the operation fails it returns the *CloudError error type. +func (client *ServicesClient) start(ctx context.Context, resourceGroupName string, serviceName string, options *ServicesBeginStartOptions) (*http.Response, error) { + req, err := client.startCreateRequest(ctx, resourceGroupName, serviceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, client.startHandleError(resp) + } + return resp, nil +} + +// startCreateRequest creates the Start request. +func (client *ServicesClient) startCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, options *ServicesBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/start" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// startHandleError handles the Start error response. +func (client *ServicesClient) startHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + switch resp.StatusCode { + case http.StatusNotFound, http.StatusConflict: + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) + default: + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) + } +} + +// BeginStop - Stop a Service. +// If the operation fails it returns the *CloudError error type. +func (client *ServicesClient) BeginStop(ctx context.Context, resourceGroupName string, serviceName string, options *ServicesBeginStopOptions) (ServicesStopPollerResponse, error) { + resp, err := client.stop(ctx, resourceGroupName, serviceName, options) + if err != nil { + return ServicesStopPollerResponse{}, err + } + result := ServicesStopPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("ServicesClient.Stop", "azure-async-operation", resp, client.pl, client.stopHandleError) + if err != nil { + return ServicesStopPollerResponse{}, err + } + result.Poller = &ServicesStopPoller{ + pt: pt, + } + return result, nil +} + +// Stop - Stop a Service. +// If the operation fails it returns the *CloudError error type. +func (client *ServicesClient) stop(ctx context.Context, resourceGroupName string, serviceName string, options *ServicesBeginStopOptions) (*http.Response, error) { + req, err := client.stopCreateRequest(ctx, resourceGroupName, serviceName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, client.stopHandleError(resp) + } + return resp, nil +} + +// stopCreateRequest creates the Stop request. +func (client *ServicesClient) stopCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, options *ServicesBeginStopOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/stop" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-09-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// stopHandleError handles the Stop error response. +func (client *ServicesClient) stopHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + switch resp.StatusCode { + case http.StatusNotFound, http.StatusConflict: + if len(body) == 0 { + return runtime.NewResponseError(errors.New(resp.Status), resp) + } + return runtime.NewResponseError(errors.New(string(body)), resp) + default: + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) + } +} + // BeginUpdate - Operation to update an exiting Service. // If the operation fails it returns the *CloudError error type. func (client *ServicesClient) BeginUpdate(ctx context.Context, resourceGroupName string, serviceName string, resource ServiceResource, options *ServicesBeginUpdateOptions) (ServicesUpdatePollerResponse, error) { @@ -733,7 +908,7 @@ func (client *ServicesClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, resource) diff --git a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_skus_client.go b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_skus_client.go index 4eb4820a7c0d..76e2fc990365 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_skus_client.go +++ b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_skus_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SKUsClient contains the methods for the SKUs group. @@ -30,8 +31,15 @@ type SKUsClient struct { } // NewSKUsClient creates a new instance of SKUsClient with the specified values. -func NewSKUsClient(con *arm.Connection, subscriptionID string) *SKUsClient { - return &SKUsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SKUsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SKUsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available skus of the Microsoft.AppPlatform provider. @@ -60,7 +68,7 @@ func (client *SKUsClient) listCreateRequest(ctx context.Context, options *SKUsLi return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -70,7 +78,7 @@ func (client *SKUsClient) listCreateRequest(ctx context.Context, options *SKUsLi func (client *SKUsClient) listHandleResponse(resp *http.Response) (SKUsListResponse, error) { result := SKUsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceSKUCollection); err != nil { - return SKUsListResponse{}, err + return SKUsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_service_client.go b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_storages_client.go similarity index 50% rename from sdk/resourcemanager/cosmos/armcosmos/zz_generated_service_client.go rename to sdk/resourcemanager/appplatform/armappplatform/zz_generated_storages_client.go index 45a70866f43f..a2c9fdf43193 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_service_client.go +++ b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_storages_client.go @@ -6,59 +6,66 @@ // Code generated by Microsoft (R) AutoRest Code Generator. // Changes may cause incorrect behavior and will be lost if the code is regenerated. -package armcosmos +package armappplatform import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) -// ServiceClient contains the methods for the Service group. -// Don't use this type directly, use NewServiceClient() instead. -type ServiceClient struct { +// StoragesClient contains the methods for the Storages group. +// Don't use this type directly, use NewStoragesClient() instead. +type StoragesClient struct { ep string pl runtime.Pipeline subscriptionID string } -// NewServiceClient creates a new instance of ServiceClient with the specified values. -func NewServiceClient(con *arm.Connection, subscriptionID string) *ServiceClient { - return &ServiceClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +// NewStoragesClient creates a new instance of StoragesClient with the specified values. +func NewStoragesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *StoragesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &StoragesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } -// BeginCreate - Creates a service. +// BeginCreateOrUpdate - Create or update storage resource. // If the operation fails it returns the *CloudError error type. -func (client *ServiceClient) BeginCreate(ctx context.Context, resourceGroupName string, accountName string, serviceName string, createUpdateParameters ServiceResourceCreateUpdateParameters, options *ServiceBeginCreateOptions) (ServiceCreatePollerResponse, error) { - resp, err := client.create(ctx, resourceGroupName, accountName, serviceName, createUpdateParameters, options) +func (client *StoragesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, storageName string, storageResource StorageResource, options *StoragesBeginCreateOrUpdateOptions) (StoragesCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, serviceName, storageName, storageResource, options) if err != nil { - return ServiceCreatePollerResponse{}, err + return StoragesCreateOrUpdatePollerResponse{}, err } - result := ServiceCreatePollerResponse{ + result := StoragesCreateOrUpdatePollerResponse{ RawResponse: resp, } - pt, err := armruntime.NewPoller("ServiceClient.Create", "", resp, client.pl, client.createHandleError) + pt, err := armruntime.NewPoller("StoragesClient.CreateOrUpdate", "azure-async-operation", resp, client.pl, client.createOrUpdateHandleError) if err != nil { - return ServiceCreatePollerResponse{}, err + return StoragesCreateOrUpdatePollerResponse{}, err } - result.Poller = &ServiceCreatePoller{ + result.Poller = &StoragesCreateOrUpdatePoller{ pt: pt, } return result, nil } -// Create - Creates a service. +// CreateOrUpdate - Create or update storage resource. // If the operation fails it returns the *CloudError error type. -func (client *ServiceClient) create(ctx context.Context, resourceGroupName string, accountName string, serviceName string, createUpdateParameters ServiceResourceCreateUpdateParameters, options *ServiceBeginCreateOptions) (*http.Response, error) { - req, err := client.createCreateRequest(ctx, resourceGroupName, accountName, serviceName, createUpdateParameters, options) +func (client *StoragesClient) createOrUpdate(ctx context.Context, resourceGroupName string, serviceName string, storageName string, storageResource StorageResource, options *StoragesBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, serviceName, storageName, storageResource, options) if err != nil { return nil, err } @@ -66,15 +73,15 @@ func (client *ServiceClient) create(ctx context.Context, resourceGroupName strin if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, client.createHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated, http.StatusAccepted) { + return nil, client.createOrUpdateHandleError(resp) } return resp, nil } -// createCreateRequest creates the Create request. -func (client *ServiceClient) createCreateRequest(ctx context.Context, resourceGroupName string, accountName string, serviceName string, createUpdateParameters ServiceResourceCreateUpdateParameters, options *ServiceBeginCreateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}" +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *StoragesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, storageName string, storageResource StorageResource, options *StoragesBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -83,27 +90,27 @@ func (client *ServiceClient) createCreateRequest(ctx context.Context, resourceGr return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if accountName == "" { - return nil, errors.New("parameter accountName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) if serviceName == "" { return nil, errors.New("parameter serviceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if storageName == "" { + return nil, errors.New("parameter storageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageName}", url.PathEscape(storageName)) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") - return req, runtime.MarshalAsJSON(req, createUpdateParameters) + return req, runtime.MarshalAsJSON(req, storageResource) } -// createHandleError handles the Create error response. -func (client *ServiceClient) createHandleError(resp *http.Response) error { +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *StoragesClient) createOrUpdateHandleError(resp *http.Response) error { body, err := runtime.Payload(resp) if err != nil { return runtime.NewResponseError(err, resp) @@ -115,30 +122,30 @@ func (client *ServiceClient) createHandleError(resp *http.Response) error { return runtime.NewResponseError(&errType, resp) } -// BeginDelete - Deletes service with the given serviceName. +// BeginDelete - Delete the storage resource. // If the operation fails it returns the *CloudError error type. -func (client *ServiceClient) BeginDelete(ctx context.Context, resourceGroupName string, accountName string, serviceName string, options *ServiceBeginDeleteOptions) (ServiceDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, accountName, serviceName, options) +func (client *StoragesClient) BeginDelete(ctx context.Context, resourceGroupName string, serviceName string, storageName string, options *StoragesBeginDeleteOptions) (StoragesDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, serviceName, storageName, options) if err != nil { - return ServiceDeletePollerResponse{}, err + return StoragesDeletePollerResponse{}, err } - result := ServiceDeletePollerResponse{ + result := StoragesDeletePollerResponse{ RawResponse: resp, } - pt, err := armruntime.NewPoller("ServiceClient.Delete", "", resp, client.pl, client.deleteHandleError) + pt, err := armruntime.NewPoller("StoragesClient.Delete", "azure-async-operation", resp, client.pl, client.deleteHandleError) if err != nil { - return ServiceDeletePollerResponse{}, err + return StoragesDeletePollerResponse{}, err } - result.Poller = &ServiceDeletePoller{ + result.Poller = &StoragesDeletePoller{ pt: pt, } return result, nil } -// Delete - Deletes service with the given serviceName. +// Delete - Delete the storage resource. // If the operation fails it returns the *CloudError error type. -func (client *ServiceClient) deleteOperation(ctx context.Context, resourceGroupName string, accountName string, serviceName string, options *ServiceBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, accountName, serviceName, options) +func (client *StoragesClient) deleteOperation(ctx context.Context, resourceGroupName string, serviceName string, storageName string, options *StoragesBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, serviceName, storageName, options) if err != nil { return nil, err } @@ -153,8 +160,8 @@ func (client *ServiceClient) deleteOperation(ctx context.Context, resourceGroupN } // deleteCreateRequest creates the Delete request. -func (client *ServiceClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, accountName string, serviceName string, options *ServiceBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}" +func (client *StoragesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, storageName string, options *StoragesBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -163,27 +170,27 @@ func (client *ServiceClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if accountName == "" { - return nil, errors.New("parameter accountName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) if serviceName == "" { return nil, errors.New("parameter serviceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if storageName == "" { + return nil, errors.New("parameter storageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageName}", url.PathEscape(storageName)) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil } // deleteHandleError handles the Delete error response. -func (client *ServiceClient) deleteHandleError(resp *http.Response) error { +func (client *StoragesClient) deleteHandleError(resp *http.Response) error { body, err := runtime.Payload(resp) if err != nil { return runtime.NewResponseError(err, resp) @@ -195,26 +202,26 @@ func (client *ServiceClient) deleteHandleError(resp *http.Response) error { return runtime.NewResponseError(&errType, resp) } -// Get - Gets the status of service. +// Get - Get the storage resource. // If the operation fails it returns the *CloudError error type. -func (client *ServiceClient) Get(ctx context.Context, resourceGroupName string, accountName string, serviceName string, options *ServiceGetOptions) (ServiceGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, accountName, serviceName, options) +func (client *StoragesClient) Get(ctx context.Context, resourceGroupName string, serviceName string, storageName string, options *StoragesGetOptions) (StoragesGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, serviceName, storageName, options) if err != nil { - return ServiceGetResponse{}, err + return StoragesGetResponse{}, err } resp, err := client.pl.Do(req) if err != nil { - return ServiceGetResponse{}, err + return StoragesGetResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServiceGetResponse{}, client.getHandleError(resp) + return StoragesGetResponse{}, client.getHandleError(resp) } return client.getHandleResponse(resp) } // getCreateRequest creates the Get request. -func (client *ServiceClient) getCreateRequest(ctx context.Context, resourceGroupName string, accountName string, serviceName string, options *ServiceGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services/{serviceName}" +func (client *StoragesClient) getCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, storageName string, options *StoragesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages/{storageName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -223,36 +230,36 @@ func (client *ServiceClient) getCreateRequest(ctx context.Context, resourceGroup return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if accountName == "" { - return nil, errors.New("parameter accountName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) if serviceName == "" { return nil, errors.New("parameter serviceName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) + if storageName == "" { + return nil, errors.New("parameter storageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{storageName}", url.PathEscape(storageName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil } // getHandleResponse handles the Get response. -func (client *ServiceClient) getHandleResponse(resp *http.Response) (ServiceGetResponse, error) { - result := ServiceGetResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.ServiceResource); err != nil { - return ServiceGetResponse{}, err +func (client *StoragesClient) getHandleResponse(resp *http.Response) (StoragesGetResponse, error) { + result := StoragesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.StorageResource); err != nil { + return StoragesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } // getHandleError handles the Get error response. -func (client *ServiceClient) getHandleError(resp *http.Response) error { +func (client *StoragesClient) getHandleError(resp *http.Response) error { body, err := runtime.Payload(resp) if err != nil { return runtime.NewResponseError(err, resp) @@ -264,26 +271,23 @@ func (client *ServiceClient) getHandleError(resp *http.Response) error { return runtime.NewResponseError(&errType, resp) } -// List - Gets the status of service. +// List - List all the storages of one Azure Spring Cloud instance. // If the operation fails it returns the *CloudError error type. -func (client *ServiceClient) List(ctx context.Context, resourceGroupName string, accountName string, options *ServiceListOptions) (ServiceListResponse, error) { - req, err := client.listCreateRequest(ctx, resourceGroupName, accountName, options) - if err != nil { - return ServiceListResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return ServiceListResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return ServiceListResponse{}, client.listHandleError(resp) +func (client *StoragesClient) List(resourceGroupName string, serviceName string, options *StoragesListOptions) *StoragesListPager { + return &StoragesListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, serviceName, options) + }, + advancer: func(ctx context.Context, resp StoragesListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.StorageResourceCollection.NextLink) + }, } - return client.listHandleResponse(resp) } // listCreateRequest creates the List request. -func (client *ServiceClient) listCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *ServiceListOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/services" +func (client *StoragesClient) listCreateRequest(ctx context.Context, resourceGroupName string, serviceName string, options *StoragesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.AppPlatform/Spring/{serviceName}/storages" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -292,32 +296,32 @@ func (client *ServiceClient) listCreateRequest(ctx context.Context, resourceGrou return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if accountName == "" { - return nil, errors.New("parameter accountName cannot be empty") + if serviceName == "" { + return nil, errors.New("parameter serviceName cannot be empty") } - urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + urlPath = strings.ReplaceAll(urlPath, "{serviceName}", url.PathEscape(serviceName)) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-09-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil } // listHandleResponse handles the List response. -func (client *ServiceClient) listHandleResponse(resp *http.Response) (ServiceListResponse, error) { - result := ServiceListResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.ServiceResourceListResult); err != nil { - return ServiceListResponse{}, err +func (client *StoragesClient) listHandleResponse(resp *http.Response) (StoragesListResponse, error) { + result := StoragesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.StorageResourceCollection); err != nil { + return StoragesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } // listHandleError handles the List error response. -func (client *ServiceClient) listHandleError(resp *http.Response) error { +func (client *StoragesClient) listHandleError(resp *http.Response) error { body, err := runtime.Payload(resp) if err != nil { return runtime.NewResponseError(err, resp) diff --git a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_time_rfc3339.go b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_time_rfc3339.go index 8f868efb72fa..d1d133e571e1 100644 --- a/sdk/resourcemanager/appplatform/armappplatform/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/appplatform/armappplatform/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armappplatform import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md b/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md index 996e8331f4e9..ec84d390a80e 100644 --- a/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md +++ b/sdk/resourcemanager/authorization/armauthorization/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-10-08) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armauthorization". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/authorization/armauthorization") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/authorization/armauthorization/README.md b/sdk/resourcemanager/authorization/armauthorization/README.md index 1ed8b7a6bc83..b4028a67cda6 100644 --- a/sdk/resourcemanager/authorization/armauthorization/README.md +++ b/sdk/resourcemanager/authorization/armauthorization/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Authorization +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Authorization modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armauthorization.NewPermissionsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Authorization modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armauthorization.NewPermissionsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armauthorization.NewPermissionsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/authorization/armauthorization/autorest.md b/sdk/resourcemanager/authorization/armauthorization/autorest.md index 4409aee89844..01c6845538ce 100644 --- a/sdk/resourcemanager/authorization/armauthorization/autorest.md +++ b/sdk/resourcemanager/authorization/armauthorization/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/authorization/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/authorization/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/authorization/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/authorization/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/authorization/armauthorization/go.mod b/sdk/resourcemanager/authorization/armauthorization/go.mod index bf4535922e74..6b3360587b0b 100644 --- a/sdk/resourcemanager/authorization/armauthorization/go.mod +++ b/sdk/resourcemanager/authorization/armauthorization/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/authorization/armau go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/authorization/armauthorization/go.sum b/sdk/resourcemanager/authorization/armauthorization/go.sum index 4f0fb709cf31..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/authorization/armauthorization/go.sum +++ b/sdk/resourcemanager/authorization/armauthorization/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible h1:Cw16jiP4dI+CK761aq44ol4RV5dUiIIXky1+EKpoiVM= -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewdefaultsettings_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewdefaultsettings_client.go index 4983450aaee3..db336288d2dd 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewdefaultsettings_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewdefaultsettings_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AccessReviewDefaultSettingsClient contains the methods for the AccessReviewDefaultSettings group. @@ -30,8 +31,15 @@ type AccessReviewDefaultSettingsClient struct { } // NewAccessReviewDefaultSettingsClient creates a new instance of AccessReviewDefaultSettingsClient with the specified values. -func NewAccessReviewDefaultSettingsClient(con *arm.Connection, subscriptionID string) *AccessReviewDefaultSettingsClient { - return &AccessReviewDefaultSettingsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAccessReviewDefaultSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AccessReviewDefaultSettingsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AccessReviewDefaultSettingsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get access review default settings for the subscription @@ -73,7 +81,7 @@ func (client *AccessReviewDefaultSettingsClient) getCreateRequest(ctx context.Co func (client *AccessReviewDefaultSettingsClient) getHandleResponse(resp *http.Response) (AccessReviewDefaultSettingsGetResponse, error) { result := AccessReviewDefaultSettingsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDefaultSettings); err != nil { - return AccessReviewDefaultSettingsGetResponse{}, err + return AccessReviewDefaultSettingsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -130,7 +138,7 @@ func (client *AccessReviewDefaultSettingsClient) putCreateRequest(ctx context.Co func (client *AccessReviewDefaultSettingsClient) putHandleResponse(resp *http.Response) (AccessReviewDefaultSettingsPutResponse, error) { result := AccessReviewDefaultSettingsPutResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDefaultSettings); err != nil { - return AccessReviewDefaultSettingsPutResponse{}, err + return AccessReviewDefaultSettingsPutResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstance_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstance_client.go index 561df6257e06..20c30987e542 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstance_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstance_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AccessReviewInstanceClient contains the methods for the AccessReviewInstance group. @@ -30,8 +31,15 @@ type AccessReviewInstanceClient struct { } // NewAccessReviewInstanceClient creates a new instance of AccessReviewInstanceClient with the specified values. -func NewAccessReviewInstanceClient(con *arm.Connection, subscriptionID string) *AccessReviewInstanceClient { - return &AccessReviewInstanceClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAccessReviewInstanceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AccessReviewInstanceClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AccessReviewInstanceClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // AcceptRecommendations - An action to accept recommendations for decision in an access review instance. diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstancedecisions_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstancedecisions_client.go index b407233b8aa7..f9612437c21e 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstancedecisions_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstancedecisions_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AccessReviewInstanceDecisionsClient contains the methods for the AccessReviewInstanceDecisions group. @@ -30,8 +31,15 @@ type AccessReviewInstanceDecisionsClient struct { } // NewAccessReviewInstanceDecisionsClient creates a new instance of AccessReviewInstanceDecisionsClient with the specified values. -func NewAccessReviewInstanceDecisionsClient(con *arm.Connection, subscriptionID string) *AccessReviewInstanceDecisionsClient { - return &AccessReviewInstanceDecisionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAccessReviewInstanceDecisionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AccessReviewInstanceDecisionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AccessReviewInstanceDecisionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Get access review instance decisions @@ -78,7 +86,7 @@ func (client *AccessReviewInstanceDecisionsClient) listCreateRequest(ctx context func (client *AccessReviewInstanceDecisionsClient) listHandleResponse(resp *http.Response) (AccessReviewInstanceDecisionsListResponse, error) { result := AccessReviewInstanceDecisionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDecisionListResult); err != nil { - return AccessReviewInstanceDecisionsListResponse{}, err + return AccessReviewInstanceDecisionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstancemydecisions_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstancemydecisions_client.go index 4ef83d1f9166..9fa168fed6b5 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstancemydecisions_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstancemydecisions_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AccessReviewInstanceMyDecisionsClient contains the methods for the AccessReviewInstanceMyDecisions group. @@ -29,8 +30,15 @@ type AccessReviewInstanceMyDecisionsClient struct { } // NewAccessReviewInstanceMyDecisionsClient creates a new instance of AccessReviewInstanceMyDecisionsClient with the specified values. -func NewAccessReviewInstanceMyDecisionsClient(con *arm.Connection) *AccessReviewInstanceMyDecisionsClient { - return &AccessReviewInstanceMyDecisionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewAccessReviewInstanceMyDecisionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *AccessReviewInstanceMyDecisionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AccessReviewInstanceMyDecisionsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetByID - Get my single access review instance decision. @@ -80,7 +88,7 @@ func (client *AccessReviewInstanceMyDecisionsClient) getByIDCreateRequest(ctx co func (client *AccessReviewInstanceMyDecisionsClient) getByIDHandleResponse(resp *http.Response) (AccessReviewInstanceMyDecisionsGetByIDResponse, error) { result := AccessReviewInstanceMyDecisionsGetByIDResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDecision); err != nil { - return AccessReviewInstanceMyDecisionsGetByIDResponse{}, err + return AccessReviewInstanceMyDecisionsGetByIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -138,7 +146,7 @@ func (client *AccessReviewInstanceMyDecisionsClient) listCreateRequest(ctx conte func (client *AccessReviewInstanceMyDecisionsClient) listHandleResponse(resp *http.Response) (AccessReviewInstanceMyDecisionsListResponse, error) { result := AccessReviewInstanceMyDecisionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDecisionListResult); err != nil { - return AccessReviewInstanceMyDecisionsListResponse{}, err + return AccessReviewInstanceMyDecisionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -203,7 +211,7 @@ func (client *AccessReviewInstanceMyDecisionsClient) patchCreateRequest(ctx cont func (client *AccessReviewInstanceMyDecisionsClient) patchHandleResponse(resp *http.Response) (AccessReviewInstanceMyDecisionsPatchResponse, error) { result := AccessReviewInstanceMyDecisionsPatchResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewDecision); err != nil { - return AccessReviewInstanceMyDecisionsPatchResponse{}, err + return AccessReviewInstanceMyDecisionsPatchResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstances_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstances_client.go index b110fa5df919..9e724614bf54 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstances_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstances_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AccessReviewInstancesClient contains the methods for the AccessReviewInstances group. @@ -30,8 +31,15 @@ type AccessReviewInstancesClient struct { } // NewAccessReviewInstancesClient creates a new instance of AccessReviewInstancesClient with the specified values. -func NewAccessReviewInstancesClient(con *arm.Connection, subscriptionID string) *AccessReviewInstancesClient { - return &AccessReviewInstancesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAccessReviewInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AccessReviewInstancesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AccessReviewInstancesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetByID - Get access review instances @@ -81,7 +89,7 @@ func (client *AccessReviewInstancesClient) getByIDCreateRequest(ctx context.Cont func (client *AccessReviewInstancesClient) getByIDHandleResponse(resp *http.Response) (AccessReviewInstancesGetByIDResponse, error) { result := AccessReviewInstancesGetByIDResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstance); err != nil { - return AccessReviewInstancesGetByIDResponse{}, err + return AccessReviewInstancesGetByIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -139,7 +147,7 @@ func (client *AccessReviewInstancesClient) listCreateRequest(ctx context.Context func (client *AccessReviewInstancesClient) listHandleResponse(resp *http.Response) (AccessReviewInstancesListResponse, error) { result := AccessReviewInstancesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstanceListResult); err != nil { - return AccessReviewInstancesListResponse{}, err + return AccessReviewInstancesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstancesassignedformyapproval_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstancesassignedformyapproval_client.go index e01634135402..0f76dfe811d0 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstancesassignedformyapproval_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewinstancesassignedformyapproval_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AccessReviewInstancesAssignedForMyApprovalClient contains the methods for the AccessReviewInstancesAssignedForMyApproval group. @@ -29,8 +30,15 @@ type AccessReviewInstancesAssignedForMyApprovalClient struct { } // NewAccessReviewInstancesAssignedForMyApprovalClient creates a new instance of AccessReviewInstancesAssignedForMyApprovalClient with the specified values. -func NewAccessReviewInstancesAssignedForMyApprovalClient(con *arm.Connection) *AccessReviewInstancesAssignedForMyApprovalClient { - return &AccessReviewInstancesAssignedForMyApprovalClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewAccessReviewInstancesAssignedForMyApprovalClient(credential azcore.TokenCredential, options *arm.ClientOptions) *AccessReviewInstancesAssignedForMyApprovalClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AccessReviewInstancesAssignedForMyApprovalClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetByID - Get single access review instance assigned for my approval. @@ -76,7 +84,7 @@ func (client *AccessReviewInstancesAssignedForMyApprovalClient) getByIDCreateReq func (client *AccessReviewInstancesAssignedForMyApprovalClient) getByIDHandleResponse(resp *http.Response) (AccessReviewInstancesAssignedForMyApprovalGetByIDResponse, error) { result := AccessReviewInstancesAssignedForMyApprovalGetByIDResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstance); err != nil { - return AccessReviewInstancesAssignedForMyApprovalGetByIDResponse{}, err + return AccessReviewInstancesAssignedForMyApprovalGetByIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -130,7 +138,7 @@ func (client *AccessReviewInstancesAssignedForMyApprovalClient) listCreateReques func (client *AccessReviewInstancesAssignedForMyApprovalClient) listHandleResponse(resp *http.Response) (AccessReviewInstancesAssignedForMyApprovalListResponse, error) { result := AccessReviewInstancesAssignedForMyApprovalListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewInstanceListResult); err != nil { - return AccessReviewInstancesAssignedForMyApprovalListResponse{}, err + return AccessReviewInstancesAssignedForMyApprovalListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewscheduledefinitions_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewscheduledefinitions_client.go index 1846f021835b..e6810332b896 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewscheduledefinitions_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewscheduledefinitions_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AccessReviewScheduleDefinitionsClient contains the methods for the AccessReviewScheduleDefinitions group. @@ -30,8 +31,15 @@ type AccessReviewScheduleDefinitionsClient struct { } // NewAccessReviewScheduleDefinitionsClient creates a new instance of AccessReviewScheduleDefinitionsClient with the specified values. -func NewAccessReviewScheduleDefinitionsClient(con *arm.Connection, subscriptionID string) *AccessReviewScheduleDefinitionsClient { - return &AccessReviewScheduleDefinitionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAccessReviewScheduleDefinitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AccessReviewScheduleDefinitionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AccessReviewScheduleDefinitionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdateByID - Create or Update access review schedule definition. @@ -77,7 +85,7 @@ func (client *AccessReviewScheduleDefinitionsClient) createOrUpdateByIDCreateReq func (client *AccessReviewScheduleDefinitionsClient) createOrUpdateByIDHandleResponse(resp *http.Response) (AccessReviewScheduleDefinitionsCreateOrUpdateByIDResponse, error) { result := AccessReviewScheduleDefinitionsCreateOrUpdateByIDResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewScheduleDefinition); err != nil { - return AccessReviewScheduleDefinitionsCreateOrUpdateByIDResponse{}, err + return AccessReviewScheduleDefinitionsCreateOrUpdateByIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -190,7 +198,7 @@ func (client *AccessReviewScheduleDefinitionsClient) getByIDCreateRequest(ctx co func (client *AccessReviewScheduleDefinitionsClient) getByIDHandleResponse(resp *http.Response) (AccessReviewScheduleDefinitionsGetByIDResponse, error) { result := AccessReviewScheduleDefinitionsGetByIDResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewScheduleDefinition); err != nil { - return AccessReviewScheduleDefinitionsGetByIDResponse{}, err + return AccessReviewScheduleDefinitionsGetByIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -244,7 +252,7 @@ func (client *AccessReviewScheduleDefinitionsClient) listCreateRequest(ctx conte func (client *AccessReviewScheduleDefinitionsClient) listHandleResponse(resp *http.Response) (AccessReviewScheduleDefinitionsListResponse, error) { result := AccessReviewScheduleDefinitionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewScheduleDefinitionListResult); err != nil { - return AccessReviewScheduleDefinitionsListResponse{}, err + return AccessReviewScheduleDefinitionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewscheduledefinitionsassignedformyapproval_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewscheduledefinitionsassignedformyapproval_client.go index 3c9ba57db8e3..e701c0d93b6a 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewscheduledefinitionsassignedformyapproval_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_accessreviewscheduledefinitionsassignedformyapproval_client.go @@ -11,11 +11,12 @@ package armauthorization import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // AccessReviewScheduleDefinitionsAssignedForMyApprovalClient contains the methods for the AccessReviewScheduleDefinitionsAssignedForMyApproval group. @@ -26,8 +27,15 @@ type AccessReviewScheduleDefinitionsAssignedForMyApprovalClient struct { } // NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient creates a new instance of AccessReviewScheduleDefinitionsAssignedForMyApprovalClient with the specified values. -func NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient(con *arm.Connection) *AccessReviewScheduleDefinitionsAssignedForMyApprovalClient { - return &AccessReviewScheduleDefinitionsAssignedForMyApprovalClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewAccessReviewScheduleDefinitionsAssignedForMyApprovalClient(credential azcore.TokenCredential, options *arm.ClientOptions) *AccessReviewScheduleDefinitionsAssignedForMyApprovalClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AccessReviewScheduleDefinitionsAssignedForMyApprovalClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Get access review instances assigned for my approval. @@ -62,7 +70,7 @@ func (client *AccessReviewScheduleDefinitionsAssignedForMyApprovalClient) listCr func (client *AccessReviewScheduleDefinitionsAssignedForMyApprovalClient) listHandleResponse(resp *http.Response) (AccessReviewScheduleDefinitionsAssignedForMyApprovalListResponse, error) { result := AccessReviewScheduleDefinitionsAssignedForMyApprovalListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessReviewScheduleDefinitionListResult); err != nil { - return AccessReviewScheduleDefinitionsAssignedForMyApprovalListResponse{}, err + return AccessReviewScheduleDefinitionsAssignedForMyApprovalListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_constants.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_constants.go index c3a885d4c704..655766b8a92b 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_constants.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_constants.go @@ -10,7 +10,7 @@ package armauthorization const ( module = "armauthorization" - version = "v0.1.0" + version = "v0.2.0" ) // AccessRecommendationType - The feature- generated recommendation shown to the reviewer. diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_denyassignments_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_denyassignments_client.go index a80fed7932d0..8608ccfc94e3 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_denyassignments_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_denyassignments_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DenyAssignmentsClient contains the methods for the DenyAssignments group. @@ -30,8 +31,15 @@ type DenyAssignmentsClient struct { } // NewDenyAssignmentsClient creates a new instance of DenyAssignmentsClient with the specified values. -func NewDenyAssignmentsClient(con *arm.Connection, subscriptionID string) *DenyAssignmentsClient { - return &DenyAssignmentsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDenyAssignmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DenyAssignmentsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DenyAssignmentsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get the specified deny assignment. @@ -54,9 +62,6 @@ func (client *DenyAssignmentsClient) Get(ctx context.Context, scope string, deny // getCreateRequest creates the Get request. func (client *DenyAssignmentsClient) getCreateRequest(ctx context.Context, scope string, denyAssignmentID string, options *DenyAssignmentsGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/denyAssignments/{denyAssignmentId}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if denyAssignmentID == "" { return nil, errors.New("parameter denyAssignmentID cannot be empty") @@ -77,7 +82,7 @@ func (client *DenyAssignmentsClient) getCreateRequest(ctx context.Context, scope func (client *DenyAssignmentsClient) getHandleResponse(resp *http.Response) (DenyAssignmentsGetResponse, error) { result := DenyAssignmentsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignment); err != nil { - return DenyAssignmentsGetResponse{}, err + return DenyAssignmentsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -115,9 +120,6 @@ func (client *DenyAssignmentsClient) GetByID(ctx context.Context, denyAssignment // getByIDCreateRequest creates the GetByID request. func (client *DenyAssignmentsClient) getByIDCreateRequest(ctx context.Context, denyAssignmentID string, options *DenyAssignmentsGetByIDOptions) (*policy.Request, error) { urlPath := "/{denyAssignmentId}" - if denyAssignmentID == "" { - return nil, errors.New("parameter denyAssignmentID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{denyAssignmentId}", denyAssignmentID) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -134,7 +136,7 @@ func (client *DenyAssignmentsClient) getByIDCreateRequest(ctx context.Context, d func (client *DenyAssignmentsClient) getByIDHandleResponse(resp *http.Response) (DenyAssignmentsGetByIDResponse, error) { result := DenyAssignmentsGetByIDResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignment); err != nil { - return DenyAssignmentsGetByIDResponse{}, err + return DenyAssignmentsGetByIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -191,7 +193,7 @@ func (client *DenyAssignmentsClient) listCreateRequest(ctx context.Context, opti func (client *DenyAssignmentsClient) listHandleResponse(resp *http.Response) (DenyAssignmentsListResponse, error) { result := DenyAssignmentsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignmentListResult); err != nil { - return DenyAssignmentsListResponse{}, err + return DenyAssignmentsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -234,17 +236,8 @@ func (client *DenyAssignmentsClient) listForResourceCreateRequest(ctx context.Co return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if resourceProviderNamespace == "" { - return nil, errors.New("parameter resourceProviderNamespace cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", resourceProviderNamespace) - if parentResourcePath == "" { - return nil, errors.New("parameter parentResourcePath cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{parentResourcePath}", parentResourcePath) - if resourceType == "" { - return nil, errors.New("parameter resourceType cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) if resourceName == "" { return nil, errors.New("parameter resourceName cannot be empty") @@ -268,7 +261,7 @@ func (client *DenyAssignmentsClient) listForResourceCreateRequest(ctx context.Co func (client *DenyAssignmentsClient) listForResourceHandleResponse(resp *http.Response) (DenyAssignmentsListForResourceResponse, error) { result := DenyAssignmentsListForResourceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignmentListResult); err != nil { - return DenyAssignmentsListForResourceResponse{}, err + return DenyAssignmentsListForResourceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -329,7 +322,7 @@ func (client *DenyAssignmentsClient) listForResourceGroupCreateRequest(ctx conte func (client *DenyAssignmentsClient) listForResourceGroupHandleResponse(resp *http.Response) (DenyAssignmentsListForResourceGroupResponse, error) { result := DenyAssignmentsListForResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignmentListResult); err != nil { - return DenyAssignmentsListForResourceGroupResponse{}, err + return DenyAssignmentsListForResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -364,9 +357,6 @@ func (client *DenyAssignmentsClient) ListForScope(scope string, options *DenyAss // listForScopeCreateRequest creates the ListForScope request. func (client *DenyAssignmentsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *DenyAssignmentsListForScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/denyAssignments" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -386,7 +376,7 @@ func (client *DenyAssignmentsClient) listForScopeCreateRequest(ctx context.Conte func (client *DenyAssignmentsClient) listForScopeHandleResponse(resp *http.Response) (DenyAssignmentsListForScopeResponse, error) { result := DenyAssignmentsListForScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DenyAssignmentListResult); err != nil { - return DenyAssignmentsListForScopeResponse{}, err + return DenyAssignmentsListForScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_eligiblechildresources_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_eligiblechildresources_client.go index 17bb1d5189b3..453ce54f3405 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_eligiblechildresources_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_eligiblechildresources_client.go @@ -10,14 +10,14 @@ package armauthorization import ( "context" - "errors" "fmt" - "net/http" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" ) // EligibleChildResourcesClient contains the methods for the EligibleChildResources group. @@ -28,8 +28,15 @@ type EligibleChildResourcesClient struct { } // NewEligibleChildResourcesClient creates a new instance of EligibleChildResourcesClient with the specified values. -func NewEligibleChildResourcesClient(con *arm.Connection) *EligibleChildResourcesClient { - return &EligibleChildResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewEligibleChildResourcesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *EligibleChildResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &EligibleChildResourcesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get the child resources of a resource on which user has eligible access @@ -49,9 +56,6 @@ func (client *EligibleChildResourcesClient) Get(scope string, options *EligibleC // getCreateRequest creates the Get request. func (client *EligibleChildResourcesClient) getCreateRequest(ctx context.Context, scope string, options *EligibleChildResourcesGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/eligibleChildResources" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -71,7 +75,7 @@ func (client *EligibleChildResourcesClient) getCreateRequest(ctx context.Context func (client *EligibleChildResourcesClient) getHandleResponse(resp *http.Response) (EligibleChildResourcesGetResponse, error) { result := EligibleChildResourcesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EligibleChildResourcesListResult); err != nil { - return EligibleChildResourcesGetResponse{}, err + return EligibleChildResourcesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_models.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_models.go index 0679f7f9ebfa..c14a90a82c74 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_models.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_models.go @@ -10,10 +10,9 @@ package armauthorization import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // AccessReviewActorIdentity - Details of the actor identity @@ -97,13 +96,13 @@ type AccessReviewDecisionProperties struct { func (a AccessReviewDecisionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "appliedBy", a.AppliedBy) - populate(objectMap, "appliedDateTime", (*timeRFC3339)(a.AppliedDateTime)) + populateTimeRFC3339(objectMap, "appliedDateTime", a.AppliedDateTime) populate(objectMap, "applyResult", a.ApplyResult) populate(objectMap, "decision", a.Decision) populate(objectMap, "justification", a.Justification) populate(objectMap, "recommendation", a.Recommendation) populate(objectMap, "reviewedBy", a.ReviewedBy) - populate(objectMap, "reviewedDateTime", (*timeRFC3339)(a.ReviewedDateTime)) + populateTimeRFC3339(objectMap, "reviewedDateTime", a.ReviewedDateTime) populate(objectMap, "target", a.Target) return json.Marshal(objectMap) } @@ -121,9 +120,7 @@ func (a *AccessReviewDecisionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.AppliedBy) delete(rawMsg, key) case "appliedDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.AppliedDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.AppliedDateTime) delete(rawMsg, key) case "applyResult": err = unpopulate(val, &a.ApplyResult) @@ -141,9 +138,7 @@ func (a *AccessReviewDecisionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.ReviewedBy) delete(rawMsg, key) case "reviewedDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.ReviewedDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.ReviewedDateTime) delete(rawMsg, key) case "target": a.Target, err = unmarshalAccessReviewDecisionTargetClassification(val) @@ -307,8 +302,8 @@ type AccessReviewInstanceProperties struct { // MarshalJSON implements the json.Marshaller interface for type AccessReviewInstanceProperties. func (a AccessReviewInstanceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "endDateTime", (*timeRFC3339)(a.EndDateTime)) - populate(objectMap, "startDateTime", (*timeRFC3339)(a.StartDateTime)) + populateTimeRFC3339(objectMap, "endDateTime", a.EndDateTime) + populateTimeRFC3339(objectMap, "startDateTime", a.StartDateTime) populate(objectMap, "status", a.Status) return json.Marshal(objectMap) } @@ -323,14 +318,10 @@ func (a *AccessReviewInstanceProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "endDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.EndDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.EndDateTime) delete(rawMsg, key) case "startDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.StartDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.StartDateTime) delete(rawMsg, key) case "status": err = unpopulate(val, &a.Status) @@ -406,9 +397,9 @@ type AccessReviewRecurrenceRange struct { // MarshalJSON implements the json.Marshaller interface for type AccessReviewRecurrenceRange. func (a AccessReviewRecurrenceRange) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "endDate", (*timeRFC3339)(a.EndDate)) + populateTimeRFC3339(objectMap, "endDate", a.EndDate) populate(objectMap, "numberOfOccurrences", a.NumberOfOccurrences) - populate(objectMap, "startDate", (*timeRFC3339)(a.StartDate)) + populateTimeRFC3339(objectMap, "startDate", a.StartDate) populate(objectMap, "type", a.Type) return json.Marshal(objectMap) } @@ -423,17 +414,13 @@ func (a *AccessReviewRecurrenceRange) UnmarshalJSON(data []byte) error { var err error switch key { case "endDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.EndDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.EndDate) delete(rawMsg, key) case "numberOfOccurrences": err = unpopulate(val, &a.NumberOfOccurrences) delete(rawMsg, key) case "startDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.StartDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.StartDate) delete(rawMsg, key) case "type": err = unpopulate(val, &a.Type) @@ -1165,7 +1152,7 @@ func (p PolicyAssignmentPropertiesPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "id", p.ID) populate(objectMap, "lastModifiedBy", p.LastModifiedBy) - populate(objectMap, "lastModifiedDateTime", (*timeRFC3339)(p.LastModifiedDateTime)) + populateTimeRFC3339(objectMap, "lastModifiedDateTime", p.LastModifiedDateTime) return json.Marshal(objectMap) } @@ -1185,9 +1172,7 @@ func (p *PolicyAssignmentPropertiesPolicy) UnmarshalJSON(data []byte) error { err = unpopulate(val, &p.LastModifiedBy) delete(rawMsg, key) case "lastModifiedDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - p.LastModifiedDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &p.LastModifiedDateTime) delete(rawMsg, key) } if err != nil { @@ -1468,7 +1453,7 @@ func (r RoleAssignmentProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "condition", r.Condition) populate(objectMap, "conditionVersion", r.ConditionVersion) populate(objectMap, "createdBy", r.CreatedBy) - populate(objectMap, "createdOn", (*timeRFC3339)(r.CreatedOn)) + populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) populate(objectMap, "delegatedManagedIdentityResourceId", r.DelegatedManagedIdentityResourceID) populate(objectMap, "description", r.Description) populate(objectMap, "principalId", r.PrincipalID) @@ -1476,7 +1461,7 @@ func (r RoleAssignmentProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) populate(objectMap, "scope", r.Scope) populate(objectMap, "updatedBy", r.UpdatedBy) - populate(objectMap, "updatedOn", (*timeRFC3339)(r.UpdatedOn)) + populateTimeRFC3339(objectMap, "updatedOn", r.UpdatedOn) return json.Marshal(objectMap) } @@ -1499,9 +1484,7 @@ func (r *RoleAssignmentProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.CreatedBy) delete(rawMsg, key) case "createdOn": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreatedOn = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.CreatedOn) delete(rawMsg, key) case "delegatedManagedIdentityResourceId": err = unpopulate(val, &r.DelegatedManagedIdentityResourceID) @@ -1525,9 +1508,7 @@ func (r *RoleAssignmentProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.UpdatedBy) delete(rawMsg, key) case "updatedOn": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.UpdatedOn = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.UpdatedOn) delete(rawMsg, key) } if err != nil { @@ -1673,8 +1654,8 @@ func (r RoleAssignmentScheduleInstanceProperties) MarshalJSON() ([]byte, error) populate(objectMap, "assignmentType", r.AssignmentType) populate(objectMap, "condition", r.Condition) populate(objectMap, "conditionVersion", r.ConditionVersion) - populate(objectMap, "createdOn", (*timeRFC3339)(r.CreatedOn)) - populate(objectMap, "endDateTime", (*timeRFC3339)(r.EndDateTime)) + populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) + populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) populate(objectMap, "expandedProperties", r.ExpandedProperties) populate(objectMap, "linkedRoleEligibilityScheduleId", r.LinkedRoleEligibilityScheduleID) populate(objectMap, "linkedRoleEligibilityScheduleInstanceId", r.LinkedRoleEligibilityScheduleInstanceID) @@ -1685,7 +1666,7 @@ func (r RoleAssignmentScheduleInstanceProperties) MarshalJSON() ([]byte, error) populate(objectMap, "roleAssignmentScheduleId", r.RoleAssignmentScheduleID) populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) populate(objectMap, "scope", r.Scope) - populate(objectMap, "startDateTime", (*timeRFC3339)(r.StartDateTime)) + populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) populate(objectMap, "status", r.Status) return json.Marshal(objectMap) } @@ -1709,14 +1690,10 @@ func (r *RoleAssignmentScheduleInstanceProperties) UnmarshalJSON(data []byte) er err = unpopulate(val, &r.ConditionVersion) delete(rawMsg, key) case "createdOn": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreatedOn = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.CreatedOn) delete(rawMsg, key) case "endDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.EndDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.EndDateTime) delete(rawMsg, key) case "expandedProperties": err = unpopulate(val, &r.ExpandedProperties) @@ -1749,9 +1726,7 @@ func (r *RoleAssignmentScheduleInstanceProperties) UnmarshalJSON(data []byte) er err = unpopulate(val, &r.Scope) delete(rawMsg, key) case "startDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.StartDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.StartDateTime) delete(rawMsg, key) case "status": err = unpopulate(val, &r.Status) @@ -1853,8 +1828,8 @@ func (r RoleAssignmentScheduleProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "assignmentType", r.AssignmentType) populate(objectMap, "condition", r.Condition) populate(objectMap, "conditionVersion", r.ConditionVersion) - populate(objectMap, "createdOn", (*timeRFC3339)(r.CreatedOn)) - populate(objectMap, "endDateTime", (*timeRFC3339)(r.EndDateTime)) + populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) + populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) populate(objectMap, "expandedProperties", r.ExpandedProperties) populate(objectMap, "linkedRoleEligibilityScheduleId", r.LinkedRoleEligibilityScheduleID) populate(objectMap, "memberType", r.MemberType) @@ -1863,9 +1838,9 @@ func (r RoleAssignmentScheduleProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "roleAssignmentScheduleRequestId", r.RoleAssignmentScheduleRequestID) populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) populate(objectMap, "scope", r.Scope) - populate(objectMap, "startDateTime", (*timeRFC3339)(r.StartDateTime)) + populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) populate(objectMap, "status", r.Status) - populate(objectMap, "updatedOn", (*timeRFC3339)(r.UpdatedOn)) + populateTimeRFC3339(objectMap, "updatedOn", r.UpdatedOn) return json.Marshal(objectMap) } @@ -1888,14 +1863,10 @@ func (r *RoleAssignmentScheduleProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.ConditionVersion) delete(rawMsg, key) case "createdOn": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreatedOn = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.CreatedOn) delete(rawMsg, key) case "endDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.EndDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.EndDateTime) delete(rawMsg, key) case "expandedProperties": err = unpopulate(val, &r.ExpandedProperties) @@ -1922,17 +1893,13 @@ func (r *RoleAssignmentScheduleProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.Scope) delete(rawMsg, key) case "startDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.StartDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.StartDateTime) delete(rawMsg, key) case "status": err = unpopulate(val, &r.Status) delete(rawMsg, key) case "updatedOn": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.UpdatedOn = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.UpdatedOn) delete(rawMsg, key) } if err != nil { @@ -2054,7 +2021,7 @@ func (r RoleAssignmentScheduleRequestProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "approvalId", r.ApprovalID) populate(objectMap, "condition", r.Condition) populate(objectMap, "conditionVersion", r.ConditionVersion) - populate(objectMap, "createdOn", (*timeRFC3339)(r.CreatedOn)) + populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) populate(objectMap, "expandedProperties", r.ExpandedProperties) populate(objectMap, "justification", r.Justification) populate(objectMap, "linkedRoleEligibilityScheduleId", r.LinkedRoleEligibilityScheduleID) @@ -2091,9 +2058,7 @@ func (r *RoleAssignmentScheduleRequestProperties) UnmarshalJSON(data []byte) err err = unpopulate(val, &r.ConditionVersion) delete(rawMsg, key) case "createdOn": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreatedOn = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.CreatedOn) delete(rawMsg, key) case "expandedProperties": err = unpopulate(val, &r.ExpandedProperties) @@ -2158,7 +2123,7 @@ type RoleAssignmentScheduleRequestPropertiesScheduleInfo struct { func (r RoleAssignmentScheduleRequestPropertiesScheduleInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "expiration", r.Expiration) - populate(objectMap, "startDateTime", (*timeRFC3339)(r.StartDateTime)) + populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) return json.Marshal(objectMap) } @@ -2175,9 +2140,7 @@ func (r *RoleAssignmentScheduleRequestPropertiesScheduleInfo) UnmarshalJSON(data err = unpopulate(val, &r.Expiration) delete(rawMsg, key) case "startDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.StartDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.StartDateTime) delete(rawMsg, key) } if err != nil { @@ -2203,7 +2166,7 @@ type RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration struct { func (r RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "duration", r.Duration) - populate(objectMap, "endDateTime", (*timeRFC3339)(r.EndDateTime)) + populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -2221,9 +2184,7 @@ func (r *RoleAssignmentScheduleRequestPropertiesScheduleInfoExpiration) Unmarsha err = unpopulate(val, &r.Duration) delete(rawMsg, key) case "endDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.EndDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.EndDateTime) delete(rawMsg, key) case "type": err = unpopulate(val, &r.Type) @@ -2581,8 +2542,8 @@ func (r RoleEligibilityScheduleInstanceProperties) MarshalJSON() ([]byte, error) objectMap := make(map[string]interface{}) populate(objectMap, "condition", r.Condition) populate(objectMap, "conditionVersion", r.ConditionVersion) - populate(objectMap, "createdOn", (*timeRFC3339)(r.CreatedOn)) - populate(objectMap, "endDateTime", (*timeRFC3339)(r.EndDateTime)) + populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) + populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) populate(objectMap, "expandedProperties", r.ExpandedProperties) populate(objectMap, "memberType", r.MemberType) populate(objectMap, "principalId", r.PrincipalID) @@ -2590,7 +2551,7 @@ func (r RoleEligibilityScheduleInstanceProperties) MarshalJSON() ([]byte, error) populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) populate(objectMap, "roleEligibilityScheduleId", r.RoleEligibilityScheduleID) populate(objectMap, "scope", r.Scope) - populate(objectMap, "startDateTime", (*timeRFC3339)(r.StartDateTime)) + populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) populate(objectMap, "status", r.Status) return json.Marshal(objectMap) } @@ -2611,14 +2572,10 @@ func (r *RoleEligibilityScheduleInstanceProperties) UnmarshalJSON(data []byte) e err = unpopulate(val, &r.ConditionVersion) delete(rawMsg, key) case "createdOn": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreatedOn = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.CreatedOn) delete(rawMsg, key) case "endDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.EndDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.EndDateTime) delete(rawMsg, key) case "expandedProperties": err = unpopulate(val, &r.ExpandedProperties) @@ -2642,9 +2599,7 @@ func (r *RoleEligibilityScheduleInstanceProperties) UnmarshalJSON(data []byte) e err = unpopulate(val, &r.Scope) delete(rawMsg, key) case "startDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.StartDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.StartDateTime) delete(rawMsg, key) case "status": err = unpopulate(val, &r.Status) @@ -2739,8 +2694,8 @@ func (r RoleEligibilityScheduleProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "condition", r.Condition) populate(objectMap, "conditionVersion", r.ConditionVersion) - populate(objectMap, "createdOn", (*timeRFC3339)(r.CreatedOn)) - populate(objectMap, "endDateTime", (*timeRFC3339)(r.EndDateTime)) + populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) + populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) populate(objectMap, "expandedProperties", r.ExpandedProperties) populate(objectMap, "memberType", r.MemberType) populate(objectMap, "principalId", r.PrincipalID) @@ -2748,9 +2703,9 @@ func (r RoleEligibilityScheduleProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "roleDefinitionId", r.RoleDefinitionID) populate(objectMap, "roleEligibilityScheduleRequestId", r.RoleEligibilityScheduleRequestID) populate(objectMap, "scope", r.Scope) - populate(objectMap, "startDateTime", (*timeRFC3339)(r.StartDateTime)) + populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) populate(objectMap, "status", r.Status) - populate(objectMap, "updatedOn", (*timeRFC3339)(r.UpdatedOn)) + populateTimeRFC3339(objectMap, "updatedOn", r.UpdatedOn) return json.Marshal(objectMap) } @@ -2770,14 +2725,10 @@ func (r *RoleEligibilityScheduleProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.ConditionVersion) delete(rawMsg, key) case "createdOn": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreatedOn = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.CreatedOn) delete(rawMsg, key) case "endDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.EndDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.EndDateTime) delete(rawMsg, key) case "expandedProperties": err = unpopulate(val, &r.ExpandedProperties) @@ -2801,17 +2752,13 @@ func (r *RoleEligibilityScheduleProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.Scope) delete(rawMsg, key) case "startDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.StartDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.StartDateTime) delete(rawMsg, key) case "status": err = unpopulate(val, &r.Status) delete(rawMsg, key) case "updatedOn": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.UpdatedOn = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.UpdatedOn) delete(rawMsg, key) } if err != nil { @@ -2930,7 +2877,7 @@ func (r RoleEligibilityScheduleRequestProperties) MarshalJSON() ([]byte, error) populate(objectMap, "approvalId", r.ApprovalID) populate(objectMap, "condition", r.Condition) populate(objectMap, "conditionVersion", r.ConditionVersion) - populate(objectMap, "createdOn", (*timeRFC3339)(r.CreatedOn)) + populateTimeRFC3339(objectMap, "createdOn", r.CreatedOn) populate(objectMap, "expandedProperties", r.ExpandedProperties) populate(objectMap, "justification", r.Justification) populate(objectMap, "principalId", r.PrincipalID) @@ -2966,9 +2913,7 @@ func (r *RoleEligibilityScheduleRequestProperties) UnmarshalJSON(data []byte) er err = unpopulate(val, &r.ConditionVersion) delete(rawMsg, key) case "createdOn": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreatedOn = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.CreatedOn) delete(rawMsg, key) case "expandedProperties": err = unpopulate(val, &r.ExpandedProperties) @@ -3030,7 +2975,7 @@ type RoleEligibilityScheduleRequestPropertiesScheduleInfo struct { func (r RoleEligibilityScheduleRequestPropertiesScheduleInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "expiration", r.Expiration) - populate(objectMap, "startDateTime", (*timeRFC3339)(r.StartDateTime)) + populateTimeRFC3339(objectMap, "startDateTime", r.StartDateTime) return json.Marshal(objectMap) } @@ -3047,9 +2992,7 @@ func (r *RoleEligibilityScheduleRequestPropertiesScheduleInfo) UnmarshalJSON(dat err = unpopulate(val, &r.Expiration) delete(rawMsg, key) case "startDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.StartDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.StartDateTime) delete(rawMsg, key) } if err != nil { @@ -3075,7 +3018,7 @@ type RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration struct { func (r RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "duration", r.Duration) - populate(objectMap, "endDateTime", (*timeRFC3339)(r.EndDateTime)) + populateTimeRFC3339(objectMap, "endDateTime", r.EndDateTime) populate(objectMap, "type", r.Type) return json.Marshal(objectMap) } @@ -3093,9 +3036,7 @@ func (r *RoleEligibilityScheduleRequestPropertiesScheduleInfoExpiration) Unmarsh err = unpopulate(val, &r.Duration) delete(rawMsg, key) case "endDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.EndDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.EndDateTime) delete(rawMsg, key) case "type": err = unpopulate(val, &r.Type) @@ -3553,7 +3494,7 @@ func (r RoleManagementPolicyProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "effectiveRules", r.EffectiveRules) populate(objectMap, "isOrganizationDefault", r.IsOrganizationDefault) populate(objectMap, "lastModifiedBy", r.LastModifiedBy) - populate(objectMap, "lastModifiedDateTime", (*timeRFC3339)(r.LastModifiedDateTime)) + populateTimeRFC3339(objectMap, "lastModifiedDateTime", r.LastModifiedDateTime) populate(objectMap, "policyProperties", r.PolicyProperties) populate(objectMap, "rules", r.Rules) populate(objectMap, "scope", r.Scope) @@ -3585,9 +3526,7 @@ func (r *RoleManagementPolicyProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.LastModifiedBy) delete(rawMsg, key) case "lastModifiedDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.LastModifiedDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.LastModifiedDateTime) delete(rawMsg, key) case "policyProperties": err = unpopulate(val, &r.PolicyProperties) diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_operations_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_operations_client.go index bdae25fb924b..c7321d09f541 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_operations_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armauthorization import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists the operations available from this provider. @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_pagers.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_pagers.go index f7ca7cd2a2bc..c46e1f175dc9 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_pagers.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armauthorization import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // AccessReviewInstanceDecisionsListPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_permissions_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_permissions_client.go index cedd3d079aff..f8152e0633d1 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_permissions_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_permissions_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PermissionsClient contains the methods for the Permissions group. @@ -30,8 +31,15 @@ type PermissionsClient struct { } // NewPermissionsClient creates a new instance of PermissionsClient with the specified values. -func NewPermissionsClient(con *arm.Connection, subscriptionID string) *PermissionsClient { - return &PermissionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPermissionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PermissionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PermissionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListForResource - Gets all permissions the caller has for a resource. @@ -55,17 +63,8 @@ func (client *PermissionsClient) listForResourceCreateRequest(ctx context.Contex return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if resourceProviderNamespace == "" { - return nil, errors.New("parameter resourceProviderNamespace cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", resourceProviderNamespace) - if parentResourcePath == "" { - return nil, errors.New("parameter parentResourcePath cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{parentResourcePath}", parentResourcePath) - if resourceType == "" { - return nil, errors.New("parameter resourceType cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) if resourceName == "" { return nil, errors.New("parameter resourceName cannot be empty") @@ -90,7 +89,7 @@ func (client *PermissionsClient) listForResourceCreateRequest(ctx context.Contex func (client *PermissionsClient) listForResourceHandleResponse(resp *http.Response) (PermissionsListForResourceResponse, error) { result := PermissionsListForResourceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PermissionGetResult); err != nil { - return PermissionsListForResourceResponse{}, err + return PermissionsListForResourceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -148,7 +147,7 @@ func (client *PermissionsClient) listForResourceGroupCreateRequest(ctx context.C func (client *PermissionsClient) listForResourceGroupHandleResponse(resp *http.Response) (PermissionsListForResourceGroupResponse, error) { result := PermissionsListForResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PermissionGetResult); err != nil { - return PermissionsListForResourceGroupResponse{}, err + return PermissionsListForResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_polymorphic_helpers.go index fee40fdcd519..fc9bf15d9765 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_polymorphic_helpers.go @@ -49,6 +49,25 @@ func unmarshalAccessReviewDecisionTargetClassificationArray(rawMsg json.RawMessa return fArray, nil } +func unmarshalAccessReviewDecisionTargetClassificationMap(rawMsg json.RawMessage) (map[string]AccessReviewDecisionTargetClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]AccessReviewDecisionTargetClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalAccessReviewDecisionTargetClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalRoleManagementPolicyRuleClassification(rawMsg json.RawMessage) (RoleManagementPolicyRuleClassification, error) { if rawMsg == nil { return nil, nil @@ -93,3 +112,22 @@ func unmarshalRoleManagementPolicyRuleClassificationArray(rawMsg json.RawMessage } return fArray, nil } + +func unmarshalRoleManagementPolicyRuleClassificationMap(rawMsg json.RawMessage) (map[string]RoleManagementPolicyRuleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]RoleManagementPolicyRuleClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalRoleManagementPolicyRuleClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_provideroperationsmetadata_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_provideroperationsmetadata_client.go index d6df5bafbf71..75f56a31c085 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_provideroperationsmetadata_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_provideroperationsmetadata_client.go @@ -10,14 +10,14 @@ package armauthorization import ( "context" - "errors" "fmt" - "net/http" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" ) // ProviderOperationsMetadataClient contains the methods for the ProviderOperationsMetadata group. @@ -28,8 +28,15 @@ type ProviderOperationsMetadataClient struct { } // NewProviderOperationsMetadataClient creates a new instance of ProviderOperationsMetadataClient with the specified values. -func NewProviderOperationsMetadataClient(con *arm.Connection) *ProviderOperationsMetadataClient { - return &ProviderOperationsMetadataClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewProviderOperationsMetadataClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ProviderOperationsMetadataClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ProviderOperationsMetadataClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets provider operations metadata for the specified resource provider. @@ -52,9 +59,6 @@ func (client *ProviderOperationsMetadataClient) Get(ctx context.Context, resourc // getCreateRequest creates the Get request. func (client *ProviderOperationsMetadataClient) getCreateRequest(ctx context.Context, resourceProviderNamespace string, options *ProviderOperationsMetadataGetOptions) (*policy.Request, error) { urlPath := "/providers/Microsoft.Authorization/providerOperations/{resourceProviderNamespace}" - if resourceProviderNamespace == "" { - return nil, errors.New("parameter resourceProviderNamespace cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", resourceProviderNamespace) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -74,7 +78,7 @@ func (client *ProviderOperationsMetadataClient) getCreateRequest(ctx context.Con func (client *ProviderOperationsMetadataClient) getHandleResponse(resp *http.Response) (ProviderOperationsMetadataGetResponse, error) { result := ProviderOperationsMetadataGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProviderOperationsMetadata); err != nil { - return ProviderOperationsMetadataGetResponse{}, err + return ProviderOperationsMetadataGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -127,7 +131,7 @@ func (client *ProviderOperationsMetadataClient) listCreateRequest(ctx context.Co func (client *ProviderOperationsMetadataClient) listHandleResponse(resp *http.Response) (ProviderOperationsMetadataListResponse, error) { result := ProviderOperationsMetadataListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProviderOperationsMetadataListResult); err != nil { - return ProviderOperationsMetadataListResponse{}, err + return ProviderOperationsMetadataListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignmentmetrics_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignmentmetrics_client.go index de093a8d009d..510121e42e63 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignmentmetrics_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignmentmetrics_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RoleAssignmentMetricsClient contains the methods for the RoleAssignmentMetrics group. @@ -30,8 +31,15 @@ type RoleAssignmentMetricsClient struct { } // NewRoleAssignmentMetricsClient creates a new instance of RoleAssignmentMetricsClient with the specified values. -func NewRoleAssignmentMetricsClient(con *arm.Connection, subscriptionID string) *RoleAssignmentMetricsClient { - return &RoleAssignmentMetricsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRoleAssignmentMetricsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RoleAssignmentMetricsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RoleAssignmentMetricsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetMetricsForSubscription - Get role assignment usage metrics for a subscription @@ -73,7 +81,7 @@ func (client *RoleAssignmentMetricsClient) getMetricsForSubscriptionCreateReques func (client *RoleAssignmentMetricsClient) getMetricsForSubscriptionHandleResponse(resp *http.Response) (RoleAssignmentMetricsGetMetricsForSubscriptionResponse, error) { result := RoleAssignmentMetricsGetMetricsForSubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentMetricsResult); err != nil { - return RoleAssignmentMetricsGetMetricsForSubscriptionResponse{}, err + return RoleAssignmentMetricsGetMetricsForSubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignments_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignments_client.go index 8421a1d1b6f9..fce2c23f988e 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignments_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignments_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RoleAssignmentsClient contains the methods for the RoleAssignments group. @@ -30,8 +31,15 @@ type RoleAssignmentsClient struct { } // NewRoleAssignmentsClient creates a new instance of RoleAssignmentsClient with the specified values. -func NewRoleAssignmentsClient(con *arm.Connection, subscriptionID string) *RoleAssignmentsClient { - return &RoleAssignmentsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRoleAssignmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RoleAssignmentsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RoleAssignmentsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Create or update a role assignment by scope and name. @@ -54,13 +62,7 @@ func (client *RoleAssignmentsClient) Create(ctx context.Context, scope string, r // createCreateRequest creates the Create request. func (client *RoleAssignmentsClient) createCreateRequest(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters, options *RoleAssignmentsCreateOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleAssignmentName == "" { - return nil, errors.New("parameter roleAssignmentName cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentName}", roleAssignmentName) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -77,7 +79,7 @@ func (client *RoleAssignmentsClient) createCreateRequest(ctx context.Context, sc func (client *RoleAssignmentsClient) createHandleResponse(resp *http.Response) (RoleAssignmentsCreateResponse, error) { result := RoleAssignmentsCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { - return RoleAssignmentsCreateResponse{}, err + return RoleAssignmentsCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -115,9 +117,6 @@ func (client *RoleAssignmentsClient) CreateByID(ctx context.Context, roleAssignm // createByIDCreateRequest creates the CreateByID request. func (client *RoleAssignmentsClient) createByIDCreateRequest(ctx context.Context, roleAssignmentID string, parameters RoleAssignmentCreateParameters, options *RoleAssignmentsCreateByIDOptions) (*policy.Request, error) { urlPath := "/{roleAssignmentId}" - if roleAssignmentID == "" { - return nil, errors.New("parameter roleAssignmentID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentId}", roleAssignmentID) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -134,7 +133,7 @@ func (client *RoleAssignmentsClient) createByIDCreateRequest(ctx context.Context func (client *RoleAssignmentsClient) createByIDHandleResponse(resp *http.Response) (RoleAssignmentsCreateByIDResponse, error) { result := RoleAssignmentsCreateByIDResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { - return RoleAssignmentsCreateByIDResponse{}, err + return RoleAssignmentsCreateByIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -172,13 +171,7 @@ func (client *RoleAssignmentsClient) Delete(ctx context.Context, scope string, r // deleteCreateRequest creates the Delete request. func (client *RoleAssignmentsClient) deleteCreateRequest(ctx context.Context, scope string, roleAssignmentName string, options *RoleAssignmentsDeleteOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleAssignmentName == "" { - return nil, errors.New("parameter roleAssignmentName cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentName}", roleAssignmentName) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -198,7 +191,7 @@ func (client *RoleAssignmentsClient) deleteCreateRequest(ctx context.Context, sc func (client *RoleAssignmentsClient) deleteHandleResponse(resp *http.Response) (RoleAssignmentsDeleteResponse, error) { result := RoleAssignmentsDeleteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { - return RoleAssignmentsDeleteResponse{}, err + return RoleAssignmentsDeleteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -236,9 +229,6 @@ func (client *RoleAssignmentsClient) DeleteByID(ctx context.Context, roleAssignm // deleteByIDCreateRequest creates the DeleteByID request. func (client *RoleAssignmentsClient) deleteByIDCreateRequest(ctx context.Context, roleAssignmentID string, options *RoleAssignmentsDeleteByIDOptions) (*policy.Request, error) { urlPath := "/{roleAssignmentId}" - if roleAssignmentID == "" { - return nil, errors.New("parameter roleAssignmentID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentId}", roleAssignmentID) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -258,7 +248,7 @@ func (client *RoleAssignmentsClient) deleteByIDCreateRequest(ctx context.Context func (client *RoleAssignmentsClient) deleteByIDHandleResponse(resp *http.Response) (RoleAssignmentsDeleteByIDResponse, error) { result := RoleAssignmentsDeleteByIDResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { - return RoleAssignmentsDeleteByIDResponse{}, err + return RoleAssignmentsDeleteByIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -296,13 +286,7 @@ func (client *RoleAssignmentsClient) Get(ctx context.Context, scope string, role // getCreateRequest creates the Get request. func (client *RoleAssignmentsClient) getCreateRequest(ctx context.Context, scope string, roleAssignmentName string, options *RoleAssignmentsGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleAssignmentName == "" { - return nil, errors.New("parameter roleAssignmentName cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentName}", roleAssignmentName) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -322,7 +306,7 @@ func (client *RoleAssignmentsClient) getCreateRequest(ctx context.Context, scope func (client *RoleAssignmentsClient) getHandleResponse(resp *http.Response) (RoleAssignmentsGetResponse, error) { result := RoleAssignmentsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { - return RoleAssignmentsGetResponse{}, err + return RoleAssignmentsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -360,9 +344,6 @@ func (client *RoleAssignmentsClient) GetByID(ctx context.Context, roleAssignment // getByIDCreateRequest creates the GetByID request. func (client *RoleAssignmentsClient) getByIDCreateRequest(ctx context.Context, roleAssignmentID string, options *RoleAssignmentsGetByIDOptions) (*policy.Request, error) { urlPath := "/{roleAssignmentId}" - if roleAssignmentID == "" { - return nil, errors.New("parameter roleAssignmentID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentId}", roleAssignmentID) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -382,7 +363,7 @@ func (client *RoleAssignmentsClient) getByIDCreateRequest(ctx context.Context, r func (client *RoleAssignmentsClient) getByIDHandleResponse(resp *http.Response) (RoleAssignmentsGetByIDResponse, error) { result := RoleAssignmentsGetByIDResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignment); err != nil { - return RoleAssignmentsGetByIDResponse{}, err + return RoleAssignmentsGetByIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -425,17 +406,8 @@ func (client *RoleAssignmentsClient) listForResourceCreateRequest(ctx context.Co return nil, errors.New("parameter resourceGroupName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if resourceProviderNamespace == "" { - return nil, errors.New("parameter resourceProviderNamespace cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", resourceProviderNamespace) - if resourceType == "" { - return nil, errors.New("parameter resourceType cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) - if resourceName == "" { - return nil, errors.New("parameter resourceName cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceName}", resourceName) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -460,7 +432,7 @@ func (client *RoleAssignmentsClient) listForResourceCreateRequest(ctx context.Co func (client *RoleAssignmentsClient) listForResourceHandleResponse(resp *http.Response) (RoleAssignmentsListForResourceResponse, error) { result := RoleAssignmentsListForResourceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentListResult); err != nil { - return RoleAssignmentsListForResourceResponse{}, err + return RoleAssignmentsListForResourceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -526,7 +498,7 @@ func (client *RoleAssignmentsClient) listForResourceGroupCreateRequest(ctx conte func (client *RoleAssignmentsClient) listForResourceGroupHandleResponse(resp *http.Response) (RoleAssignmentsListForResourceGroupResponse, error) { result := RoleAssignmentsListForResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentListResult); err != nil { - return RoleAssignmentsListForResourceGroupResponse{}, err + return RoleAssignmentsListForResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -561,9 +533,6 @@ func (client *RoleAssignmentsClient) ListForScope(scope string, options *RoleAss // listForScopeCreateRequest creates the ListForScope request. func (client *RoleAssignmentsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleAssignmentsListForScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -588,7 +557,7 @@ func (client *RoleAssignmentsClient) listForScopeCreateRequest(ctx context.Conte func (client *RoleAssignmentsClient) listForScopeHandleResponse(resp *http.Response) (RoleAssignmentsListForScopeResponse, error) { result := RoleAssignmentsListForScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentListResult); err != nil { - return RoleAssignmentsListForScopeResponse{}, err + return RoleAssignmentsListForScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -650,7 +619,7 @@ func (client *RoleAssignmentsClient) listForSubscriptionCreateRequest(ctx contex func (client *RoleAssignmentsClient) listForSubscriptionHandleResponse(resp *http.Response) (RoleAssignmentsListForSubscriptionResponse, error) { result := RoleAssignmentsListForSubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentListResult); err != nil { - return RoleAssignmentsListForSubscriptionResponse{}, err + return RoleAssignmentsListForSubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -688,13 +657,7 @@ func (client *RoleAssignmentsClient) Validate(ctx context.Context, scope string, // validateCreateRequest creates the Validate request. func (client *RoleAssignmentsClient) validateCreateRequest(ctx context.Context, scope string, roleAssignmentName string, parameters RoleAssignmentCreateParameters, options *RoleAssignmentsValidateOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignments/{roleAssignmentName}/validate" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) - if roleAssignmentName == "" { - return nil, errors.New("parameter roleAssignmentName cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentName}", roleAssignmentName) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -711,7 +674,7 @@ func (client *RoleAssignmentsClient) validateCreateRequest(ctx context.Context, func (client *RoleAssignmentsClient) validateHandleResponse(resp *http.Response) (RoleAssignmentsValidateResponse, error) { result := RoleAssignmentsValidateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ValidationResponse); err != nil { - return RoleAssignmentsValidateResponse{}, err + return RoleAssignmentsValidateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -749,9 +712,6 @@ func (client *RoleAssignmentsClient) ValidateByID(ctx context.Context, roleAssig // validateByIDCreateRequest creates the ValidateByID request. func (client *RoleAssignmentsClient) validateByIDCreateRequest(ctx context.Context, roleAssignmentID string, parameters RoleAssignmentCreateParameters, options *RoleAssignmentsValidateByIDOptions) (*policy.Request, error) { urlPath := "/{roleAssignmentId}/validate" - if roleAssignmentID == "" { - return nil, errors.New("parameter roleAssignmentID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{roleAssignmentId}", roleAssignmentID) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -768,7 +728,7 @@ func (client *RoleAssignmentsClient) validateByIDCreateRequest(ctx context.Conte func (client *RoleAssignmentsClient) validateByIDHandleResponse(resp *http.Response) (RoleAssignmentsValidateByIDResponse, error) { result := RoleAssignmentsValidateByIDResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ValidationResponse); err != nil { - return RoleAssignmentsValidateByIDResponse{}, err + return RoleAssignmentsValidateByIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignmentscheduleinstances_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignmentscheduleinstances_client.go index bf3f8d382c8e..92a71e336adb 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignmentscheduleinstances_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignmentscheduleinstances_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RoleAssignmentScheduleInstancesClient contains the methods for the RoleAssignmentScheduleInstances group. @@ -29,8 +30,15 @@ type RoleAssignmentScheduleInstancesClient struct { } // NewRoleAssignmentScheduleInstancesClient creates a new instance of RoleAssignmentScheduleInstancesClient with the specified values. -func NewRoleAssignmentScheduleInstancesClient(con *arm.Connection) *RoleAssignmentScheduleInstancesClient { - return &RoleAssignmentScheduleInstancesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewRoleAssignmentScheduleInstancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *RoleAssignmentScheduleInstancesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RoleAssignmentScheduleInstancesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the specified role assignment schedule instance. @@ -53,9 +61,6 @@ func (client *RoleAssignmentScheduleInstancesClient) Get(ctx context.Context, sc // getCreateRequest creates the Get request. func (client *RoleAssignmentScheduleInstancesClient) getCreateRequest(ctx context.Context, scope string, roleAssignmentScheduleInstanceName string, options *RoleAssignmentScheduleInstancesGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances/{roleAssignmentScheduleInstanceName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if roleAssignmentScheduleInstanceName == "" { return nil, errors.New("parameter roleAssignmentScheduleInstanceName cannot be empty") @@ -76,7 +81,7 @@ func (client *RoleAssignmentScheduleInstancesClient) getCreateRequest(ctx contex func (client *RoleAssignmentScheduleInstancesClient) getHandleResponse(resp *http.Response) (RoleAssignmentScheduleInstancesGetResponse, error) { result := RoleAssignmentScheduleInstancesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleInstance); err != nil { - return RoleAssignmentScheduleInstancesGetResponse{}, err + return RoleAssignmentScheduleInstancesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -111,9 +116,6 @@ func (client *RoleAssignmentScheduleInstancesClient) ListForScope(scope string, // listForScopeCreateRequest creates the ListForScope request. func (client *RoleAssignmentScheduleInstancesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleAssignmentScheduleInstancesListForScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleInstances" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -133,7 +135,7 @@ func (client *RoleAssignmentScheduleInstancesClient) listForScopeCreateRequest(c func (client *RoleAssignmentScheduleInstancesClient) listForScopeHandleResponse(resp *http.Response) (RoleAssignmentScheduleInstancesListForScopeResponse, error) { result := RoleAssignmentScheduleInstancesListForScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleInstanceListResult); err != nil { - return RoleAssignmentScheduleInstancesListForScopeResponse{}, err + return RoleAssignmentScheduleInstancesListForScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignmentschedulerequests_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignmentschedulerequests_client.go index 0f241a239cd5..b2bd4fe75628 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignmentschedulerequests_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignmentschedulerequests_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RoleAssignmentScheduleRequestsClient contains the methods for the RoleAssignmentScheduleRequests group. @@ -29,8 +30,15 @@ type RoleAssignmentScheduleRequestsClient struct { } // NewRoleAssignmentScheduleRequestsClient creates a new instance of RoleAssignmentScheduleRequestsClient with the specified values. -func NewRoleAssignmentScheduleRequestsClient(con *arm.Connection) *RoleAssignmentScheduleRequestsClient { - return &RoleAssignmentScheduleRequestsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewRoleAssignmentScheduleRequestsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *RoleAssignmentScheduleRequestsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RoleAssignmentScheduleRequestsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Cancel - Cancels a pending role assignment schedule request. @@ -53,9 +61,6 @@ func (client *RoleAssignmentScheduleRequestsClient) Cancel(ctx context.Context, // cancelCreateRequest creates the Cancel request. func (client *RoleAssignmentScheduleRequestsClient) cancelCreateRequest(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, options *RoleAssignmentScheduleRequestsCancelOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}/cancel" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if roleAssignmentScheduleRequestName == "" { return nil, errors.New("parameter roleAssignmentScheduleRequestName cannot be empty") @@ -105,9 +110,6 @@ func (client *RoleAssignmentScheduleRequestsClient) Create(ctx context.Context, // createCreateRequest creates the Create request. func (client *RoleAssignmentScheduleRequestsClient) createCreateRequest(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, parameters RoleAssignmentScheduleRequest, options *RoleAssignmentScheduleRequestsCreateOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if roleAssignmentScheduleRequestName == "" { return nil, errors.New("parameter roleAssignmentScheduleRequestName cannot be empty") @@ -128,7 +130,7 @@ func (client *RoleAssignmentScheduleRequestsClient) createCreateRequest(ctx cont func (client *RoleAssignmentScheduleRequestsClient) createHandleResponse(resp *http.Response) (RoleAssignmentScheduleRequestsCreateResponse, error) { result := RoleAssignmentScheduleRequestsCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleRequest); err != nil { - return RoleAssignmentScheduleRequestsCreateResponse{}, err + return RoleAssignmentScheduleRequestsCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -166,9 +168,6 @@ func (client *RoleAssignmentScheduleRequestsClient) Get(ctx context.Context, sco // getCreateRequest creates the Get request. func (client *RoleAssignmentScheduleRequestsClient) getCreateRequest(ctx context.Context, scope string, roleAssignmentScheduleRequestName string, options *RoleAssignmentScheduleRequestsGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests/{roleAssignmentScheduleRequestName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if roleAssignmentScheduleRequestName == "" { return nil, errors.New("parameter roleAssignmentScheduleRequestName cannot be empty") @@ -189,7 +188,7 @@ func (client *RoleAssignmentScheduleRequestsClient) getCreateRequest(ctx context func (client *RoleAssignmentScheduleRequestsClient) getHandleResponse(resp *http.Response) (RoleAssignmentScheduleRequestsGetResponse, error) { result := RoleAssignmentScheduleRequestsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleRequest); err != nil { - return RoleAssignmentScheduleRequestsGetResponse{}, err + return RoleAssignmentScheduleRequestsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -224,9 +223,6 @@ func (client *RoleAssignmentScheduleRequestsClient) ListForScope(scope string, o // listForScopeCreateRequest creates the ListForScope request. func (client *RoleAssignmentScheduleRequestsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleAssignmentScheduleRequestsListForScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentScheduleRequests" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -246,7 +242,7 @@ func (client *RoleAssignmentScheduleRequestsClient) listForScopeCreateRequest(ct func (client *RoleAssignmentScheduleRequestsClient) listForScopeHandleResponse(resp *http.Response) (RoleAssignmentScheduleRequestsListForScopeResponse, error) { result := RoleAssignmentScheduleRequestsListForScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleRequestListResult); err != nil { - return RoleAssignmentScheduleRequestsListForScopeResponse{}, err + return RoleAssignmentScheduleRequestsListForScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignmentschedules_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignmentschedules_client.go index d5dee5062b8c..9f22f125be9a 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignmentschedules_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleassignmentschedules_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RoleAssignmentSchedulesClient contains the methods for the RoleAssignmentSchedules group. @@ -29,8 +30,15 @@ type RoleAssignmentSchedulesClient struct { } // NewRoleAssignmentSchedulesClient creates a new instance of RoleAssignmentSchedulesClient with the specified values. -func NewRoleAssignmentSchedulesClient(con *arm.Connection) *RoleAssignmentSchedulesClient { - return &RoleAssignmentSchedulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewRoleAssignmentSchedulesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *RoleAssignmentSchedulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RoleAssignmentSchedulesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get the specified role assignment schedule for a resource scope @@ -53,9 +61,6 @@ func (client *RoleAssignmentSchedulesClient) Get(ctx context.Context, scope stri // getCreateRequest creates the Get request. func (client *RoleAssignmentSchedulesClient) getCreateRequest(ctx context.Context, scope string, roleAssignmentScheduleName string, options *RoleAssignmentSchedulesGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules/{roleAssignmentScheduleName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if roleAssignmentScheduleName == "" { return nil, errors.New("parameter roleAssignmentScheduleName cannot be empty") @@ -76,7 +81,7 @@ func (client *RoleAssignmentSchedulesClient) getCreateRequest(ctx context.Contex func (client *RoleAssignmentSchedulesClient) getHandleResponse(resp *http.Response) (RoleAssignmentSchedulesGetResponse, error) { result := RoleAssignmentSchedulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentSchedule); err != nil { - return RoleAssignmentSchedulesGetResponse{}, err + return RoleAssignmentSchedulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -111,9 +116,6 @@ func (client *RoleAssignmentSchedulesClient) ListForScope(scope string, options // listForScopeCreateRequest creates the ListForScope request. func (client *RoleAssignmentSchedulesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleAssignmentSchedulesListForScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleAssignmentSchedules" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -133,7 +135,7 @@ func (client *RoleAssignmentSchedulesClient) listForScopeCreateRequest(ctx conte func (client *RoleAssignmentSchedulesClient) listForScopeHandleResponse(resp *http.Response) (RoleAssignmentSchedulesListForScopeResponse, error) { result := RoleAssignmentSchedulesListForScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleAssignmentScheduleListResult); err != nil { - return RoleAssignmentSchedulesListForScopeResponse{}, err + return RoleAssignmentSchedulesListForScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_roledefinitions_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_roledefinitions_client.go index d58d369888a3..83be40c524ab 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_roledefinitions_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_roledefinitions_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RoleDefinitionsClient contains the methods for the RoleDefinitions group. @@ -29,8 +30,15 @@ type RoleDefinitionsClient struct { } // NewRoleDefinitionsClient creates a new instance of RoleDefinitionsClient with the specified values. -func NewRoleDefinitionsClient(con *arm.Connection) *RoleDefinitionsClient { - return &RoleDefinitionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewRoleDefinitionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *RoleDefinitionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RoleDefinitionsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a role definition. @@ -53,9 +61,6 @@ func (client *RoleDefinitionsClient) CreateOrUpdate(ctx context.Context, scope s // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *RoleDefinitionsClient) createOrUpdateCreateRequest(ctx context.Context, scope string, roleDefinitionID string, roleDefinition RoleDefinition, options *RoleDefinitionsCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if roleDefinitionID == "" { return nil, errors.New("parameter roleDefinitionID cannot be empty") @@ -76,7 +81,7 @@ func (client *RoleDefinitionsClient) createOrUpdateCreateRequest(ctx context.Con func (client *RoleDefinitionsClient) createOrUpdateHandleResponse(resp *http.Response) (RoleDefinitionsCreateOrUpdateResponse, error) { result := RoleDefinitionsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinition); err != nil { - return RoleDefinitionsCreateOrUpdateResponse{}, err + return RoleDefinitionsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -114,9 +119,6 @@ func (client *RoleDefinitionsClient) Delete(ctx context.Context, scope string, r // deleteCreateRequest creates the Delete request. func (client *RoleDefinitionsClient) deleteCreateRequest(ctx context.Context, scope string, roleDefinitionID string, options *RoleDefinitionsDeleteOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if roleDefinitionID == "" { return nil, errors.New("parameter roleDefinitionID cannot be empty") @@ -137,7 +139,7 @@ func (client *RoleDefinitionsClient) deleteCreateRequest(ctx context.Context, sc func (client *RoleDefinitionsClient) deleteHandleResponse(resp *http.Response) (RoleDefinitionsDeleteResponse, error) { result := RoleDefinitionsDeleteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinition); err != nil { - return RoleDefinitionsDeleteResponse{}, err + return RoleDefinitionsDeleteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -175,9 +177,6 @@ func (client *RoleDefinitionsClient) Get(ctx context.Context, scope string, role // getCreateRequest creates the Get request. func (client *RoleDefinitionsClient) getCreateRequest(ctx context.Context, scope string, roleDefinitionID string, options *RoleDefinitionsGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions/{roleDefinitionId}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if roleDefinitionID == "" { return nil, errors.New("parameter roleDefinitionID cannot be empty") @@ -198,7 +197,7 @@ func (client *RoleDefinitionsClient) getCreateRequest(ctx context.Context, scope func (client *RoleDefinitionsClient) getHandleResponse(resp *http.Response) (RoleDefinitionsGetResponse, error) { result := RoleDefinitionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinition); err != nil { - return RoleDefinitionsGetResponse{}, err + return RoleDefinitionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -236,9 +235,6 @@ func (client *RoleDefinitionsClient) GetByID(ctx context.Context, roleID string, // getByIDCreateRequest creates the GetByID request. func (client *RoleDefinitionsClient) getByIDCreateRequest(ctx context.Context, roleID string, options *RoleDefinitionsGetByIDOptions) (*policy.Request, error) { urlPath := "/{roleId}" - if roleID == "" { - return nil, errors.New("parameter roleID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{roleId}", roleID) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -255,7 +251,7 @@ func (client *RoleDefinitionsClient) getByIDCreateRequest(ctx context.Context, r func (client *RoleDefinitionsClient) getByIDHandleResponse(resp *http.Response) (RoleDefinitionsGetByIDResponse, error) { result := RoleDefinitionsGetByIDResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinition); err != nil { - return RoleDefinitionsGetByIDResponse{}, err + return RoleDefinitionsGetByIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -290,9 +286,6 @@ func (client *RoleDefinitionsClient) List(scope string, options *RoleDefinitions // listCreateRequest creates the List request. func (client *RoleDefinitionsClient) listCreateRequest(ctx context.Context, scope string, options *RoleDefinitionsListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleDefinitions" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -312,7 +305,7 @@ func (client *RoleDefinitionsClient) listCreateRequest(ctx context.Context, scop func (client *RoleDefinitionsClient) listHandleResponse(resp *http.Response) (RoleDefinitionsListResponse, error) { result := RoleDefinitionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleDefinitionListResult); err != nil { - return RoleDefinitionsListResponse{}, err + return RoleDefinitionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleeligibilityscheduleinstances_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleeligibilityscheduleinstances_client.go index 3a527876645b..1c910598f645 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleeligibilityscheduleinstances_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleeligibilityscheduleinstances_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RoleEligibilityScheduleInstancesClient contains the methods for the RoleEligibilityScheduleInstances group. @@ -29,8 +30,15 @@ type RoleEligibilityScheduleInstancesClient struct { } // NewRoleEligibilityScheduleInstancesClient creates a new instance of RoleEligibilityScheduleInstancesClient with the specified values. -func NewRoleEligibilityScheduleInstancesClient(con *arm.Connection) *RoleEligibilityScheduleInstancesClient { - return &RoleEligibilityScheduleInstancesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewRoleEligibilityScheduleInstancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *RoleEligibilityScheduleInstancesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RoleEligibilityScheduleInstancesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the specified role eligibility schedule instance. @@ -53,9 +61,6 @@ func (client *RoleEligibilityScheduleInstancesClient) Get(ctx context.Context, s // getCreateRequest creates the Get request. func (client *RoleEligibilityScheduleInstancesClient) getCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleInstanceName string, options *RoleEligibilityScheduleInstancesGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances/{roleEligibilityScheduleInstanceName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if roleEligibilityScheduleInstanceName == "" { return nil, errors.New("parameter roleEligibilityScheduleInstanceName cannot be empty") @@ -76,7 +81,7 @@ func (client *RoleEligibilityScheduleInstancesClient) getCreateRequest(ctx conte func (client *RoleEligibilityScheduleInstancesClient) getHandleResponse(resp *http.Response) (RoleEligibilityScheduleInstancesGetResponse, error) { result := RoleEligibilityScheduleInstancesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleInstance); err != nil { - return RoleEligibilityScheduleInstancesGetResponse{}, err + return RoleEligibilityScheduleInstancesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -111,9 +116,6 @@ func (client *RoleEligibilityScheduleInstancesClient) ListForScope(scope string, // listForScopeCreateRequest creates the ListForScope request. func (client *RoleEligibilityScheduleInstancesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleEligibilityScheduleInstancesListForScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleInstances" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -133,7 +135,7 @@ func (client *RoleEligibilityScheduleInstancesClient) listForScopeCreateRequest( func (client *RoleEligibilityScheduleInstancesClient) listForScopeHandleResponse(resp *http.Response) (RoleEligibilityScheduleInstancesListForScopeResponse, error) { result := RoleEligibilityScheduleInstancesListForScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleInstanceListResult); err != nil { - return RoleEligibilityScheduleInstancesListForScopeResponse{}, err + return RoleEligibilityScheduleInstancesListForScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleeligibilityschedulerequests_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleeligibilityschedulerequests_client.go index 6204f694ae32..30d4efec01c3 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleeligibilityschedulerequests_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleeligibilityschedulerequests_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RoleEligibilityScheduleRequestsClient contains the methods for the RoleEligibilityScheduleRequests group. @@ -29,8 +30,15 @@ type RoleEligibilityScheduleRequestsClient struct { } // NewRoleEligibilityScheduleRequestsClient creates a new instance of RoleEligibilityScheduleRequestsClient with the specified values. -func NewRoleEligibilityScheduleRequestsClient(con *arm.Connection) *RoleEligibilityScheduleRequestsClient { - return &RoleEligibilityScheduleRequestsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewRoleEligibilityScheduleRequestsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *RoleEligibilityScheduleRequestsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RoleEligibilityScheduleRequestsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Cancel - Cancels a pending role eligibility schedule request. @@ -53,9 +61,6 @@ func (client *RoleEligibilityScheduleRequestsClient) Cancel(ctx context.Context, // cancelCreateRequest creates the Cancel request. func (client *RoleEligibilityScheduleRequestsClient) cancelCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, options *RoleEligibilityScheduleRequestsCancelOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}/cancel" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if roleEligibilityScheduleRequestName == "" { return nil, errors.New("parameter roleEligibilityScheduleRequestName cannot be empty") @@ -105,9 +110,6 @@ func (client *RoleEligibilityScheduleRequestsClient) Create(ctx context.Context, // createCreateRequest creates the Create request. func (client *RoleEligibilityScheduleRequestsClient) createCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, parameters RoleEligibilityScheduleRequest, options *RoleEligibilityScheduleRequestsCreateOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if roleEligibilityScheduleRequestName == "" { return nil, errors.New("parameter roleEligibilityScheduleRequestName cannot be empty") @@ -128,7 +130,7 @@ func (client *RoleEligibilityScheduleRequestsClient) createCreateRequest(ctx con func (client *RoleEligibilityScheduleRequestsClient) createHandleResponse(resp *http.Response) (RoleEligibilityScheduleRequestsCreateResponse, error) { result := RoleEligibilityScheduleRequestsCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleRequest); err != nil { - return RoleEligibilityScheduleRequestsCreateResponse{}, err + return RoleEligibilityScheduleRequestsCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -166,9 +168,6 @@ func (client *RoleEligibilityScheduleRequestsClient) Get(ctx context.Context, sc // getCreateRequest creates the Get request. func (client *RoleEligibilityScheduleRequestsClient) getCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleRequestName string, options *RoleEligibilityScheduleRequestsGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests/{roleEligibilityScheduleRequestName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if roleEligibilityScheduleRequestName == "" { return nil, errors.New("parameter roleEligibilityScheduleRequestName cannot be empty") @@ -189,7 +188,7 @@ func (client *RoleEligibilityScheduleRequestsClient) getCreateRequest(ctx contex func (client *RoleEligibilityScheduleRequestsClient) getHandleResponse(resp *http.Response) (RoleEligibilityScheduleRequestsGetResponse, error) { result := RoleEligibilityScheduleRequestsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleRequest); err != nil { - return RoleEligibilityScheduleRequestsGetResponse{}, err + return RoleEligibilityScheduleRequestsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -224,9 +223,6 @@ func (client *RoleEligibilityScheduleRequestsClient) ListForScope(scope string, // listForScopeCreateRequest creates the ListForScope request. func (client *RoleEligibilityScheduleRequestsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleEligibilityScheduleRequestsListForScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilityScheduleRequests" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -246,7 +242,7 @@ func (client *RoleEligibilityScheduleRequestsClient) listForScopeCreateRequest(c func (client *RoleEligibilityScheduleRequestsClient) listForScopeHandleResponse(resp *http.Response) (RoleEligibilityScheduleRequestsListForScopeResponse, error) { result := RoleEligibilityScheduleRequestsListForScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleRequestListResult); err != nil { - return RoleEligibilityScheduleRequestsListForScopeResponse{}, err + return RoleEligibilityScheduleRequestsListForScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleeligibilityschedules_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleeligibilityschedules_client.go index f372629ade16..23015e9e1012 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleeligibilityschedules_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_roleeligibilityschedules_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RoleEligibilitySchedulesClient contains the methods for the RoleEligibilitySchedules group. @@ -29,8 +30,15 @@ type RoleEligibilitySchedulesClient struct { } // NewRoleEligibilitySchedulesClient creates a new instance of RoleEligibilitySchedulesClient with the specified values. -func NewRoleEligibilitySchedulesClient(con *arm.Connection) *RoleEligibilitySchedulesClient { - return &RoleEligibilitySchedulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewRoleEligibilitySchedulesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *RoleEligibilitySchedulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RoleEligibilitySchedulesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get the specified role eligibility schedule for a resource scope @@ -53,9 +61,6 @@ func (client *RoleEligibilitySchedulesClient) Get(ctx context.Context, scope str // getCreateRequest creates the Get request. func (client *RoleEligibilitySchedulesClient) getCreateRequest(ctx context.Context, scope string, roleEligibilityScheduleName string, options *RoleEligibilitySchedulesGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules/{roleEligibilityScheduleName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if roleEligibilityScheduleName == "" { return nil, errors.New("parameter roleEligibilityScheduleName cannot be empty") @@ -76,7 +81,7 @@ func (client *RoleEligibilitySchedulesClient) getCreateRequest(ctx context.Conte func (client *RoleEligibilitySchedulesClient) getHandleResponse(resp *http.Response) (RoleEligibilitySchedulesGetResponse, error) { result := RoleEligibilitySchedulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilitySchedule); err != nil { - return RoleEligibilitySchedulesGetResponse{}, err + return RoleEligibilitySchedulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -111,9 +116,6 @@ func (client *RoleEligibilitySchedulesClient) ListForScope(scope string, options // listForScopeCreateRequest creates the ListForScope request. func (client *RoleEligibilitySchedulesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleEligibilitySchedulesListForScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleEligibilitySchedules" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -133,7 +135,7 @@ func (client *RoleEligibilitySchedulesClient) listForScopeCreateRequest(ctx cont func (client *RoleEligibilitySchedulesClient) listForScopeHandleResponse(resp *http.Response) (RoleEligibilitySchedulesListForScopeResponse, error) { result := RoleEligibilitySchedulesListForScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleEligibilityScheduleListResult); err != nil { - return RoleEligibilitySchedulesListForScopeResponse{}, err + return RoleEligibilitySchedulesListForScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_rolemanagementpolicies_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_rolemanagementpolicies_client.go index ee371182e8a7..1a21f7738508 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_rolemanagementpolicies_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_rolemanagementpolicies_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RoleManagementPoliciesClient contains the methods for the RoleManagementPolicies group. @@ -29,8 +30,15 @@ type RoleManagementPoliciesClient struct { } // NewRoleManagementPoliciesClient creates a new instance of RoleManagementPoliciesClient with the specified values. -func NewRoleManagementPoliciesClient(con *arm.Connection) *RoleManagementPoliciesClient { - return &RoleManagementPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewRoleManagementPoliciesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *RoleManagementPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RoleManagementPoliciesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Delete - Delete a role management policy @@ -53,9 +61,6 @@ func (client *RoleManagementPoliciesClient) Delete(ctx context.Context, scope st // deleteCreateRequest creates the Delete request. func (client *RoleManagementPoliciesClient) deleteCreateRequest(ctx context.Context, scope string, roleManagementPolicyName string, options *RoleManagementPoliciesDeleteOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if roleManagementPolicyName == "" { return nil, errors.New("parameter roleManagementPolicyName cannot be empty") @@ -105,9 +110,6 @@ func (client *RoleManagementPoliciesClient) Get(ctx context.Context, scope strin // getCreateRequest creates the Get request. func (client *RoleManagementPoliciesClient) getCreateRequest(ctx context.Context, scope string, roleManagementPolicyName string, options *RoleManagementPoliciesGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if roleManagementPolicyName == "" { return nil, errors.New("parameter roleManagementPolicyName cannot be empty") @@ -128,7 +130,7 @@ func (client *RoleManagementPoliciesClient) getCreateRequest(ctx context.Context func (client *RoleManagementPoliciesClient) getHandleResponse(resp *http.Response) (RoleManagementPoliciesGetResponse, error) { result := RoleManagementPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicy); err != nil { - return RoleManagementPoliciesGetResponse{}, err + return RoleManagementPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -163,9 +165,6 @@ func (client *RoleManagementPoliciesClient) ListForScope(scope string, options * // listForScopeCreateRequest creates the ListForScope request. func (client *RoleManagementPoliciesClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleManagementPoliciesListForScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -182,7 +181,7 @@ func (client *RoleManagementPoliciesClient) listForScopeCreateRequest(ctx contex func (client *RoleManagementPoliciesClient) listForScopeHandleResponse(resp *http.Response) (RoleManagementPoliciesListForScopeResponse, error) { result := RoleManagementPoliciesListForScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicyListResult); err != nil { - return RoleManagementPoliciesListForScopeResponse{}, err + return RoleManagementPoliciesListForScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -220,9 +219,6 @@ func (client *RoleManagementPoliciesClient) Update(ctx context.Context, scope st // updateCreateRequest creates the Update request. func (client *RoleManagementPoliciesClient) updateCreateRequest(ctx context.Context, scope string, roleManagementPolicyName string, parameters RoleManagementPolicy, options *RoleManagementPoliciesUpdateOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicies/{roleManagementPolicyName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if roleManagementPolicyName == "" { return nil, errors.New("parameter roleManagementPolicyName cannot be empty") @@ -243,7 +239,7 @@ func (client *RoleManagementPoliciesClient) updateCreateRequest(ctx context.Cont func (client *RoleManagementPoliciesClient) updateHandleResponse(resp *http.Response) (RoleManagementPoliciesUpdateResponse, error) { result := RoleManagementPoliciesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicy); err != nil { - return RoleManagementPoliciesUpdateResponse{}, err + return RoleManagementPoliciesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_rolemanagementpolicyassignments_client.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_rolemanagementpolicyassignments_client.go index eecb8651f918..50373c839e21 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_rolemanagementpolicyassignments_client.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_rolemanagementpolicyassignments_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RoleManagementPolicyAssignmentsClient contains the methods for the RoleManagementPolicyAssignments group. @@ -29,8 +30,15 @@ type RoleManagementPolicyAssignmentsClient struct { } // NewRoleManagementPolicyAssignmentsClient creates a new instance of RoleManagementPolicyAssignmentsClient with the specified values. -func NewRoleManagementPolicyAssignmentsClient(con *arm.Connection) *RoleManagementPolicyAssignmentsClient { - return &RoleManagementPolicyAssignmentsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewRoleManagementPolicyAssignmentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *RoleManagementPolicyAssignmentsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RoleManagementPolicyAssignmentsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Create a role management policy assignment @@ -53,9 +61,6 @@ func (client *RoleManagementPolicyAssignmentsClient) Create(ctx context.Context, // createCreateRequest creates the Create request. func (client *RoleManagementPolicyAssignmentsClient) createCreateRequest(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, parameters RoleManagementPolicyAssignment, options *RoleManagementPolicyAssignmentsCreateOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if roleManagementPolicyAssignmentName == "" { return nil, errors.New("parameter roleManagementPolicyAssignmentName cannot be empty") @@ -76,7 +81,7 @@ func (client *RoleManagementPolicyAssignmentsClient) createCreateRequest(ctx con func (client *RoleManagementPolicyAssignmentsClient) createHandleResponse(resp *http.Response) (RoleManagementPolicyAssignmentsCreateResponse, error) { result := RoleManagementPolicyAssignmentsCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicyAssignment); err != nil { - return RoleManagementPolicyAssignmentsCreateResponse{}, err + return RoleManagementPolicyAssignmentsCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -114,9 +119,6 @@ func (client *RoleManagementPolicyAssignmentsClient) Delete(ctx context.Context, // deleteCreateRequest creates the Delete request. func (client *RoleManagementPolicyAssignmentsClient) deleteCreateRequest(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, options *RoleManagementPolicyAssignmentsDeleteOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if roleManagementPolicyAssignmentName == "" { return nil, errors.New("parameter roleManagementPolicyAssignmentName cannot be empty") @@ -166,9 +168,6 @@ func (client *RoleManagementPolicyAssignmentsClient) Get(ctx context.Context, sc // getCreateRequest creates the Get request. func (client *RoleManagementPolicyAssignmentsClient) getCreateRequest(ctx context.Context, scope string, roleManagementPolicyAssignmentName string, options *RoleManagementPolicyAssignmentsGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments/{roleManagementPolicyAssignmentName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if roleManagementPolicyAssignmentName == "" { return nil, errors.New("parameter roleManagementPolicyAssignmentName cannot be empty") @@ -189,7 +188,7 @@ func (client *RoleManagementPolicyAssignmentsClient) getCreateRequest(ctx contex func (client *RoleManagementPolicyAssignmentsClient) getHandleResponse(resp *http.Response) (RoleManagementPolicyAssignmentsGetResponse, error) { result := RoleManagementPolicyAssignmentsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicyAssignment); err != nil { - return RoleManagementPolicyAssignmentsGetResponse{}, err + return RoleManagementPolicyAssignmentsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -224,9 +223,6 @@ func (client *RoleManagementPolicyAssignmentsClient) ListForScope(scope string, // listForScopeCreateRequest creates the ListForScope request. func (client *RoleManagementPolicyAssignmentsClient) listForScopeCreateRequest(ctx context.Context, scope string, options *RoleManagementPolicyAssignmentsListForScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Authorization/roleManagementPolicyAssignments" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -243,7 +239,7 @@ func (client *RoleManagementPolicyAssignmentsClient) listForScopeCreateRequest(c func (client *RoleManagementPolicyAssignmentsClient) listForScopeHandleResponse(resp *http.Response) (RoleManagementPolicyAssignmentsListForScopeResponse, error) { result := RoleManagementPolicyAssignmentsListForScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleManagementPolicyAssignmentListResult); err != nil { - return RoleManagementPolicyAssignmentsListForScopeResponse{}, err + return RoleManagementPolicyAssignmentsListForScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/authorization/armauthorization/zz_generated_time_rfc3339.go b/sdk/resourcemanager/authorization/armauthorization/zz_generated_time_rfc3339.go index ca57d79a90fa..92ca0d6f35a4 100644 --- a/sdk/resourcemanager/authorization/armauthorization/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/authorization/armauthorization/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armauthorization import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/automation/armautomation/CHANGELOG.md b/sdk/resourcemanager/automation/armautomation/CHANGELOG.md index 34f86d5bb408..bd4524485ca1 100644 --- a/sdk/resourcemanager/automation/armautomation/CHANGELOG.md +++ b/sdk/resourcemanager/automation/armautomation/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-15) diff --git a/sdk/resourcemanager/automation/armautomation/README.md b/sdk/resourcemanager/automation/armautomation/README.md index b48ddf9e39e0..3138afc30a60 100644 --- a/sdk/resourcemanager/automation/armautomation/README.md +++ b/sdk/resourcemanager/automation/armautomation/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Automation +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Automation modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armautomation.NewHybridRunbookWorkerGroupClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Automation modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armautomation.NewHybridRunbookWorkerGroupClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armautomation.NewHybridRunbookWorkerGroupClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/automation/armautomation/autorest.md b/sdk/resourcemanager/automation/armautomation/autorest.md index 1a0dc7da5ca8..2365b120dfd5 100644 --- a/sdk/resourcemanager/automation/armautomation/autorest.md +++ b/sdk/resourcemanager/automation/armautomation/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/a7e864e0ea1b7a3133d3f1def968985d117aa2f2/specification/automation/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/a7e864e0ea1b7a3133d3f1def968985d117aa2f2/specification/automation/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/automation/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/automation/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.1 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/automation/armautomation/go.mod b/sdk/resourcemanager/automation/armautomation/go.mod index 18c1719aa90d..5ac5629f83a0 100644 --- a/sdk/resourcemanager/automation/armautomation/go.mod +++ b/sdk/resourcemanager/automation/armautomation/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/automation/armautom go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.1.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/automation/armautomation/go.sum b/sdk/resourcemanager/automation/armautomation/go.sum index f37ba2aef08b..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/automation/armautomation/go.sum +++ b/sdk/resourcemanager/automation/armautomation/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible h1:WFsr3Efy7uweykOAEfOHO3ACtuwIv+rrFmSn9K48VnA= -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_activity_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_activity_client.go index f28ab6ac822f..9fcbf929a95a 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_activity_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_activity_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ActivityClient contains the methods for the Activity group. @@ -30,8 +31,15 @@ type ActivityClient struct { } // NewActivityClient creates a new instance of ActivityClient with the specified values. -func NewActivityClient(con *arm.Connection, subscriptionID string) *ActivityClient { - return &ActivityClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewActivityClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ActivityClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ActivityClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Retrieve the activity in the module identified by module name and activity name. @@ -89,7 +97,7 @@ func (client *ActivityClient) getCreateRequest(ctx context.Context, resourceGrou func (client *ActivityClient) getHandleResponse(resp *http.Response) (ActivityGetResponse, error) { result := ActivityGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Activity); err != nil { - return ActivityGetResponse{}, err + return ActivityGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -155,7 +163,7 @@ func (client *ActivityClient) listByModuleCreateRequest(ctx context.Context, res func (client *ActivityClient) listByModuleHandleResponse(resp *http.Response) (ActivityListByModuleResponse, error) { result := ActivityListByModuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ActivityListResult); err != nil { - return ActivityListByModuleResponse{}, err + return ActivityListByModuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_agentregistrationinformation_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_agentregistrationinformation_client.go index 0be7fc7025b3..ab20161d85de 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_agentregistrationinformation_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_agentregistrationinformation_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AgentRegistrationInformationClient contains the methods for the AgentRegistrationInformation group. @@ -30,8 +31,15 @@ type AgentRegistrationInformationClient struct { } // NewAgentRegistrationInformationClient creates a new instance of AgentRegistrationInformationClient with the specified values. -func NewAgentRegistrationInformationClient(con *arm.Connection, subscriptionID string) *AgentRegistrationInformationClient { - return &AgentRegistrationInformationClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAgentRegistrationInformationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AgentRegistrationInformationClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AgentRegistrationInformationClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Retrieve the automation agent registration information. @@ -81,7 +89,7 @@ func (client *AgentRegistrationInformationClient) getCreateRequest(ctx context.C func (client *AgentRegistrationInformationClient) getHandleResponse(resp *http.Response) (AgentRegistrationInformationGetResponse, error) { result := AgentRegistrationInformationGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AgentRegistration); err != nil { - return AgentRegistrationInformationGetResponse{}, err + return AgentRegistrationInformationGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -146,7 +154,7 @@ func (client *AgentRegistrationInformationClient) regenerateKeyCreateRequest(ctx func (client *AgentRegistrationInformationClient) regenerateKeyHandleResponse(resp *http.Response) (AgentRegistrationInformationRegenerateKeyResponse, error) { result := AgentRegistrationInformationRegenerateKeyResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AgentRegistration); err != nil { - return AgentRegistrationInformationRegenerateKeyResponse{}, err + return AgentRegistrationInformationRegenerateKeyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_automationaccount_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_automationaccount_client.go index 64930543b105..903f87f89e14 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_automationaccount_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_automationaccount_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AutomationAccountClient contains the methods for the AutomationAccount group. @@ -30,8 +31,15 @@ type AutomationAccountClient struct { } // NewAutomationAccountClient creates a new instance of AutomationAccountClient with the specified values. -func NewAutomationAccountClient(con *arm.Connection, subscriptionID string) *AutomationAccountClient { - return &AutomationAccountClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAutomationAccountClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AutomationAccountClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AutomationAccountClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update automation account. @@ -81,7 +89,7 @@ func (client *AutomationAccountClient) createOrUpdateCreateRequest(ctx context.C func (client *AutomationAccountClient) createOrUpdateHandleResponse(resp *http.Response) (AutomationAccountCreateOrUpdateResponse, error) { result := AutomationAccountCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AutomationAccount); err != nil { - return AutomationAccountCreateOrUpdateResponse{}, err + return AutomationAccountCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -202,7 +210,7 @@ func (client *AutomationAccountClient) getCreateRequest(ctx context.Context, res func (client *AutomationAccountClient) getHandleResponse(resp *http.Response) (AutomationAccountGetResponse, error) { result := AutomationAccountGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AutomationAccount); err != nil { - return AutomationAccountGetResponse{}, err + return AutomationAccountGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -256,7 +264,7 @@ func (client *AutomationAccountClient) listCreateRequest(ctx context.Context, op func (client *AutomationAccountClient) listHandleResponse(resp *http.Response) (AutomationAccountListResponse, error) { result := AutomationAccountListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AutomationAccountListResult); err != nil { - return AutomationAccountListResponse{}, err + return AutomationAccountListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -314,7 +322,7 @@ func (client *AutomationAccountClient) listByResourceGroupCreateRequest(ctx cont func (client *AutomationAccountClient) listByResourceGroupHandleResponse(resp *http.Response) (AutomationAccountListByResourceGroupResponse, error) { result := AutomationAccountListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AutomationAccountListResult); err != nil { - return AutomationAccountListByResourceGroupResponse{}, err + return AutomationAccountListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -379,7 +387,7 @@ func (client *AutomationAccountClient) updateCreateRequest(ctx context.Context, func (client *AutomationAccountClient) updateHandleResponse(resp *http.Response) (AutomationAccountUpdateResponse, error) { result := AutomationAccountUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AutomationAccount); err != nil { - return AutomationAccountUpdateResponse{}, err + return AutomationAccountUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_automationclient_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_automationclient_client.go index 2b21d7bb5bd7..0103b79d7178 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_automationclient_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_automationclient_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AutomationClient contains the methods for the AutomationClient group. @@ -30,8 +31,15 @@ type AutomationClient struct { } // NewAutomationClient creates a new instance of AutomationClient with the specified values. -func NewAutomationClient(con *arm.Connection, subscriptionID string) *AutomationClient { - return &AutomationClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAutomationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AutomationClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AutomationClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ConvertGraphRunbookContent - Post operation to serialize or deserialize GraphRunbookContent @@ -81,7 +89,7 @@ func (client *AutomationClient) convertGraphRunbookContentCreateRequest(ctx cont func (client *AutomationClient) convertGraphRunbookContentHandleResponse(resp *http.Response) (AutomationClientConvertGraphRunbookContentResponse, error) { result := AutomationClientConvertGraphRunbookContentResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GraphicalRunbookContent); err != nil { - return AutomationClientConvertGraphRunbookContentResponse{}, err + return AutomationClientConvertGraphRunbookContentResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_certificate_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_certificate_client.go index ace7925729bf..9754ecc2fd1b 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_certificate_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_certificate_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CertificateClient contains the methods for the Certificate group. @@ -30,8 +31,15 @@ type CertificateClient struct { } // NewCertificateClient creates a new instance of CertificateClient with the specified values. -func NewCertificateClient(con *arm.Connection, subscriptionID string) *CertificateClient { - return &CertificateClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCertificateClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CertificateClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CertificateClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create a certificate. @@ -85,7 +93,7 @@ func (client *CertificateClient) createOrUpdateCreateRequest(ctx context.Context func (client *CertificateClient) createOrUpdateHandleResponse(resp *http.Response) (CertificateCreateOrUpdateResponse, error) { result := CertificateCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Certificate); err != nil { - return CertificateCreateOrUpdateResponse{}, err + return CertificateCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *CertificateClient) getCreateRequest(ctx context.Context, resourceG func (client *CertificateClient) getHandleResponse(resp *http.Response) (CertificateGetResponse, error) { result := CertificateGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Certificate); err != nil { - return CertificateGetResponse{}, err + return CertificateGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -276,7 +284,7 @@ func (client *CertificateClient) listByAutomationAccountCreateRequest(ctx contex func (client *CertificateClient) listByAutomationAccountHandleResponse(resp *http.Response) (CertificateListByAutomationAccountResponse, error) { result := CertificateListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CertificateListResult); err != nil { - return CertificateListByAutomationAccountResponse{}, err + return CertificateListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -345,7 +353,7 @@ func (client *CertificateClient) updateCreateRequest(ctx context.Context, resour func (client *CertificateClient) updateHandleResponse(resp *http.Response) (CertificateUpdateResponse, error) { result := CertificateUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Certificate); err != nil { - return CertificateUpdateResponse{}, err + return CertificateUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_connection_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_connection_client.go index da55d38759b5..f469c998aabc 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_connection_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_connection_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ConnectionClient contains the methods for the Connection group. @@ -30,8 +31,15 @@ type ConnectionClient struct { } // NewConnectionClient creates a new instance of ConnectionClient with the specified values. -func NewConnectionClient(con *arm.Connection, subscriptionID string) *ConnectionClient { - return &ConnectionClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewConnectionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ConnectionClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ConnectionClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update a connection. @@ -85,7 +93,7 @@ func (client *ConnectionClient) createOrUpdateCreateRequest(ctx context.Context, func (client *ConnectionClient) createOrUpdateHandleResponse(resp *http.Response) (ConnectionCreateOrUpdateResponse, error) { result := ConnectionCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Connection); err != nil { - return ConnectionCreateOrUpdateResponse{}, err + return ConnectionCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *ConnectionClient) getCreateRequest(ctx context.Context, resourceGr func (client *ConnectionClient) getHandleResponse(resp *http.Response) (ConnectionGetResponse, error) { result := ConnectionGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Connection); err != nil { - return ConnectionGetResponse{}, err + return ConnectionGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -276,7 +284,7 @@ func (client *ConnectionClient) listByAutomationAccountCreateRequest(ctx context func (client *ConnectionClient) listByAutomationAccountHandleResponse(resp *http.Response) (ConnectionListByAutomationAccountResponse, error) { result := ConnectionListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionListResult); err != nil { - return ConnectionListByAutomationAccountResponse{}, err + return ConnectionListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -345,7 +353,7 @@ func (client *ConnectionClient) updateCreateRequest(ctx context.Context, resourc func (client *ConnectionClient) updateHandleResponse(resp *http.Response) (ConnectionUpdateResponse, error) { result := ConnectionUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Connection); err != nil { - return ConnectionUpdateResponse{}, err + return ConnectionUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_connectiontype_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_connectiontype_client.go index 707bab060b70..ba792d5c9114 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_connectiontype_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_connectiontype_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ConnectionTypeClient contains the methods for the ConnectionType group. @@ -30,8 +31,15 @@ type ConnectionTypeClient struct { } // NewConnectionTypeClient creates a new instance of ConnectionTypeClient with the specified values. -func NewConnectionTypeClient(con *arm.Connection, subscriptionID string) *ConnectionTypeClient { - return &ConnectionTypeClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewConnectionTypeClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ConnectionTypeClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ConnectionTypeClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create a connection type. @@ -85,7 +93,7 @@ func (client *ConnectionTypeClient) createOrUpdateCreateRequest(ctx context.Cont func (client *ConnectionTypeClient) createOrUpdateHandleResponse(resp *http.Response) (ConnectionTypeCreateOrUpdateResponse, error) { result := ConnectionTypeCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionType); err != nil { - return ConnectionTypeCreateOrUpdateResponse{}, err + return ConnectionTypeCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *ConnectionTypeClient) getCreateRequest(ctx context.Context, resour func (client *ConnectionTypeClient) getHandleResponse(resp *http.Response) (ConnectionTypeGetResponse, error) { result := ConnectionTypeGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionType); err != nil { - return ConnectionTypeGetResponse{}, err + return ConnectionTypeGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -276,7 +284,7 @@ func (client *ConnectionTypeClient) listByAutomationAccountCreateRequest(ctx con func (client *ConnectionTypeClient) listByAutomationAccountHandleResponse(resp *http.Response) (ConnectionTypeListByAutomationAccountResponse, error) { result := ConnectionTypeListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionTypeListResult); err != nil { - return ConnectionTypeListByAutomationAccountResponse{}, err + return ConnectionTypeListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_constants.go b/sdk/resourcemanager/automation/armautomation/zz_generated_constants.go index 0355240044f3..f4d61ae1324e 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_constants.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_constants.go @@ -10,7 +10,7 @@ package armautomation const ( module = "armautomation" - version = "v0.1.1" + version = "v0.2.0" ) // AgentRegistrationKeyName - Gets or sets the agent registration key name - primary or secondary. diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_credential_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_credential_client.go index 54c482933b68..eaf482699753 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_credential_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_credential_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CredentialClient contains the methods for the Credential group. @@ -30,8 +31,15 @@ type CredentialClient struct { } // NewCredentialClient creates a new instance of CredentialClient with the specified values. -func NewCredentialClient(con *arm.Connection, subscriptionID string) *CredentialClient { - return &CredentialClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCredentialClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CredentialClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CredentialClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create a credential. @@ -85,7 +93,7 @@ func (client *CredentialClient) createOrUpdateCreateRequest(ctx context.Context, func (client *CredentialClient) createOrUpdateHandleResponse(resp *http.Response) (CredentialCreateOrUpdateResponse, error) { result := CredentialCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Credential); err != nil { - return CredentialCreateOrUpdateResponse{}, err + return CredentialCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *CredentialClient) getCreateRequest(ctx context.Context, resourceGr func (client *CredentialClient) getHandleResponse(resp *http.Response) (CredentialGetResponse, error) { result := CredentialGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Credential); err != nil { - return CredentialGetResponse{}, err + return CredentialGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -276,7 +284,7 @@ func (client *CredentialClient) listByAutomationAccountCreateRequest(ctx context func (client *CredentialClient) listByAutomationAccountHandleResponse(resp *http.Response) (CredentialListByAutomationAccountResponse, error) { result := CredentialListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CredentialListResult); err != nil { - return CredentialListByAutomationAccountResponse{}, err + return CredentialListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -344,7 +352,7 @@ func (client *CredentialClient) updateCreateRequest(ctx context.Context, resourc func (client *CredentialClient) updateHandleResponse(resp *http.Response) (CredentialUpdateResponse, error) { result := CredentialUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Credential); err != nil { - return CredentialUpdateResponse{}, err + return CredentialUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_dsccompilationjob_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_dsccompilationjob_client.go index fbc04405129d..8991adbf9d81 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_dsccompilationjob_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_dsccompilationjob_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DscCompilationJobClient contains the methods for the DscCompilationJob group. @@ -31,8 +31,15 @@ type DscCompilationJobClient struct { } // NewDscCompilationJobClient creates a new instance of DscCompilationJobClient with the specified values. -func NewDscCompilationJobClient(con *arm.Connection, subscriptionID string) *DscCompilationJobClient { - return &DscCompilationJobClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDscCompilationJobClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DscCompilationJobClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DscCompilationJobClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates the Dsc compilation job of the configuration. @@ -166,7 +173,7 @@ func (client *DscCompilationJobClient) getCreateRequest(ctx context.Context, res func (client *DscCompilationJobClient) getHandleResponse(resp *http.Response) (DscCompilationJobGetResponse, error) { result := DscCompilationJobGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DscCompilationJob); err != nil { - return DscCompilationJobGetResponse{}, err + return DscCompilationJobGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -236,7 +243,7 @@ func (client *DscCompilationJobClient) getStreamCreateRequest(ctx context.Contex func (client *DscCompilationJobClient) getStreamHandleResponse(resp *http.Response) (DscCompilationJobGetStreamResponse, error) { result := DscCompilationJobGetStreamResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobStream); err != nil { - return DscCompilationJobGetStreamResponse{}, err + return DscCompilationJobGetStreamResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -301,7 +308,7 @@ func (client *DscCompilationJobClient) listByAutomationAccountCreateRequest(ctx func (client *DscCompilationJobClient) listByAutomationAccountHandleResponse(resp *http.Response) (DscCompilationJobListByAutomationAccountResponse, error) { result := DscCompilationJobListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DscCompilationJobListResult); err != nil { - return DscCompilationJobListByAutomationAccountResponse{}, err + return DscCompilationJobListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_dsccompilationjobstream_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_dsccompilationjobstream_client.go index 56b4497759d8..1a0eba6a3348 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_dsccompilationjobstream_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_dsccompilationjobstream_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DscCompilationJobStreamClient contains the methods for the DscCompilationJobStream group. @@ -30,8 +31,15 @@ type DscCompilationJobStreamClient struct { } // NewDscCompilationJobStreamClient creates a new instance of DscCompilationJobStreamClient with the specified values. -func NewDscCompilationJobStreamClient(con *arm.Connection, subscriptionID string) *DscCompilationJobStreamClient { - return &DscCompilationJobStreamClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDscCompilationJobStreamClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DscCompilationJobStreamClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DscCompilationJobStreamClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByJob - Retrieve all the job streams for the compilation Job. @@ -82,7 +90,7 @@ func (client *DscCompilationJobStreamClient) listByJobCreateRequest(ctx context. func (client *DscCompilationJobStreamClient) listByJobHandleResponse(resp *http.Response) (DscCompilationJobStreamListByJobResponse, error) { result := DscCompilationJobStreamListByJobResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobStreamListResult); err != nil { - return DscCompilationJobStreamListByJobResponse{}, err + return DscCompilationJobStreamListByJobResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_dscconfiguration_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_dscconfiguration_client.go index 2b43198213fa..71b073d32ddc 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_dscconfiguration_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_dscconfiguration_client.go @@ -12,15 +12,16 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming" + "net/http" + "net/url" + "strconv" + "strings" ) // DscConfigurationClient contains the methods for the DscConfiguration group. @@ -32,8 +33,15 @@ type DscConfigurationClient struct { } // NewDscConfigurationClient creates a new instance of DscConfigurationClient with the specified values. -func NewDscConfigurationClient(con *arm.Connection, subscriptionID string) *DscConfigurationClient { - return &DscConfigurationClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDscConfigurationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DscConfigurationClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DscConfigurationClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create the configuration identified by configuration name. @@ -88,7 +96,7 @@ func (client *DscConfigurationClient) createOrUpdateCreateRequest(ctx context.Co func (client *DscConfigurationClient) createOrUpdateHandleResponse(resp *http.Response) (DscConfigurationCreateOrUpdateResponse, error) { result := DscConfigurationCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DscConfiguration); err != nil { - return DscConfigurationCreateOrUpdateResponse{}, err + return DscConfigurationCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -157,7 +165,7 @@ func (client *DscConfigurationClient) createOrUpdateWithDscConfigurationCreateOr func (client *DscConfigurationClient) createOrUpdateWithDscConfigurationCreateOrUpdateParametersHandleResponse(resp *http.Response) (DscConfigurationCreateOrUpdateWithDscConfigurationCreateOrUpdateParametersResponse, error) { result := DscConfigurationCreateOrUpdateWithDscConfigurationCreateOrUpdateParametersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DscConfiguration); err != nil { - return DscConfigurationCreateOrUpdateWithDscConfigurationCreateOrUpdateParametersResponse{}, err + return DscConfigurationCreateOrUpdateWithDscConfigurationCreateOrUpdateParametersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -286,7 +294,7 @@ func (client *DscConfigurationClient) getCreateRequest(ctx context.Context, reso func (client *DscConfigurationClient) getHandleResponse(resp *http.Response) (DscConfigurationGetResponse, error) { result := DscConfigurationGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DscConfiguration); err != nil { - return DscConfigurationGetResponse{}, err + return DscConfigurationGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -425,7 +433,7 @@ func (client *DscConfigurationClient) listByAutomationAccountCreateRequest(ctx c func (client *DscConfigurationClient) listByAutomationAccountHandleResponse(resp *http.Response) (DscConfigurationListByAutomationAccountResponse, error) { result := DscConfigurationListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DscConfigurationListResult); err != nil { - return DscConfigurationListByAutomationAccountResponse{}, err + return DscConfigurationListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -498,7 +506,7 @@ func (client *DscConfigurationClient) updateCreateRequest(ctx context.Context, r func (client *DscConfigurationClient) updateHandleResponse(resp *http.Response) (DscConfigurationUpdateResponse, error) { result := DscConfigurationUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DscConfiguration); err != nil { - return DscConfigurationUpdateResponse{}, err + return DscConfigurationUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -570,7 +578,7 @@ func (client *DscConfigurationClient) updateWithDscConfigurationUpdateParameters func (client *DscConfigurationClient) updateWithDscConfigurationUpdateParametersHandleResponse(resp *http.Response) (DscConfigurationUpdateWithDscConfigurationUpdateParametersResponse, error) { result := DscConfigurationUpdateWithDscConfigurationUpdateParametersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DscConfiguration); err != nil { - return DscConfigurationUpdateWithDscConfigurationUpdateParametersResponse{}, err + return DscConfigurationUpdateWithDscConfigurationUpdateParametersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_dscnode_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_dscnode_client.go index 08033026982b..01429799fdb7 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_dscnode_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_dscnode_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // DscNodeClient contains the methods for the DscNode group. @@ -31,8 +32,15 @@ type DscNodeClient struct { } // NewDscNodeClient creates a new instance of DscNodeClient with the specified values. -func NewDscNodeClient(con *arm.Connection, subscriptionID string) *DscNodeClient { - return &DscNodeClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDscNodeClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DscNodeClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DscNodeClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Delete - Delete the dsc node identified by node id. @@ -146,7 +154,7 @@ func (client *DscNodeClient) getCreateRequest(ctx context.Context, resourceGroup func (client *DscNodeClient) getHandleResponse(resp *http.Response) (DscNodeGetResponse, error) { result := DscNodeGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DscNode); err != nil { - return DscNodeGetResponse{}, err + return DscNodeGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -220,7 +228,7 @@ func (client *DscNodeClient) listByAutomationAccountCreateRequest(ctx context.Co func (client *DscNodeClient) listByAutomationAccountHandleResponse(resp *http.Response) (DscNodeListByAutomationAccountResponse, error) { result := DscNodeListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DscNodeListResult); err != nil { - return DscNodeListByAutomationAccountResponse{}, err + return DscNodeListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -289,7 +297,7 @@ func (client *DscNodeClient) updateCreateRequest(ctx context.Context, resourceGr func (client *DscNodeClient) updateHandleResponse(resp *http.Response) (DscNodeUpdateResponse, error) { result := DscNodeUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DscNode); err != nil { - return DscNodeUpdateResponse{}, err + return DscNodeUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_dscnodeconfiguration_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_dscnodeconfiguration_client.go index 582697633dd0..f9d47d28d79d 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_dscnodeconfiguration_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_dscnodeconfiguration_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // DscNodeConfigurationClient contains the methods for the DscNodeConfiguration group. @@ -32,8 +32,15 @@ type DscNodeConfigurationClient struct { } // NewDscNodeConfigurationClient creates a new instance of DscNodeConfigurationClient with the specified values. -func NewDscNodeConfigurationClient(con *arm.Connection, subscriptionID string) *DscNodeConfigurationClient { - return &DscNodeConfigurationClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDscNodeConfigurationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DscNodeConfigurationClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DscNodeConfigurationClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create the node configuration identified by node configuration name. @@ -227,7 +234,7 @@ func (client *DscNodeConfigurationClient) getCreateRequest(ctx context.Context, func (client *DscNodeConfigurationClient) getHandleResponse(resp *http.Response) (DscNodeConfigurationGetResponse, error) { result := DscNodeConfigurationGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DscNodeConfiguration); err != nil { - return DscNodeConfigurationGetResponse{}, err + return DscNodeConfigurationGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -301,7 +308,7 @@ func (client *DscNodeConfigurationClient) listByAutomationAccountCreateRequest(c func (client *DscNodeConfigurationClient) listByAutomationAccountHandleResponse(resp *http.Response) (DscNodeConfigurationListByAutomationAccountResponse, error) { result := DscNodeConfigurationListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DscNodeConfigurationListResult); err != nil { - return DscNodeConfigurationListByAutomationAccountResponse{}, err + return DscNodeConfigurationListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_fields_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_fields_client.go index 26bb3839bb20..4311c20426da 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_fields_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_fields_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // FieldsClient contains the methods for the Fields group. @@ -30,8 +31,15 @@ type FieldsClient struct { } // NewFieldsClient creates a new instance of FieldsClient with the specified values. -func NewFieldsClient(con *arm.Connection, subscriptionID string) *FieldsClient { - return &FieldsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewFieldsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FieldsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FieldsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByType - Retrieve a list of fields of a given type identified by module name. @@ -89,7 +97,7 @@ func (client *FieldsClient) listByTypeCreateRequest(ctx context.Context, resourc func (client *FieldsClient) listByTypeHandleResponse(resp *http.Response) (FieldsListByTypeResponse, error) { result := FieldsListByTypeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TypeFieldListResult); err != nil { - return FieldsListByTypeResponse{}, err + return FieldsListByTypeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_hybridrunbookworkergroup_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_hybridrunbookworkergroup_client.go index 989ba38b5333..33fb53f31ff2 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_hybridrunbookworkergroup_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_hybridrunbookworkergroup_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // HybridRunbookWorkerGroupClient contains the methods for the HybridRunbookWorkerGroup group. @@ -30,8 +31,15 @@ type HybridRunbookWorkerGroupClient struct { } // NewHybridRunbookWorkerGroupClient creates a new instance of HybridRunbookWorkerGroupClient with the specified values. -func NewHybridRunbookWorkerGroupClient(con *arm.Connection, subscriptionID string) *HybridRunbookWorkerGroupClient { - return &HybridRunbookWorkerGroupClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewHybridRunbookWorkerGroupClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *HybridRunbookWorkerGroupClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &HybridRunbookWorkerGroupClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Create a hybrid runbook worker group. @@ -85,7 +93,7 @@ func (client *HybridRunbookWorkerGroupClient) createCreateRequest(ctx context.Co func (client *HybridRunbookWorkerGroupClient) createHandleResponse(resp *http.Response) (HybridRunbookWorkerGroupCreateResponse, error) { result := HybridRunbookWorkerGroupCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridRunbookWorkerGroup); err != nil { - return HybridRunbookWorkerGroupCreateResponse{}, err + return HybridRunbookWorkerGroupCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *HybridRunbookWorkerGroupClient) getCreateRequest(ctx context.Conte func (client *HybridRunbookWorkerGroupClient) getHandleResponse(resp *http.Response) (HybridRunbookWorkerGroupGetResponse, error) { result := HybridRunbookWorkerGroupGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridRunbookWorkerGroup); err != nil { - return HybridRunbookWorkerGroupGetResponse{}, err + return HybridRunbookWorkerGroupGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -279,7 +287,7 @@ func (client *HybridRunbookWorkerGroupClient) listByAutomationAccountCreateReque func (client *HybridRunbookWorkerGroupClient) listByAutomationAccountHandleResponse(resp *http.Response) (HybridRunbookWorkerGroupListByAutomationAccountResponse, error) { result := HybridRunbookWorkerGroupListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridRunbookWorkerGroupsListResult); err != nil { - return HybridRunbookWorkerGroupListByAutomationAccountResponse{}, err + return HybridRunbookWorkerGroupListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -348,7 +356,7 @@ func (client *HybridRunbookWorkerGroupClient) updateCreateRequest(ctx context.Co func (client *HybridRunbookWorkerGroupClient) updateHandleResponse(resp *http.Response) (HybridRunbookWorkerGroupUpdateResponse, error) { result := HybridRunbookWorkerGroupUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridRunbookWorkerGroup); err != nil { - return HybridRunbookWorkerGroupUpdateResponse{}, err + return HybridRunbookWorkerGroupUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_hybridrunbookworkers_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_hybridrunbookworkers_client.go index ce32846ed1d9..dcc081232321 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_hybridrunbookworkers_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_hybridrunbookworkers_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // HybridRunbookWorkersClient contains the methods for the HybridRunbookWorkers group. @@ -30,8 +31,15 @@ type HybridRunbookWorkersClient struct { } // NewHybridRunbookWorkersClient creates a new instance of HybridRunbookWorkersClient with the specified values. -func NewHybridRunbookWorkersClient(con *arm.Connection, subscriptionID string) *HybridRunbookWorkersClient { - return &HybridRunbookWorkersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewHybridRunbookWorkersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *HybridRunbookWorkersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &HybridRunbookWorkersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Create a hybrid runbook worker. @@ -89,7 +97,7 @@ func (client *HybridRunbookWorkersClient) createCreateRequest(ctx context.Contex func (client *HybridRunbookWorkersClient) createHandleResponse(resp *http.Response) (HybridRunbookWorkersCreateResponse, error) { result := HybridRunbookWorkersCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridRunbookWorker); err != nil { - return HybridRunbookWorkersCreateResponse{}, err + return HybridRunbookWorkersCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -226,7 +234,7 @@ func (client *HybridRunbookWorkersClient) getCreateRequest(ctx context.Context, func (client *HybridRunbookWorkersClient) getHandleResponse(resp *http.Response) (HybridRunbookWorkersGetResponse, error) { result := HybridRunbookWorkersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridRunbookWorker); err != nil { - return HybridRunbookWorkersGetResponse{}, err + return HybridRunbookWorkersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -295,7 +303,7 @@ func (client *HybridRunbookWorkersClient) listByHybridRunbookWorkerGroupCreateRe func (client *HybridRunbookWorkersClient) listByHybridRunbookWorkerGroupHandleResponse(resp *http.Response) (HybridRunbookWorkersListByHybridRunbookWorkerGroupResponse, error) { result := HybridRunbookWorkersListByHybridRunbookWorkerGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridRunbookWorkersListResult); err != nil { - return HybridRunbookWorkersListByHybridRunbookWorkerGroupResponse{}, err + return HybridRunbookWorkersListByHybridRunbookWorkerGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_job_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_job_client.go index 8af8d6fe3ed1..b5cf95de644d 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_job_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_job_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // JobClient contains the methods for the Job group. @@ -30,8 +31,15 @@ type JobClient struct { } // NewJobClient creates a new instance of JobClient with the specified values. -func NewJobClient(con *arm.Connection, subscriptionID string) *JobClient { - return &JobClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewJobClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *JobClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &JobClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Create a job of the runbook. @@ -88,7 +96,7 @@ func (client *JobClient) createCreateRequest(ctx context.Context, resourceGroupN func (client *JobClient) createHandleResponse(resp *http.Response) (JobCreateResponse, error) { result := JobCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Job); err != nil { - return JobCreateResponse{}, err + return JobCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -160,7 +168,7 @@ func (client *JobClient) getCreateRequest(ctx context.Context, resourceGroupName func (client *JobClient) getHandleResponse(resp *http.Response) (JobGetResponse, error) { result := JobGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Job); err != nil { - return JobGetResponse{}, err + return JobGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -364,7 +372,7 @@ func (client *JobClient) listByAutomationAccountCreateRequest(ctx context.Contex func (client *JobClient) listByAutomationAccountHandleResponse(resp *http.Response) (JobListByAutomationAccountResponse, error) { result := JobListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobListResultV2); err != nil { - return JobListByAutomationAccountResponse{}, err + return JobListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_jobschedule_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_jobschedule_client.go index ec8b4bb6a691..d57b44978f6e 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_jobschedule_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_jobschedule_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // JobScheduleClient contains the methods for the JobSchedule group. @@ -30,8 +31,15 @@ type JobScheduleClient struct { } // NewJobScheduleClient creates a new instance of JobScheduleClient with the specified values. -func NewJobScheduleClient(con *arm.Connection, subscriptionID string) *JobScheduleClient { - return &JobScheduleClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewJobScheduleClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *JobScheduleClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &JobScheduleClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Create a job schedule. @@ -82,7 +90,7 @@ func (client *JobScheduleClient) createCreateRequest(ctx context.Context, resour func (client *JobScheduleClient) createHandleResponse(resp *http.Response) (JobScheduleCreateResponse, error) { result := JobScheduleCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobSchedule); err != nil { - return JobScheduleCreateResponse{}, err + return JobScheduleCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -205,7 +213,7 @@ func (client *JobScheduleClient) getCreateRequest(ctx context.Context, resourceG func (client *JobScheduleClient) getHandleResponse(resp *http.Response) (JobScheduleGetResponse, error) { result := JobScheduleGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobSchedule); err != nil { - return JobScheduleGetResponse{}, err + return JobScheduleGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -270,7 +278,7 @@ func (client *JobScheduleClient) listByAutomationAccountCreateRequest(ctx contex func (client *JobScheduleClient) listByAutomationAccountHandleResponse(resp *http.Response) (JobScheduleListByAutomationAccountResponse, error) { result := JobScheduleListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobScheduleListResult); err != nil { - return JobScheduleListByAutomationAccountResponse{}, err + return JobScheduleListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_jobstream_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_jobstream_client.go index dfc1f7328bb0..19d56330be4b 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_jobstream_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_jobstream_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // JobStreamClient contains the methods for the JobStream group. @@ -30,8 +31,15 @@ type JobStreamClient struct { } // NewJobStreamClient creates a new instance of JobStreamClient with the specified values. -func NewJobStreamClient(con *arm.Connection, subscriptionID string) *JobStreamClient { - return &JobStreamClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewJobStreamClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *JobStreamClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &JobStreamClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Retrieve the job stream identified by job stream id. @@ -92,7 +100,7 @@ func (client *JobStreamClient) getCreateRequest(ctx context.Context, resourceGro func (client *JobStreamClient) getHandleResponse(resp *http.Response) (JobStreamGetResponse, error) { result := JobStreamGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobStream); err != nil { - return JobStreamGetResponse{}, err + return JobStreamGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -164,7 +172,7 @@ func (client *JobStreamClient) listByJobCreateRequest(ctx context.Context, resou func (client *JobStreamClient) listByJobHandleResponse(resp *http.Response) (JobStreamListByJobResponse, error) { result := JobStreamListByJobResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobStreamListResult); err != nil { - return JobStreamListByJobResponse{}, err + return JobStreamListByJobResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_keys_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_keys_client.go index 81c2a28a9af4..3d0e8499a328 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_keys_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_keys_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // KeysClient contains the methods for the Keys group. @@ -30,8 +31,15 @@ type KeysClient struct { } // NewKeysClient creates a new instance of KeysClient with the specified values. -func NewKeysClient(con *arm.Connection, subscriptionID string) *KeysClient { - return &KeysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *KeysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &KeysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByAutomationAccount - Retrieve the automation keys for an account. @@ -81,7 +89,7 @@ func (client *KeysClient) listByAutomationAccountCreateRequest(ctx context.Conte func (client *KeysClient) listByAutomationAccountHandleResponse(resp *http.Response) (KeysListByAutomationAccountResponse, error) { result := KeysListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.KeyListResult); err != nil { - return KeysListByAutomationAccountResponse{}, err + return KeysListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_linkedworkspace_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_linkedworkspace_client.go index 36cb992647ab..8dbecd61db9f 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_linkedworkspace_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_linkedworkspace_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LinkedWorkspaceClient contains the methods for the LinkedWorkspace group. @@ -30,8 +31,15 @@ type LinkedWorkspaceClient struct { } // NewLinkedWorkspaceClient creates a new instance of LinkedWorkspaceClient with the specified values. -func NewLinkedWorkspaceClient(con *arm.Connection, subscriptionID string) *LinkedWorkspaceClient { - return &LinkedWorkspaceClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLinkedWorkspaceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LinkedWorkspaceClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LinkedWorkspaceClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Retrieve the linked workspace for the account id. @@ -81,7 +89,7 @@ func (client *LinkedWorkspaceClient) getCreateRequest(ctx context.Context, resou func (client *LinkedWorkspaceClient) getHandleResponse(resp *http.Response) (LinkedWorkspaceGetResponse, error) { result := LinkedWorkspaceGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LinkedWorkspace); err != nil { - return LinkedWorkspaceGetResponse{}, err + return LinkedWorkspaceGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_models.go b/sdk/resourcemanager/automation/armautomation/zz_generated_models.go index 6f495b859d01..74700268960d 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_models.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_models.go @@ -10,10 +10,9 @@ package armautomation import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // Activity - Definition of the activity. @@ -166,10 +165,10 @@ type ActivityProperties struct { // MarshalJSON implements the json.Marshaller interface for type ActivityProperties. func (a ActivityProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(a.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", a.CreationTime) populate(objectMap, "definition", a.Definition) populate(objectMap, "description", a.Description) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(a.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", a.LastModifiedTime) populate(objectMap, "outputTypes", a.OutputTypes) populate(objectMap, "parameterSets", a.ParameterSets) return json.Marshal(objectMap) @@ -185,9 +184,7 @@ func (a *ActivityProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.CreationTime) delete(rawMsg, key) case "definition": err = unpopulate(val, &a.Definition) @@ -196,9 +193,7 @@ func (a *ActivityProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.Description) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.LastModifiedTime) delete(rawMsg, key) case "outputTypes": err = unpopulate(val, &a.OutputTypes) @@ -437,12 +432,12 @@ type AutomationAccountProperties struct { func (a AutomationAccountProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "automationHybridServiceUrl", a.AutomationHybridServiceURL) - populate(objectMap, "creationTime", (*timeRFC3339)(a.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", a.CreationTime) populate(objectMap, "description", a.Description) populate(objectMap, "disableLocalAuth", a.DisableLocalAuth) populate(objectMap, "encryption", a.Encryption) populate(objectMap, "lastModifiedBy", a.LastModifiedBy) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(a.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", a.LastModifiedTime) populate(objectMap, "privateEndpointConnections", a.PrivateEndpointConnections) populate(objectMap, "publicNetworkAccess", a.PublicNetworkAccess) populate(objectMap, "sku", a.SKU) @@ -463,9 +458,7 @@ func (a *AutomationAccountProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.AutomationHybridServiceURL) delete(rawMsg, key) case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.CreationTime) delete(rawMsg, key) case "description": err = unpopulate(val, &a.Description) @@ -480,9 +473,7 @@ func (a *AutomationAccountProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.LastModifiedBy) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.LastModifiedTime) delete(rawMsg, key) case "privateEndpointConnections": err = unpopulate(val, &a.PrivateEndpointConnections) @@ -679,11 +670,11 @@ type CertificateProperties struct { // MarshalJSON implements the json.Marshaller interface for type CertificateProperties. func (c CertificateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(c.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", c.CreationTime) populate(objectMap, "description", c.Description) - populate(objectMap, "expiryTime", (*timeRFC3339)(c.ExpiryTime)) + populateTimeRFC3339(objectMap, "expiryTime", c.ExpiryTime) populate(objectMap, "isExportable", c.IsExportable) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(c.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", c.LastModifiedTime) populate(objectMap, "thumbprint", c.Thumbprint) return json.Marshal(objectMap) } @@ -698,25 +689,19 @@ func (c *CertificateProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.CreationTime) delete(rawMsg, key) case "description": err = unpopulate(val, &c.Description) delete(rawMsg, key) case "expiryTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.ExpiryTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.ExpiryTime) delete(rawMsg, key) case "isExportable": err = unpopulate(val, &c.IsExportable) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.LastModifiedTime) delete(rawMsg, key) case "thumbprint": err = unpopulate(val, &c.Thumbprint) @@ -869,10 +854,10 @@ type ConnectionProperties struct { func (c ConnectionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "connectionType", c.ConnectionType) - populate(objectMap, "creationTime", (*timeRFC3339)(c.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", c.CreationTime) populate(objectMap, "description", c.Description) populate(objectMap, "fieldDefinitionValues", c.FieldDefinitionValues) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(c.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", c.LastModifiedTime) return json.Marshal(objectMap) } @@ -889,9 +874,7 @@ func (c *ConnectionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.ConnectionType) delete(rawMsg, key) case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.CreationTime) delete(rawMsg, key) case "description": err = unpopulate(val, &c.Description) @@ -900,9 +883,7 @@ func (c *ConnectionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.FieldDefinitionValues) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.LastModifiedTime) delete(rawMsg, key) } if err != nil { @@ -1017,11 +998,11 @@ type ConnectionTypeProperties struct { // MarshalJSON implements the json.Marshaller interface for type ConnectionTypeProperties. func (c ConnectionTypeProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(c.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", c.CreationTime) populate(objectMap, "description", c.Description) populate(objectMap, "fieldDefinitions", c.FieldDefinitions) populate(objectMap, "isGlobal", c.IsGlobal) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(c.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", c.LastModifiedTime) return json.Marshal(objectMap) } @@ -1035,9 +1016,7 @@ func (c *ConnectionTypeProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.CreationTime) delete(rawMsg, key) case "description": err = unpopulate(val, &c.Description) @@ -1049,9 +1028,7 @@ func (c *ConnectionTypeProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.IsGlobal) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.LastModifiedTime) delete(rawMsg, key) } if err != nil { @@ -1227,9 +1204,9 @@ type CredentialProperties struct { // MarshalJSON implements the json.Marshaller interface for type CredentialProperties. func (c CredentialProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(c.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", c.CreationTime) populate(objectMap, "description", c.Description) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(c.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", c.LastModifiedTime) populate(objectMap, "userName", c.UserName) return json.Marshal(objectMap) } @@ -1244,17 +1221,13 @@ func (c *CredentialProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.CreationTime) delete(rawMsg, key) case "description": err = unpopulate(val, &c.Description) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.LastModifiedTime) delete(rawMsg, key) case "userName": err = unpopulate(val, &c.UserName) @@ -1449,16 +1422,16 @@ type DscCompilationJobProperties struct { func (d DscCompilationJobProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "configuration", d.Configuration) - populate(objectMap, "creationTime", (*timeRFC3339)(d.CreationTime)) - populate(objectMap, "endTime", (*timeRFC3339)(d.EndTime)) + populateTimeRFC3339(objectMap, "creationTime", d.CreationTime) + populateTimeRFC3339(objectMap, "endTime", d.EndTime) populate(objectMap, "exception", d.Exception) populate(objectMap, "jobId", d.JobID) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(d.LastModifiedTime)) - populate(objectMap, "lastStatusModifiedTime", (*timeRFC3339)(d.LastStatusModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", d.LastModifiedTime) + populateTimeRFC3339(objectMap, "lastStatusModifiedTime", d.LastStatusModifiedTime) populate(objectMap, "parameters", d.Parameters) populate(objectMap, "provisioningState", d.ProvisioningState) populate(objectMap, "runOn", d.RunOn) - populate(objectMap, "startTime", (*timeRFC3339)(d.StartTime)) + populateTimeRFC3339(objectMap, "startTime", d.StartTime) populate(objectMap, "startedBy", d.StartedBy) populate(objectMap, "status", d.Status) populate(objectMap, "statusDetails", d.StatusDetails) @@ -1478,14 +1451,10 @@ func (d *DscCompilationJobProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.Configuration) delete(rawMsg, key) case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.CreationTime) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.EndTime) delete(rawMsg, key) case "exception": err = unpopulate(val, &d.Exception) @@ -1494,14 +1463,10 @@ func (d *DscCompilationJobProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.JobID) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.LastModifiedTime) delete(rawMsg, key) case "lastStatusModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.LastStatusModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.LastStatusModifiedTime) delete(rawMsg, key) case "parameters": err = unpopulate(val, &d.Parameters) @@ -1513,9 +1478,7 @@ func (d *DscCompilationJobProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.RunOn) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.StartTime) delete(rawMsg, key) case "startedBy": err = unpopulate(val, &d.StartedBy) @@ -1728,10 +1691,10 @@ type DscConfigurationProperties struct { // MarshalJSON implements the json.Marshaller interface for type DscConfigurationProperties. func (d DscConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(d.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", d.CreationTime) populate(objectMap, "description", d.Description) populate(objectMap, "jobCount", d.JobCount) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(d.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", d.LastModifiedTime) populate(objectMap, "logVerbose", d.LogVerbose) populate(objectMap, "nodeConfigurationCount", d.NodeConfigurationCount) populate(objectMap, "parameters", d.Parameters) @@ -1751,9 +1714,7 @@ func (d *DscConfigurationProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.CreationTime) delete(rawMsg, key) case "description": err = unpopulate(val, &d.Description) @@ -1762,9 +1723,7 @@ func (d *DscConfigurationProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.JobCount) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.LastModifiedTime) delete(rawMsg, key) case "logVerbose": err = unpopulate(val, &d.LogVerbose) @@ -1992,9 +1951,9 @@ type DscNodeConfigurationProperties struct { func (d DscNodeConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "configuration", d.Configuration) - populate(objectMap, "creationTime", (*timeRFC3339)(d.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", d.CreationTime) populate(objectMap, "incrementNodeConfigurationBuild", d.IncrementNodeConfigurationBuild) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(d.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", d.LastModifiedTime) populate(objectMap, "nodeCount", d.NodeCount) populate(objectMap, "source", d.Source) return json.Marshal(objectMap) @@ -2013,17 +1972,13 @@ func (d *DscNodeConfigurationProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.Configuration) delete(rawMsg, key) case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.CreationTime) delete(rawMsg, key) case "incrementNodeConfigurationBuild": err = unpopulate(val, &d.IncrementNodeConfigurationBuild) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.LastModifiedTime) delete(rawMsg, key) case "nodeCount": err = unpopulate(val, &d.NodeCount) @@ -2131,10 +2086,10 @@ func (d DscNodeProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "etag", d.Etag) populate(objectMap, "extensionHandler", d.ExtensionHandler) populate(objectMap, "ip", d.IP) - populate(objectMap, "lastSeen", (*timeRFC3339)(d.LastSeen)) + populateTimeRFC3339(objectMap, "lastSeen", d.LastSeen) populate(objectMap, "nodeConfiguration", d.NodeConfiguration) populate(objectMap, "nodeId", d.NodeID) - populate(objectMap, "registrationTime", (*timeRFC3339)(d.RegistrationTime)) + populateTimeRFC3339(objectMap, "registrationTime", d.RegistrationTime) populate(objectMap, "status", d.Status) populate(objectMap, "totalCount", d.TotalCount) return json.Marshal(objectMap) @@ -2162,9 +2117,7 @@ func (d *DscNodeProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.IP) delete(rawMsg, key) case "lastSeen": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.LastSeen = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.LastSeen) delete(rawMsg, key) case "nodeConfiguration": err = unpopulate(val, &d.NodeConfiguration) @@ -2173,9 +2126,7 @@ func (d *DscNodeProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.NodeID) delete(rawMsg, key) case "registrationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.RegistrationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.RegistrationTime) delete(rawMsg, key) case "status": err = unpopulate(val, &d.Status) @@ -2255,13 +2206,13 @@ type DscNodeReport struct { func (d DscNodeReport) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "configurationVersion", d.ConfigurationVersion) - populate(objectMap, "endTime", (*timeRFC3339)(d.EndTime)) + populateTimeRFC3339(objectMap, "endTime", d.EndTime) populate(objectMap, "errors", d.Errors) populate(objectMap, "hostName", d.HostName) populate(objectMap, "id", d.ID) populate(objectMap, "iPV4Addresses", d.IPV4Addresses) populate(objectMap, "iPV6Addresses", d.IPV6Addresses) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(d.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", d.LastModifiedTime) populate(objectMap, "metaConfiguration", d.MetaConfiguration) populate(objectMap, "numberOfResources", d.NumberOfResources) populate(objectMap, "rawErrors", d.RawErrors) @@ -2270,7 +2221,7 @@ func (d DscNodeReport) MarshalJSON() ([]byte, error) { populate(objectMap, "reportFormatVersion", d.ReportFormatVersion) populate(objectMap, "reportId", d.ReportID) populate(objectMap, "resources", d.Resources) - populate(objectMap, "startTime", (*timeRFC3339)(d.StartTime)) + populateTimeRFC3339(objectMap, "startTime", d.StartTime) populate(objectMap, "status", d.Status) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) @@ -2289,9 +2240,7 @@ func (d *DscNodeReport) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.ConfigurationVersion) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.EndTime) delete(rawMsg, key) case "errors": err = unpopulate(val, &d.Errors) @@ -2309,9 +2258,7 @@ func (d *DscNodeReport) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.IPV6Addresses) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.LastModifiedTime) delete(rawMsg, key) case "metaConfiguration": err = unpopulate(val, &d.MetaConfiguration) @@ -2338,9 +2285,7 @@ func (d *DscNodeReport) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.Resources) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &d.Status) @@ -2463,7 +2408,7 @@ func (d DscReportResource) MarshalJSON() ([]byte, error) { populate(objectMap, "resourceId", d.ResourceID) populate(objectMap, "resourceName", d.ResourceName) populate(objectMap, "sourceInfo", d.SourceInfo) - populate(objectMap, "startDate", (*timeRFC3339)(d.StartDate)) + populateTimeRFC3339(objectMap, "startDate", d.StartDate) populate(objectMap, "status", d.Status) return json.Marshal(objectMap) } @@ -2502,9 +2447,7 @@ func (d *DscReportResource) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.SourceInfo) delete(rawMsg, key) case "startDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.StartDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.StartDate) delete(rawMsg, key) case "status": err = unpopulate(val, &d.Status) @@ -2737,9 +2680,9 @@ type HybridRunbookWorkerLegacy struct { func (h HybridRunbookWorkerLegacy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "ip", h.IP) - populate(objectMap, "lastSeenDateTime", (*timeRFC3339)(h.LastSeenDateTime)) + populateTimeRFC3339(objectMap, "lastSeenDateTime", h.LastSeenDateTime) populate(objectMap, "name", h.Name) - populate(objectMap, "registrationTime", (*timeRFC3339)(h.RegistrationTime)) + populateTimeRFC3339(objectMap, "registrationTime", h.RegistrationTime) return json.Marshal(objectMap) } @@ -2756,17 +2699,13 @@ func (h *HybridRunbookWorkerLegacy) UnmarshalJSON(data []byte) error { err = unpopulate(val, &h.IP) delete(rawMsg, key) case "lastSeenDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - h.LastSeenDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &h.LastSeenDateTime) delete(rawMsg, key) case "name": err = unpopulate(val, &h.Name) delete(rawMsg, key) case "registrationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - h.RegistrationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &h.RegistrationTime) delete(rawMsg, key) } if err != nil { @@ -2807,8 +2746,8 @@ type HybridRunbookWorkerProperties struct { func (h HybridRunbookWorkerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "ip", h.IP) - populate(objectMap, "lastSeenDateTime", (*timeRFC3339)(h.LastSeenDateTime)) - populate(objectMap, "registeredDateTime", (*timeRFC3339)(h.RegisteredDateTime)) + populateTimeRFC3339(objectMap, "lastSeenDateTime", h.LastSeenDateTime) + populateTimeRFC3339(objectMap, "registeredDateTime", h.RegisteredDateTime) populate(objectMap, "vmResourceId", h.VMResourceID) populate(objectMap, "workerName", h.WorkerName) populate(objectMap, "workerType", h.WorkerType) @@ -2828,14 +2767,10 @@ func (h *HybridRunbookWorkerProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &h.IP) delete(rawMsg, key) case "lastSeenDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - h.LastSeenDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &h.LastSeenDateTime) delete(rawMsg, key) case "registeredDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - h.RegisteredDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &h.RegisteredDateTime) delete(rawMsg, key) case "vmResourceId": err = unpopulate(val, &h.VMResourceID) @@ -2987,14 +2922,14 @@ type JobCollectionItemProperties struct { // MarshalJSON implements the json.Marshaller interface for type JobCollectionItemProperties. func (j JobCollectionItemProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(j.CreationTime)) - populate(objectMap, "endTime", (*timeRFC3339)(j.EndTime)) + populateTimeRFC3339(objectMap, "creationTime", j.CreationTime) + populateTimeRFC3339(objectMap, "endTime", j.EndTime) populate(objectMap, "jobId", j.JobID) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(j.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", j.LastModifiedTime) populate(objectMap, "provisioningState", j.ProvisioningState) populate(objectMap, "runOn", j.RunOn) populate(objectMap, "runbook", j.Runbook) - populate(objectMap, "startTime", (*timeRFC3339)(j.StartTime)) + populateTimeRFC3339(objectMap, "startTime", j.StartTime) populate(objectMap, "status", j.Status) return json.Marshal(objectMap) } @@ -3009,22 +2944,16 @@ func (j *JobCollectionItemProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.CreationTime) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.EndTime) delete(rawMsg, key) case "jobId": err = unpopulate(val, &j.JobID) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.LastModifiedTime) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, &j.ProvisioningState) @@ -3036,9 +2965,7 @@ func (j *JobCollectionItemProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &j.Runbook) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &j.Status) @@ -3180,17 +3107,17 @@ type JobProperties struct { // MarshalJSON implements the json.Marshaller interface for type JobProperties. func (j JobProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(j.CreationTime)) - populate(objectMap, "endTime", (*timeRFC3339)(j.EndTime)) + populateTimeRFC3339(objectMap, "creationTime", j.CreationTime) + populateTimeRFC3339(objectMap, "endTime", j.EndTime) populate(objectMap, "exception", j.Exception) populate(objectMap, "jobId", j.JobID) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(j.LastModifiedTime)) - populate(objectMap, "lastStatusModifiedTime", (*timeRFC3339)(j.LastStatusModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", j.LastModifiedTime) + populateTimeRFC3339(objectMap, "lastStatusModifiedTime", j.LastStatusModifiedTime) populate(objectMap, "parameters", j.Parameters) populate(objectMap, "provisioningState", j.ProvisioningState) populate(objectMap, "runOn", j.RunOn) populate(objectMap, "runbook", j.Runbook) - populate(objectMap, "startTime", (*timeRFC3339)(j.StartTime)) + populateTimeRFC3339(objectMap, "startTime", j.StartTime) populate(objectMap, "startedBy", j.StartedBy) populate(objectMap, "status", j.Status) populate(objectMap, "statusDetails", j.StatusDetails) @@ -3207,14 +3134,10 @@ func (j *JobProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.CreationTime) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.EndTime) delete(rawMsg, key) case "exception": err = unpopulate(val, &j.Exception) @@ -3223,14 +3146,10 @@ func (j *JobProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &j.JobID) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.LastModifiedTime) delete(rawMsg, key) case "lastStatusModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.LastStatusModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.LastStatusModifiedTime) delete(rawMsg, key) case "parameters": err = unpopulate(val, &j.Parameters) @@ -3245,9 +3164,7 @@ func (j *JobProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &j.Runbook) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.StartTime) delete(rawMsg, key) case "startedBy": err = unpopulate(val, &j.StartedBy) @@ -3459,7 +3376,7 @@ func (j JobStreamProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "streamText", j.StreamText) populate(objectMap, "streamType", j.StreamType) populate(objectMap, "summary", j.Summary) - populate(objectMap, "time", (*timeRFC3339)(j.Time)) + populateTimeRFC3339(objectMap, "time", j.Time) populate(objectMap, "value", j.Value) return json.Marshal(objectMap) } @@ -3486,9 +3403,7 @@ func (j *JobStreamProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &j.Summary) delete(rawMsg, key) case "time": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.Time = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.Time) delete(rawMsg, key) case "value": err = unpopulate(val, &j.Value) @@ -3721,12 +3636,12 @@ func (m ModuleProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "activityCount", m.ActivityCount) populate(objectMap, "contentLink", m.ContentLink) - populate(objectMap, "creationTime", (*timeRFC3339)(m.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", m.CreationTime) populate(objectMap, "description", m.Description) populate(objectMap, "error", m.Error) populate(objectMap, "isComposite", m.IsComposite) populate(objectMap, "isGlobal", m.IsGlobal) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(m.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", m.LastModifiedTime) populate(objectMap, "provisioningState", m.ProvisioningState) populate(objectMap, "sizeInBytes", m.SizeInBytes) populate(objectMap, "version", m.Version) @@ -3749,9 +3664,7 @@ func (m *ModuleProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.ContentLink) delete(rawMsg, key) case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.CreationTime) delete(rawMsg, key) case "description": err = unpopulate(val, &m.Description) @@ -3766,9 +3679,7 @@ func (m *ModuleProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.IsGlobal) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.LastModifiedTime) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, &m.ProvisioningState) @@ -4309,10 +4220,10 @@ type RunbookDraft struct { // MarshalJSON implements the json.Marshaller interface for type RunbookDraft. func (r RunbookDraft) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(r.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", r.CreationTime) populate(objectMap, "draftContentLink", r.DraftContentLink) populate(objectMap, "inEdit", r.InEdit) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(r.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", r.LastModifiedTime) populate(objectMap, "outputTypes", r.OutputTypes) populate(objectMap, "parameters", r.Parameters) return json.Marshal(objectMap) @@ -4328,9 +4239,7 @@ func (r *RunbookDraft) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.CreationTime) delete(rawMsg, key) case "draftContentLink": err = unpopulate(val, &r.DraftContentLink) @@ -4339,9 +4248,7 @@ func (r *RunbookDraft) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.InEdit) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.LastModifiedTime) delete(rawMsg, key) case "outputTypes": err = unpopulate(val, &r.OutputTypes) @@ -4481,12 +4388,12 @@ type RunbookProperties struct { // MarshalJSON implements the json.Marshaller interface for type RunbookProperties. func (r RunbookProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(r.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", r.CreationTime) populate(objectMap, "description", r.Description) populate(objectMap, "draft", r.Draft) populate(objectMap, "jobCount", r.JobCount) populate(objectMap, "lastModifiedBy", r.LastModifiedBy) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(r.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", r.LastModifiedTime) populate(objectMap, "logActivityTrace", r.LogActivityTrace) populate(objectMap, "logProgress", r.LogProgress) populate(objectMap, "logVerbose", r.LogVerbose) @@ -4509,9 +4416,7 @@ func (r *RunbookProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.CreationTime) delete(rawMsg, key) case "description": err = unpopulate(val, &r.Description) @@ -4526,9 +4431,7 @@ func (r *RunbookProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.LastModifiedBy) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.LastModifiedTime) delete(rawMsg, key) case "logActivityTrace": err = unpopulate(val, &r.LogActivityTrace) @@ -4671,17 +4574,17 @@ type SUCScheduleProperties struct { func (s SUCScheduleProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "advancedSchedule", s.AdvancedSchedule) - populate(objectMap, "creationTime", (*timeRFC3339)(s.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", s.CreationTime) populate(objectMap, "description", s.Description) - populate(objectMap, "expiryTime", (*timeRFC3339)(s.ExpiryTime)) + populateTimeRFC3339(objectMap, "expiryTime", s.ExpiryTime) populate(objectMap, "expiryTimeOffsetMinutes", s.ExpiryTimeOffsetMinutes) populate(objectMap, "frequency", s.Frequency) populate(objectMap, "interval", s.Interval) populate(objectMap, "isEnabled", s.IsEnabled) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(s.LastModifiedTime)) - populate(objectMap, "nextRun", (*timeRFC3339)(s.NextRun)) + populateTimeRFC3339(objectMap, "lastModifiedTime", s.LastModifiedTime) + populateTimeRFC3339(objectMap, "nextRun", s.NextRun) populate(objectMap, "nextRunOffsetMinutes", s.NextRunOffsetMinutes) - populate(objectMap, "startTime", (*timeRFC3339)(s.StartTime)) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) populate(objectMap, "startTimeOffsetMinutes", s.StartTimeOffsetMinutes) populate(objectMap, "timeZone", s.TimeZone) return json.Marshal(objectMap) @@ -4700,17 +4603,13 @@ func (s *SUCScheduleProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.AdvancedSchedule) delete(rawMsg, key) case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreationTime) delete(rawMsg, key) case "description": err = unpopulate(val, &s.Description) delete(rawMsg, key) case "expiryTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.ExpiryTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.ExpiryTime) delete(rawMsg, key) case "expiryTimeOffsetMinutes": err = unpopulate(val, &s.ExpiryTimeOffsetMinutes) @@ -4725,22 +4624,16 @@ func (s *SUCScheduleProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.IsEnabled) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedTime) delete(rawMsg, key) case "nextRun": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.NextRun = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.NextRun) delete(rawMsg, key) case "nextRunOffsetMinutes": err = unpopulate(val, &s.NextRunOffsetMinutes) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.StartTime) delete(rawMsg, key) case "startTimeOffsetMinutes": err = unpopulate(val, &s.StartTimeOffsetMinutes) @@ -4820,10 +4713,10 @@ func (s ScheduleCreateOrUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "advancedSchedule", s.AdvancedSchedule) populate(objectMap, "description", s.Description) - populate(objectMap, "expiryTime", (*timeRFC3339)(s.ExpiryTime)) + populateTimeRFC3339(objectMap, "expiryTime", s.ExpiryTime) populate(objectMap, "frequency", s.Frequency) populate(objectMap, "interval", s.Interval) - populate(objectMap, "startTime", (*timeRFC3339)(s.StartTime)) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) populate(objectMap, "timeZone", s.TimeZone) return json.Marshal(objectMap) } @@ -4844,9 +4737,7 @@ func (s *ScheduleCreateOrUpdateProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Description) delete(rawMsg, key) case "expiryTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.ExpiryTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.ExpiryTime) delete(rawMsg, key) case "frequency": err = unpopulate(val, &s.Frequency) @@ -4855,9 +4746,7 @@ func (s *ScheduleCreateOrUpdateProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Interval) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.StartTime) delete(rawMsg, key) case "timeZone": err = unpopulate(val, &s.TimeZone) @@ -4951,17 +4840,17 @@ type ScheduleProperties struct { func (s ScheduleProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "advancedSchedule", s.AdvancedSchedule) - populate(objectMap, "creationTime", (*timeRFC3339)(s.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", s.CreationTime) populate(objectMap, "description", s.Description) - populate(objectMap, "expiryTime", (*timeRFC3339)(s.ExpiryTime)) + populateTimeRFC3339(objectMap, "expiryTime", s.ExpiryTime) populate(objectMap, "expiryTimeOffsetMinutes", s.ExpiryTimeOffsetMinutes) populate(objectMap, "frequency", s.Frequency) populate(objectMap, "interval", s.Interval) populate(objectMap, "isEnabled", s.IsEnabled) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(s.LastModifiedTime)) - populate(objectMap, "nextRun", (*timeRFC3339)(s.NextRun)) + populateTimeRFC3339(objectMap, "lastModifiedTime", s.LastModifiedTime) + populateTimeRFC3339(objectMap, "nextRun", s.NextRun) populate(objectMap, "nextRunOffsetMinutes", s.NextRunOffsetMinutes) - populate(objectMap, "startTime", (*timeRFC3339)(s.StartTime)) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) populate(objectMap, "startTimeOffsetMinutes", s.StartTimeOffsetMinutes) populate(objectMap, "timeZone", s.TimeZone) return json.Marshal(objectMap) @@ -4980,17 +4869,13 @@ func (s *ScheduleProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.AdvancedSchedule) delete(rawMsg, key) case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreationTime) delete(rawMsg, key) case "description": err = unpopulate(val, &s.Description) delete(rawMsg, key) case "expiryTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.ExpiryTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.ExpiryTime) delete(rawMsg, key) case "expiryTimeOffsetMinutes": err = unpopulate(val, &s.ExpiryTimeOffsetMinutes) @@ -5005,22 +4890,16 @@ func (s *ScheduleProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.IsEnabled) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedTime) delete(rawMsg, key) case "nextRun": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.NextRun = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.NextRun) delete(rawMsg, key) case "nextRunOffsetMinutes": err = unpopulate(val, &s.NextRunOffsetMinutes) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.StartTime) delete(rawMsg, key) case "startTimeOffsetMinutes": err = unpopulate(val, &s.StartTimeOffsetMinutes) @@ -5124,12 +5003,12 @@ type SoftwareUpdateConfigurationCollectionItemProperties struct { // MarshalJSON implements the json.Marshaller interface for type SoftwareUpdateConfigurationCollectionItemProperties. func (s SoftwareUpdateConfigurationCollectionItemProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(s.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", s.CreationTime) populate(objectMap, "frequency", s.Frequency) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(s.LastModifiedTime)) - populate(objectMap, "nextRun", (*timeRFC3339)(s.NextRun)) + populateTimeRFC3339(objectMap, "lastModifiedTime", s.LastModifiedTime) + populateTimeRFC3339(objectMap, "nextRun", s.NextRun) populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "startTime", (*timeRFC3339)(s.StartTime)) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) populate(objectMap, "tasks", s.Tasks) populate(objectMap, "updateConfiguration", s.UpdateConfiguration) return json.Marshal(objectMap) @@ -5145,30 +5024,22 @@ func (s *SoftwareUpdateConfigurationCollectionItemProperties) UnmarshalJSON(data var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreationTime) delete(rawMsg, key) case "frequency": err = unpopulate(val, &s.Frequency) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedTime) delete(rawMsg, key) case "nextRun": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.NextRun = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.NextRun) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, &s.ProvisioningState) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.StartTime) delete(rawMsg, key) case "tasks": err = unpopulate(val, &s.Tasks) @@ -5278,10 +5149,10 @@ type SoftwareUpdateConfigurationProperties struct { func (s SoftwareUpdateConfigurationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "creationTime", (*timeRFC3339)(s.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", s.CreationTime) populate(objectMap, "error", s.Error) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(s.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", s.LastModifiedTime) populate(objectMap, "provisioningState", s.ProvisioningState) populate(objectMap, "scheduleInfo", s.ScheduleInfo) populate(objectMap, "tasks", s.Tasks) @@ -5302,9 +5173,7 @@ func (s *SoftwareUpdateConfigurationProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, &s.CreatedBy) delete(rawMsg, key) case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreationTime) delete(rawMsg, key) case "error": err = unpopulate(val, &s.Error) @@ -5313,9 +5182,7 @@ func (s *SoftwareUpdateConfigurationProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, &s.LastModifiedBy) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedTime) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, &s.ProvisioningState) @@ -5414,14 +5281,14 @@ func (s SoftwareUpdateConfigurationRunProperties) MarshalJSON() ([]byte, error) populate(objectMap, "computerCount", s.ComputerCount) populate(objectMap, "configuredDuration", s.ConfiguredDuration) populate(objectMap, "createdBy", s.CreatedBy) - populate(objectMap, "creationTime", (*timeRFC3339)(s.CreationTime)) - populate(objectMap, "endTime", (*timeRFC3339)(s.EndTime)) + populateTimeRFC3339(objectMap, "creationTime", s.CreationTime) + populateTimeRFC3339(objectMap, "endTime", s.EndTime) populate(objectMap, "failedCount", s.FailedCount) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(s.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", s.LastModifiedTime) populate(objectMap, "osType", s.OSType) populate(objectMap, "softwareUpdateConfiguration", s.SoftwareUpdateConfiguration) - populate(objectMap, "startTime", (*timeRFC3339)(s.StartTime)) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) populate(objectMap, "status", s.Status) populate(objectMap, "tasks", s.Tasks) return json.Marshal(objectMap) @@ -5446,14 +5313,10 @@ func (s *SoftwareUpdateConfigurationRunProperties) UnmarshalJSON(data []byte) er err = unpopulate(val, &s.CreatedBy) delete(rawMsg, key) case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreationTime) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.EndTime) delete(rawMsg, key) case "failedCount": err = unpopulate(val, &s.FailedCount) @@ -5462,9 +5325,7 @@ func (s *SoftwareUpdateConfigurationRunProperties) UnmarshalJSON(data []byte) er err = unpopulate(val, &s.LastModifiedBy) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedTime) delete(rawMsg, key) case "osType": err = unpopulate(val, &s.OSType) @@ -5473,9 +5334,7 @@ func (s *SoftwareUpdateConfigurationRunProperties) UnmarshalJSON(data []byte) er err = unpopulate(val, &s.SoftwareUpdateConfiguration) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &s.Status) @@ -5686,10 +5545,10 @@ func (s SourceControlProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "autoSync", s.AutoSync) populate(objectMap, "branch", s.Branch) - populate(objectMap, "creationTime", (*timeRFC3339)(s.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", s.CreationTime) populate(objectMap, "description", s.Description) populate(objectMap, "folderPath", s.FolderPath) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(s.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", s.LastModifiedTime) populate(objectMap, "publishRunbook", s.PublishRunbook) populate(objectMap, "repoUrl", s.RepoURL) populate(objectMap, "sourceType", s.SourceType) @@ -5712,9 +5571,7 @@ func (s *SourceControlProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Branch) delete(rawMsg, key) case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreationTime) delete(rawMsg, key) case "description": err = unpopulate(val, &s.Description) @@ -5723,9 +5580,7 @@ func (s *SourceControlProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.FolderPath) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedTime) delete(rawMsg, key) case "publishRunbook": err = unpopulate(val, &s.PublishRunbook) @@ -5806,12 +5661,12 @@ type SourceControlSyncJobByIDProperties struct { // MarshalJSON implements the json.Marshaller interface for type SourceControlSyncJobByIDProperties. func (s SourceControlSyncJobByIDProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(s.CreationTime)) - populate(objectMap, "endTime", (*timeRFC3339)(s.EndTime)) + populateTimeRFC3339(objectMap, "creationTime", s.CreationTime) + populateTimeRFC3339(objectMap, "endTime", s.EndTime) populate(objectMap, "exception", s.Exception) populate(objectMap, "provisioningState", s.ProvisioningState) populate(objectMap, "sourceControlSyncJobId", s.SourceControlSyncJobID) - populate(objectMap, "startTime", (*timeRFC3339)(s.StartTime)) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) populate(objectMap, "syncType", s.SyncType) return json.Marshal(objectMap) } @@ -5826,14 +5681,10 @@ func (s *SourceControlSyncJobByIDProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreationTime) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.EndTime) delete(rawMsg, key) case "exception": err = unpopulate(val, &s.Exception) @@ -5845,9 +5696,7 @@ func (s *SourceControlSyncJobByIDProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.SourceControlSyncJobID) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.StartTime) delete(rawMsg, key) case "syncType": err = unpopulate(val, &s.SyncType) @@ -5929,11 +5778,11 @@ type SourceControlSyncJobProperties struct { // MarshalJSON implements the json.Marshaller interface for type SourceControlSyncJobProperties. func (s SourceControlSyncJobProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(s.CreationTime)) - populate(objectMap, "endTime", (*timeRFC3339)(s.EndTime)) + populateTimeRFC3339(objectMap, "creationTime", s.CreationTime) + populateTimeRFC3339(objectMap, "endTime", s.EndTime) populate(objectMap, "provisioningState", s.ProvisioningState) populate(objectMap, "sourceControlSyncJobId", s.SourceControlSyncJobID) - populate(objectMap, "startTime", (*timeRFC3339)(s.StartTime)) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) populate(objectMap, "syncType", s.SyncType) return json.Marshal(objectMap) } @@ -5948,14 +5797,10 @@ func (s *SourceControlSyncJobProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreationTime) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.EndTime) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, &s.ProvisioningState) @@ -5964,9 +5809,7 @@ func (s *SourceControlSyncJobProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.SourceControlSyncJobID) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.StartTime) delete(rawMsg, key) case "syncType": err = unpopulate(val, &s.SyncType) @@ -6025,7 +5868,7 @@ func (s SourceControlSyncJobStreamByIDProperties) MarshalJSON() ([]byte, error) populate(objectMap, "streamText", s.StreamText) populate(objectMap, "streamType", s.StreamType) populate(objectMap, "summary", s.Summary) - populate(objectMap, "time", (*timeRFC3339)(s.Time)) + populateTimeRFC3339(objectMap, "time", s.Time) populate(objectMap, "value", s.Value) return json.Marshal(objectMap) } @@ -6052,9 +5895,7 @@ func (s *SourceControlSyncJobStreamByIDProperties) UnmarshalJSON(data []byte) er err = unpopulate(val, &s.Summary) delete(rawMsg, key) case "time": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.Time = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.Time) delete(rawMsg, key) case "value": err = unpopulate(val, &s.Value) @@ -6088,7 +5929,7 @@ func (s SourceControlSyncJobStreamProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "sourceControlSyncJobStreamId", s.SourceControlSyncJobStreamID) populate(objectMap, "streamType", s.StreamType) populate(objectMap, "summary", s.Summary) - populate(objectMap, "time", (*timeRFC3339)(s.Time)) + populateTimeRFC3339(objectMap, "time", s.Time) return json.Marshal(objectMap) } @@ -6111,9 +5952,7 @@ func (s *SourceControlSyncJobStreamProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, &s.Summary) delete(rawMsg, key) case "time": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.Time = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.Time) delete(rawMsg, key) } if err != nil { @@ -6213,9 +6052,9 @@ func (s Statistics) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "counterProperty", s.CounterProperty) populate(objectMap, "counterValue", s.CounterValue) - populate(objectMap, "endTime", (*timeRFC3339)(s.EndTime)) + populateTimeRFC3339(objectMap, "endTime", s.EndTime) populate(objectMap, "id", s.ID) - populate(objectMap, "startTime", (*timeRFC3339)(s.StartTime)) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) return json.Marshal(objectMap) } @@ -6235,17 +6074,13 @@ func (s *Statistics) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CounterValue) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.EndTime) delete(rawMsg, key) case "id": err = unpopulate(val, &s.ID) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.StartTime) delete(rawMsg, key) } if err != nil { @@ -6298,10 +6133,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -6317,9 +6152,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -6328,9 +6161,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) @@ -6436,15 +6267,15 @@ type TestJob struct { // MarshalJSON implements the json.Marshaller interface for type TestJob. func (t TestJob) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(t.CreationTime)) - populate(objectMap, "endTime", (*timeRFC3339)(t.EndTime)) + populateTimeRFC3339(objectMap, "creationTime", t.CreationTime) + populateTimeRFC3339(objectMap, "endTime", t.EndTime) populate(objectMap, "exception", t.Exception) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(t.LastModifiedTime)) - populate(objectMap, "lastStatusModifiedTime", (*timeRFC3339)(t.LastStatusModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", t.LastModifiedTime) + populateTimeRFC3339(objectMap, "lastStatusModifiedTime", t.LastStatusModifiedTime) populate(objectMap, "logActivityTrace", t.LogActivityTrace) populate(objectMap, "parameters", t.Parameters) populate(objectMap, "runOn", t.RunOn) - populate(objectMap, "startTime", (*timeRFC3339)(t.StartTime)) + populateTimeRFC3339(objectMap, "startTime", t.StartTime) populate(objectMap, "status", t.Status) populate(objectMap, "statusDetails", t.StatusDetails) return json.Marshal(objectMap) @@ -6460,27 +6291,19 @@ func (t *TestJob) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.CreationTime) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.EndTime) delete(rawMsg, key) case "exception": err = unpopulate(val, &t.Exception) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.LastModifiedTime) delete(rawMsg, key) case "lastStatusModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.LastStatusModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.LastStatusModifiedTime) delete(rawMsg, key) case "logActivityTrace": err = unpopulate(val, &t.LogActivityTrace) @@ -6492,9 +6315,7 @@ func (t *TestJob) UnmarshalJSON(data []byte) error { err = unpopulate(val, &t.RunOn) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &t.Status) @@ -6702,16 +6523,16 @@ func (u UpdateConfigurationMachineRunProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "configuredDuration", u.ConfiguredDuration) populate(objectMap, "correlationId", u.CorrelationID) populate(objectMap, "createdBy", u.CreatedBy) - populate(objectMap, "creationTime", (*timeRFC3339)(u.CreationTime)) - populate(objectMap, "endTime", (*timeRFC3339)(u.EndTime)) + populateTimeRFC3339(objectMap, "creationTime", u.CreationTime) + populateTimeRFC3339(objectMap, "endTime", u.EndTime) populate(objectMap, "error", u.Error) populate(objectMap, "job", u.Job) populate(objectMap, "lastModifiedBy", u.LastModifiedBy) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(u.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", u.LastModifiedTime) populate(objectMap, "osType", u.OSType) populate(objectMap, "softwareUpdateConfiguration", u.SoftwareUpdateConfiguration) populate(objectMap, "sourceComputerId", u.SourceComputerID) - populate(objectMap, "startTime", (*timeRFC3339)(u.StartTime)) + populateTimeRFC3339(objectMap, "startTime", u.StartTime) populate(objectMap, "status", u.Status) populate(objectMap, "targetComputer", u.TargetComputer) populate(objectMap, "targetComputerType", u.TargetComputerType) @@ -6737,14 +6558,10 @@ func (u *UpdateConfigurationMachineRunProperties) UnmarshalJSON(data []byte) err err = unpopulate(val, &u.CreatedBy) delete(rawMsg, key) case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - u.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &u.CreationTime) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - u.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &u.EndTime) delete(rawMsg, key) case "error": err = unpopulate(val, &u.Error) @@ -6756,9 +6573,7 @@ func (u *UpdateConfigurationMachineRunProperties) UnmarshalJSON(data []byte) err err = unpopulate(val, &u.LastModifiedBy) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - u.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &u.LastModifiedTime) delete(rawMsg, key) case "osType": err = unpopulate(val, &u.OSType) @@ -6770,9 +6585,7 @@ func (u *UpdateConfigurationMachineRunProperties) UnmarshalJSON(data []byte) err err = unpopulate(val, &u.SourceComputerID) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - u.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &u.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &u.Status) @@ -6939,10 +6752,10 @@ type VariableProperties struct { // MarshalJSON implements the json.Marshaller interface for type VariableProperties. func (v VariableProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(v.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", v.CreationTime) populate(objectMap, "description", v.Description) populate(objectMap, "isEncrypted", v.IsEncrypted) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(v.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", v.LastModifiedTime) populate(objectMap, "value", v.Value) return json.Marshal(objectMap) } @@ -6957,9 +6770,7 @@ func (v *VariableProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - v.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &v.CreationTime) delete(rawMsg, key) case "description": err = unpopulate(val, &v.Description) @@ -6968,9 +6779,7 @@ func (v *VariableProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &v.IsEncrypted) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - v.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &v.LastModifiedTime) delete(rawMsg, key) case "value": err = unpopulate(val, &v.Value) @@ -7112,11 +6921,11 @@ type WatcherProperties struct { // MarshalJSON implements the json.Marshaller interface for type WatcherProperties. func (w WatcherProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(w.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", w.CreationTime) populate(objectMap, "description", w.Description) populate(objectMap, "executionFrequencyInSeconds", w.ExecutionFrequencyInSeconds) populate(objectMap, "lastModifiedBy", w.LastModifiedBy) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(w.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", w.LastModifiedTime) populate(objectMap, "scriptName", w.ScriptName) populate(objectMap, "scriptParameters", w.ScriptParameters) populate(objectMap, "scriptRunOn", w.ScriptRunOn) @@ -7134,9 +6943,7 @@ func (w *WatcherProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.CreationTime) delete(rawMsg, key) case "description": err = unpopulate(val, &w.Description) @@ -7148,9 +6955,7 @@ func (w *WatcherProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.LastModifiedBy) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.LastModifiedTime) delete(rawMsg, key) case "scriptName": err = unpopulate(val, &w.ScriptName) @@ -7262,7 +7067,7 @@ type WebhookCreateOrUpdateProperties struct { // MarshalJSON implements the json.Marshaller interface for type WebhookCreateOrUpdateProperties. func (w WebhookCreateOrUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "expiryTime", (*timeRFC3339)(w.ExpiryTime)) + populateTimeRFC3339(objectMap, "expiryTime", w.ExpiryTime) populate(objectMap, "isEnabled", w.IsEnabled) populate(objectMap, "parameters", w.Parameters) populate(objectMap, "runOn", w.RunOn) @@ -7281,9 +7086,7 @@ func (w *WebhookCreateOrUpdateProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "expiryTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.ExpiryTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.ExpiryTime) delete(rawMsg, key) case "isEnabled": err = unpopulate(val, &w.IsEnabled) @@ -7385,13 +7188,13 @@ type WebhookProperties struct { // MarshalJSON implements the json.Marshaller interface for type WebhookProperties. func (w WebhookProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(w.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", w.CreationTime) populate(objectMap, "description", w.Description) - populate(objectMap, "expiryTime", (*timeRFC3339)(w.ExpiryTime)) + populateTimeRFC3339(objectMap, "expiryTime", w.ExpiryTime) populate(objectMap, "isEnabled", w.IsEnabled) - populate(objectMap, "lastInvokedTime", (*timeRFC3339)(w.LastInvokedTime)) + populateTimeRFC3339(objectMap, "lastInvokedTime", w.LastInvokedTime) populate(objectMap, "lastModifiedBy", w.LastModifiedBy) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(w.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", w.LastModifiedTime) populate(objectMap, "parameters", w.Parameters) populate(objectMap, "runOn", w.RunOn) populate(objectMap, "runbook", w.Runbook) @@ -7409,33 +7212,25 @@ func (w *WebhookProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.CreationTime) delete(rawMsg, key) case "description": err = unpopulate(val, &w.Description) delete(rawMsg, key) case "expiryTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.ExpiryTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.ExpiryTime) delete(rawMsg, key) case "isEnabled": err = unpopulate(val, &w.IsEnabled) delete(rawMsg, key) case "lastInvokedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.LastInvokedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.LastInvokedTime) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &w.LastModifiedBy) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.LastModifiedTime) delete(rawMsg, key) case "parameters": err = unpopulate(val, &w.Parameters) diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_module_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_module_client.go index be689d8cdd5b..e724d6ebbc38 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_module_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_module_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ModuleClient contains the methods for the Module group. @@ -30,8 +31,15 @@ type ModuleClient struct { } // NewModuleClient creates a new instance of ModuleClient with the specified values. -func NewModuleClient(con *arm.Connection, subscriptionID string) *ModuleClient { - return &ModuleClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewModuleClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ModuleClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ModuleClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or Update the module identified by module name. @@ -85,7 +93,7 @@ func (client *ModuleClient) createOrUpdateCreateRequest(ctx context.Context, res func (client *ModuleClient) createOrUpdateHandleResponse(resp *http.Response) (ModuleCreateOrUpdateResponse, error) { result := ModuleCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Module); err != nil { - return ModuleCreateOrUpdateResponse{}, err + return ModuleCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *ModuleClient) getCreateRequest(ctx context.Context, resourceGroupN func (client *ModuleClient) getHandleResponse(resp *http.Response) (ModuleGetResponse, error) { result := ModuleGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Module); err != nil { - return ModuleGetResponse{}, err + return ModuleGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -276,7 +284,7 @@ func (client *ModuleClient) listByAutomationAccountCreateRequest(ctx context.Con func (client *ModuleClient) listByAutomationAccountHandleResponse(resp *http.Response) (ModuleListByAutomationAccountResponse, error) { result := ModuleListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ModuleListResult); err != nil { - return ModuleListByAutomationAccountResponse{}, err + return ModuleListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -345,7 +353,7 @@ func (client *ModuleClient) updateCreateRequest(ctx context.Context, resourceGro func (client *ModuleClient) updateHandleResponse(resp *http.Response) (ModuleUpdateResponse, error) { result := ModuleUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Module); err != nil { - return ModuleUpdateResponse{}, err + return ModuleUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_nodecountinformation_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_nodecountinformation_client.go index 7b9f317365ae..02b1ffbadeed 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_nodecountinformation_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_nodecountinformation_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NodeCountInformationClient contains the methods for the NodeCountInformation group. @@ -30,8 +31,15 @@ type NodeCountInformationClient struct { } // NewNodeCountInformationClient creates a new instance of NodeCountInformationClient with the specified values. -func NewNodeCountInformationClient(con *arm.Connection, subscriptionID string) *NodeCountInformationClient { - return &NodeCountInformationClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNodeCountInformationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NodeCountInformationClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NodeCountInformationClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Retrieve counts for Dsc Nodes. @@ -85,7 +93,7 @@ func (client *NodeCountInformationClient) getCreateRequest(ctx context.Context, func (client *NodeCountInformationClient) getHandleResponse(resp *http.Response) (NodeCountInformationGetResponse, error) { result := NodeCountInformationGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NodeCounts); err != nil { - return NodeCountInformationGetResponse{}, err + return NodeCountInformationGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_nodereports_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_nodereports_client.go index 8ff7e7dafda2..e57efc592fda 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_nodereports_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_nodereports_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NodeReportsClient contains the methods for the NodeReports group. @@ -30,8 +31,15 @@ type NodeReportsClient struct { } // NewNodeReportsClient creates a new instance of NodeReportsClient with the specified values. -func NewNodeReportsClient(con *arm.Connection, subscriptionID string) *NodeReportsClient { - return &NodeReportsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNodeReportsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NodeReportsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NodeReportsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Retrieve the Dsc node report data by node id and report id. @@ -89,7 +97,7 @@ func (client *NodeReportsClient) getCreateRequest(ctx context.Context, resourceG func (client *NodeReportsClient) getHandleResponse(resp *http.Response) (NodeReportsGetResponse, error) { result := NodeReportsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DscNodeReport); err != nil { - return NodeReportsGetResponse{}, err + return NodeReportsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -162,7 +170,7 @@ func (client *NodeReportsClient) getContentCreateRequest(ctx context.Context, re func (client *NodeReportsClient) getContentHandleResponse(resp *http.Response) (NodeReportsGetContentResponse, error) { result := NodeReportsGetContentResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Object); err != nil { - return NodeReportsGetContentResponse{}, err + return NodeReportsGetContentResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -231,7 +239,7 @@ func (client *NodeReportsClient) listByNodeCreateRequest(ctx context.Context, re func (client *NodeReportsClient) listByNodeHandleResponse(resp *http.Response) (NodeReportsListByNodeResponse, error) { result := NodeReportsListByNodeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DscNodeReportListResult); err != nil { - return NodeReportsListByNodeResponse{}, err + return NodeReportsListByNodeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_objectdatatypes_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_objectdatatypes_client.go index b2a7b81994a0..c731f6b3ee04 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_objectdatatypes_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_objectdatatypes_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ObjectDataTypesClient contains the methods for the ObjectDataTypes group. @@ -30,8 +31,15 @@ type ObjectDataTypesClient struct { } // NewObjectDataTypesClient creates a new instance of ObjectDataTypesClient with the specified values. -func NewObjectDataTypesClient(con *arm.Connection, subscriptionID string) *ObjectDataTypesClient { - return &ObjectDataTypesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewObjectDataTypesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ObjectDataTypesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ObjectDataTypesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListFieldsByModuleAndType - Retrieve a list of fields of a given type identified by module name. @@ -89,7 +97,7 @@ func (client *ObjectDataTypesClient) listFieldsByModuleAndTypeCreateRequest(ctx func (client *ObjectDataTypesClient) listFieldsByModuleAndTypeHandleResponse(resp *http.Response) (ObjectDataTypesListFieldsByModuleAndTypeResponse, error) { result := ObjectDataTypesListFieldsByModuleAndTypeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TypeFieldListResult); err != nil { - return ObjectDataTypesListFieldsByModuleAndTypeResponse{}, err + return ObjectDataTypesListFieldsByModuleAndTypeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -158,7 +166,7 @@ func (client *ObjectDataTypesClient) listFieldsByTypeCreateRequest(ctx context.C func (client *ObjectDataTypesClient) listFieldsByTypeHandleResponse(resp *http.Response) (ObjectDataTypesListFieldsByTypeResponse, error) { result := ObjectDataTypesListFieldsByTypeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TypeFieldListResult); err != nil { - return ObjectDataTypesListFieldsByTypeResponse{}, err + return ObjectDataTypesListFieldsByTypeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_operations_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_operations_client.go index f4fc60c56bff..285d37664113 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_operations_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armautomation import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available Automation REST API operations. @@ -65,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_pagers.go b/sdk/resourcemanager/automation/armautomation/zz_generated_pagers.go index cd250b3c41ef..fa5d783c0225 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_pagers.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armautomation import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // ActivityListByModulePager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_pollers.go b/sdk/resourcemanager/automation/armautomation/zz_generated_pollers.go index 9c6e3e2e195b..b27882813024 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_pollers.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armautomation import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // DscCompilationJobCreatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_privateendpointconnections_client.go index 7834b1e74666..a163c3d95d88 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_privateendpointconnections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. @@ -31,8 +31,15 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { - return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. @@ -246,7 +253,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsGetResponse{}, err + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -310,7 +317,7 @@ func (client *PrivateEndpointConnectionsClient) listByAutomationAccountCreateReq func (client *PrivateEndpointConnectionsClient) listByAutomationAccountHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListByAutomationAccountResponse, error) { result := PrivateEndpointConnectionsListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionsListByAutomationAccountResponse{}, err + return PrivateEndpointConnectionsListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_privatelinkresources_client.go index 124687a22fcd..57f42029d83f 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_privatelinkresources_client.go @@ -11,13 +11,14 @@ package armautomation import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. @@ -29,8 +30,15 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { - return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Automation - Gets the private link resources that need to be created for Automation account. @@ -80,7 +88,7 @@ func (client *PrivateLinkResourcesClient) automationCreateRequest(ctx context.Co func (client *PrivateLinkResourcesClient) automationHandleResponse(resp *http.Response) (PrivateLinkResourcesAutomationResponse, error) { result := PrivateLinkResourcesAutomationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { - return PrivateLinkResourcesAutomationResponse{}, err + return PrivateLinkResourcesAutomationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_python2package_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_python2package_client.go index 50586bd09f80..1ebab73c5291 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_python2package_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_python2package_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // Python2PackageClient contains the methods for the Python2Package group. @@ -30,8 +31,15 @@ type Python2PackageClient struct { } // NewPython2PackageClient creates a new instance of Python2PackageClient with the specified values. -func NewPython2PackageClient(con *arm.Connection, subscriptionID string) *Python2PackageClient { - return &Python2PackageClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPython2PackageClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *Python2PackageClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &Python2PackageClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or Update the python 2 package identified by package name. @@ -85,7 +93,7 @@ func (client *Python2PackageClient) createOrUpdateCreateRequest(ctx context.Cont func (client *Python2PackageClient) createOrUpdateHandleResponse(resp *http.Response) (Python2PackageCreateOrUpdateResponse, error) { result := Python2PackageCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Module); err != nil { - return Python2PackageCreateOrUpdateResponse{}, err + return Python2PackageCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *Python2PackageClient) getCreateRequest(ctx context.Context, resour func (client *Python2PackageClient) getHandleResponse(resp *http.Response) (Python2PackageGetResponse, error) { result := Python2PackageGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Module); err != nil { - return Python2PackageGetResponse{}, err + return Python2PackageGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -276,7 +284,7 @@ func (client *Python2PackageClient) listByAutomationAccountCreateRequest(ctx con func (client *Python2PackageClient) listByAutomationAccountHandleResponse(resp *http.Response) (Python2PackageListByAutomationAccountResponse, error) { result := Python2PackageListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ModuleListResult); err != nil { - return Python2PackageListByAutomationAccountResponse{}, err + return Python2PackageListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -345,7 +353,7 @@ func (client *Python2PackageClient) updateCreateRequest(ctx context.Context, res func (client *Python2PackageClient) updateHandleResponse(resp *http.Response) (Python2PackageUpdateResponse, error) { result := Python2PackageUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Module); err != nil { - return Python2PackageUpdateResponse{}, err + return Python2PackageUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_response_types.go b/sdk/resourcemanager/automation/armautomation/zz_generated_response_types.go index ccf17a27d3d3..c0bb01339524 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_response_types.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armautomation import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // ActivityGetResponse contains the response from method Activity.Get. @@ -356,6 +355,8 @@ type DscCompilationJobCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DscCompilationJobCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DscCompilationJobCreateResponse, error) { respType := DscCompilationJobCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DscCompilationJob) @@ -544,6 +545,8 @@ type DscNodeConfigurationCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DscNodeConfigurationCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DscNodeConfigurationCreateOrUpdateResponse, error) { respType := DscNodeConfigurationCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DscNodeConfiguration) @@ -1087,6 +1090,8 @@ type PrivateEndpointConnectionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsCreateOrUpdateResponse, error) { respType := PrivateEndpointConnectionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) @@ -1137,6 +1142,8 @@ type PrivateEndpointConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsDeleteResponse, error) { respType := PrivateEndpointConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1307,6 +1314,8 @@ type RunbookDraftReplaceContentPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RunbookDraftReplaceContentPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RunbookDraftReplaceContentResponse, error) { respType := RunbookDraftReplaceContentResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1393,6 +1402,8 @@ type RunbookPublishPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RunbookPublishPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RunbookPublishResponse, error) { respType := RunbookPublishResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_runbook_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_runbook_client.go index c5c6d8ebcf56..0a6203e7984f 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_runbook_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_runbook_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RunbookClient contains the methods for the Runbook group. @@ -31,8 +31,15 @@ type RunbookClient struct { } // NewRunbookClient creates a new instance of RunbookClient with the specified values. -func NewRunbookClient(con *arm.Connection, subscriptionID string) *RunbookClient { - return &RunbookClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRunbookClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RunbookClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RunbookClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create the runbook identified by runbook name. @@ -86,7 +93,7 @@ func (client *RunbookClient) createOrUpdateCreateRequest(ctx context.Context, re func (client *RunbookClient) createOrUpdateHandleResponse(resp *http.Response) (RunbookCreateOrUpdateResponse, error) { result := RunbookCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Runbook); err != nil { - return RunbookCreateOrUpdateResponse{}, err + return RunbookCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -215,7 +222,7 @@ func (client *RunbookClient) getCreateRequest(ctx context.Context, resourceGroup func (client *RunbookClient) getHandleResponse(resp *http.Response) (RunbookGetResponse, error) { result := RunbookGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Runbook); err != nil { - return RunbookGetResponse{}, err + return RunbookGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -336,7 +343,7 @@ func (client *RunbookClient) listByAutomationAccountCreateRequest(ctx context.Co func (client *RunbookClient) listByAutomationAccountHandleResponse(resp *http.Response) (RunbookListByAutomationAccountResponse, error) { result := RunbookListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RunbookListResult); err != nil { - return RunbookListByAutomationAccountResponse{}, err + return RunbookListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -485,7 +492,7 @@ func (client *RunbookClient) updateCreateRequest(ctx context.Context, resourceGr func (client *RunbookClient) updateHandleResponse(resp *http.Response) (RunbookUpdateResponse, error) { result := RunbookUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Runbook); err != nil { - return RunbookUpdateResponse{}, err + return RunbookUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_runbookdraft_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_runbookdraft_client.go index b7c271de11f3..bfb5698b190f 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_runbookdraft_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_runbookdraft_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/streaming" + "net/http" + "net/url" + "strings" ) // RunbookDraftClient contains the methods for the RunbookDraft group. @@ -32,8 +32,15 @@ type RunbookDraftClient struct { } // NewRunbookDraftClient creates a new instance of RunbookDraftClient with the specified values. -func NewRunbookDraftClient(con *arm.Connection, subscriptionID string) *RunbookDraftClient { - return &RunbookDraftClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRunbookDraftClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RunbookDraftClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RunbookDraftClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Retrieve the runbook draft identified by runbook name. @@ -87,7 +94,7 @@ func (client *RunbookDraftClient) getCreateRequest(ctx context.Context, resource func (client *RunbookDraftClient) getHandleResponse(resp *http.Response) (RunbookDraftGetResponse, error) { result := RunbookDraftGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RunbookDraft); err != nil { - return RunbookDraftGetResponse{}, err + return RunbookDraftGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -297,7 +304,7 @@ func (client *RunbookDraftClient) undoEditCreateRequest(ctx context.Context, res func (client *RunbookDraftClient) undoEditHandleResponse(resp *http.Response) (RunbookDraftUndoEditResponse, error) { result := RunbookDraftUndoEditResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RunbookDraftUndoEditResult); err != nil { - return RunbookDraftUndoEditResponse{}, err + return RunbookDraftUndoEditResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_schedule_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_schedule_client.go index 0a6379dacdc5..10f649900bd6 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_schedule_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_schedule_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ScheduleClient contains the methods for the Schedule group. @@ -30,8 +31,15 @@ type ScheduleClient struct { } // NewScheduleClient creates a new instance of ScheduleClient with the specified values. -func NewScheduleClient(con *arm.Connection, subscriptionID string) *ScheduleClient { - return &ScheduleClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewScheduleClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ScheduleClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ScheduleClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create a schedule. @@ -85,7 +93,7 @@ func (client *ScheduleClient) createOrUpdateCreateRequest(ctx context.Context, r func (client *ScheduleClient) createOrUpdateHandleResponse(resp *http.Response) (ScheduleCreateOrUpdateResponse, error) { result := ScheduleCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Schedule); err != nil { - return ScheduleCreateOrUpdateResponse{}, err + return ScheduleCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *ScheduleClient) getCreateRequest(ctx context.Context, resourceGrou func (client *ScheduleClient) getHandleResponse(resp *http.Response) (ScheduleGetResponse, error) { result := ScheduleGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Schedule); err != nil { - return ScheduleGetResponse{}, err + return ScheduleGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -276,7 +284,7 @@ func (client *ScheduleClient) listByAutomationAccountCreateRequest(ctx context.C func (client *ScheduleClient) listByAutomationAccountHandleResponse(resp *http.Response) (ScheduleListByAutomationAccountResponse, error) { result := ScheduleListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ScheduleListResult); err != nil { - return ScheduleListByAutomationAccountResponse{}, err + return ScheduleListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -345,7 +353,7 @@ func (client *ScheduleClient) updateCreateRequest(ctx context.Context, resourceG func (client *ScheduleClient) updateHandleResponse(resp *http.Response) (ScheduleUpdateResponse, error) { result := ScheduleUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Schedule); err != nil { - return ScheduleUpdateResponse{}, err + return ScheduleUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_softwareupdateconfigurationmachineruns_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_softwareupdateconfigurationmachineruns_client.go index 593155d707a4..43c766aa017c 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_softwareupdateconfigurationmachineruns_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_softwareupdateconfigurationmachineruns_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SoftwareUpdateConfigurationMachineRunsClient contains the methods for the SoftwareUpdateConfigurationMachineRuns group. @@ -30,8 +31,15 @@ type SoftwareUpdateConfigurationMachineRunsClient struct { } // NewSoftwareUpdateConfigurationMachineRunsClient creates a new instance of SoftwareUpdateConfigurationMachineRunsClient with the specified values. -func NewSoftwareUpdateConfigurationMachineRunsClient(con *arm.Connection, subscriptionID string) *SoftwareUpdateConfigurationMachineRunsClient { - return &SoftwareUpdateConfigurationMachineRunsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSoftwareUpdateConfigurationMachineRunsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SoftwareUpdateConfigurationMachineRunsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SoftwareUpdateConfigurationMachineRunsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetByID - Get a single software update configuration machine run by Id. @@ -85,7 +93,7 @@ func (client *SoftwareUpdateConfigurationMachineRunsClient) getByIDCreateRequest func (client *SoftwareUpdateConfigurationMachineRunsClient) getByIDHandleResponse(resp *http.Response) (SoftwareUpdateConfigurationMachineRunsGetByIDResponse, error) { result := SoftwareUpdateConfigurationMachineRunsGetByIDResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SoftwareUpdateConfigurationMachineRun); err != nil { - return SoftwareUpdateConfigurationMachineRunsGetByIDResponse{}, err + return SoftwareUpdateConfigurationMachineRunsGetByIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -162,7 +170,7 @@ func (client *SoftwareUpdateConfigurationMachineRunsClient) listCreateRequest(ct func (client *SoftwareUpdateConfigurationMachineRunsClient) listHandleResponse(resp *http.Response) (SoftwareUpdateConfigurationMachineRunsListResponse, error) { result := SoftwareUpdateConfigurationMachineRunsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SoftwareUpdateConfigurationMachineRunListResult); err != nil { - return SoftwareUpdateConfigurationMachineRunsListResponse{}, err + return SoftwareUpdateConfigurationMachineRunsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_softwareupdateconfigurationruns_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_softwareupdateconfigurationruns_client.go index cf9c347e3d3d..7fb9a1577808 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_softwareupdateconfigurationruns_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_softwareupdateconfigurationruns_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SoftwareUpdateConfigurationRunsClient contains the methods for the SoftwareUpdateConfigurationRuns group. @@ -30,8 +31,15 @@ type SoftwareUpdateConfigurationRunsClient struct { } // NewSoftwareUpdateConfigurationRunsClient creates a new instance of SoftwareUpdateConfigurationRunsClient with the specified values. -func NewSoftwareUpdateConfigurationRunsClient(con *arm.Connection, subscriptionID string) *SoftwareUpdateConfigurationRunsClient { - return &SoftwareUpdateConfigurationRunsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSoftwareUpdateConfigurationRunsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SoftwareUpdateConfigurationRunsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SoftwareUpdateConfigurationRunsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetByID - Get a single software update configuration Run by Id. @@ -85,7 +93,7 @@ func (client *SoftwareUpdateConfigurationRunsClient) getByIDCreateRequest(ctx co func (client *SoftwareUpdateConfigurationRunsClient) getByIDHandleResponse(resp *http.Response) (SoftwareUpdateConfigurationRunsGetByIDResponse, error) { result := SoftwareUpdateConfigurationRunsGetByIDResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SoftwareUpdateConfigurationRun); err != nil { - return SoftwareUpdateConfigurationRunsGetByIDResponse{}, err + return SoftwareUpdateConfigurationRunsGetByIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -162,7 +170,7 @@ func (client *SoftwareUpdateConfigurationRunsClient) listCreateRequest(ctx conte func (client *SoftwareUpdateConfigurationRunsClient) listHandleResponse(resp *http.Response) (SoftwareUpdateConfigurationRunsListResponse, error) { result := SoftwareUpdateConfigurationRunsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SoftwareUpdateConfigurationRunListResult); err != nil { - return SoftwareUpdateConfigurationRunsListResponse{}, err + return SoftwareUpdateConfigurationRunsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_softwareupdateconfigurations_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_softwareupdateconfigurations_client.go index 1ba2a5e7af4d..b28a4fc26966 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_softwareupdateconfigurations_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_softwareupdateconfigurations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SoftwareUpdateConfigurationsClient contains the methods for the SoftwareUpdateConfigurations group. @@ -30,8 +31,15 @@ type SoftwareUpdateConfigurationsClient struct { } // NewSoftwareUpdateConfigurationsClient creates a new instance of SoftwareUpdateConfigurationsClient with the specified values. -func NewSoftwareUpdateConfigurationsClient(con *arm.Connection, subscriptionID string) *SoftwareUpdateConfigurationsClient { - return &SoftwareUpdateConfigurationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSoftwareUpdateConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SoftwareUpdateConfigurationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SoftwareUpdateConfigurationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Create a new software update configuration with the name given in the URI. @@ -88,7 +96,7 @@ func (client *SoftwareUpdateConfigurationsClient) createCreateRequest(ctx contex func (client *SoftwareUpdateConfigurationsClient) createHandleResponse(resp *http.Response) (SoftwareUpdateConfigurationsCreateResponse, error) { result := SoftwareUpdateConfigurationsCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SoftwareUpdateConfiguration); err != nil { - return SoftwareUpdateConfigurationsCreateResponse{}, err + return SoftwareUpdateConfigurationsCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -223,7 +231,7 @@ func (client *SoftwareUpdateConfigurationsClient) getByNameCreateRequest(ctx con func (client *SoftwareUpdateConfigurationsClient) getByNameHandleResponse(resp *http.Response) (SoftwareUpdateConfigurationsGetByNameResponse, error) { result := SoftwareUpdateConfigurationsGetByNameResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SoftwareUpdateConfiguration); err != nil { - return SoftwareUpdateConfigurationsGetByNameResponse{}, err + return SoftwareUpdateConfigurationsGetByNameResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -294,7 +302,7 @@ func (client *SoftwareUpdateConfigurationsClient) listCreateRequest(ctx context. func (client *SoftwareUpdateConfigurationsClient) listHandleResponse(resp *http.Response) (SoftwareUpdateConfigurationsListResponse, error) { result := SoftwareUpdateConfigurationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SoftwareUpdateConfigurationListResult); err != nil { - return SoftwareUpdateConfigurationsListResponse{}, err + return SoftwareUpdateConfigurationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_sourcecontrol_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_sourcecontrol_client.go index 257ff93fce4d..657564775ade 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_sourcecontrol_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_sourcecontrol_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SourceControlClient contains the methods for the SourceControl group. @@ -30,8 +31,15 @@ type SourceControlClient struct { } // NewSourceControlClient creates a new instance of SourceControlClient with the specified values. -func NewSourceControlClient(con *arm.Connection, subscriptionID string) *SourceControlClient { - return &SourceControlClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSourceControlClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SourceControlClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SourceControlClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create a source control. @@ -85,7 +93,7 @@ func (client *SourceControlClient) createOrUpdateCreateRequest(ctx context.Conte func (client *SourceControlClient) createOrUpdateHandleResponse(resp *http.Response) (SourceControlCreateOrUpdateResponse, error) { result := SourceControlCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SourceControl); err != nil { - return SourceControlCreateOrUpdateResponse{}, err + return SourceControlCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *SourceControlClient) getCreateRequest(ctx context.Context, resourc func (client *SourceControlClient) getHandleResponse(resp *http.Response) (SourceControlGetResponse, error) { result := SourceControlGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SourceControl); err != nil { - return SourceControlGetResponse{}, err + return SourceControlGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -279,7 +287,7 @@ func (client *SourceControlClient) listByAutomationAccountCreateRequest(ctx cont func (client *SourceControlClient) listByAutomationAccountHandleResponse(resp *http.Response) (SourceControlListByAutomationAccountResponse, error) { result := SourceControlListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SourceControlListResult); err != nil { - return SourceControlListByAutomationAccountResponse{}, err + return SourceControlListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -348,7 +356,7 @@ func (client *SourceControlClient) updateCreateRequest(ctx context.Context, reso func (client *SourceControlClient) updateHandleResponse(resp *http.Response) (SourceControlUpdateResponse, error) { result := SourceControlUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SourceControl); err != nil { - return SourceControlUpdateResponse{}, err + return SourceControlUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_sourcecontrolsyncjob_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_sourcecontrolsyncjob_client.go index f1b0905588fe..8ec62ed77508 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_sourcecontrolsyncjob_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_sourcecontrolsyncjob_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SourceControlSyncJobClient contains the methods for the SourceControlSyncJob group. @@ -30,8 +31,15 @@ type SourceControlSyncJobClient struct { } // NewSourceControlSyncJobClient creates a new instance of SourceControlSyncJobClient with the specified values. -func NewSourceControlSyncJobClient(con *arm.Connection, subscriptionID string) *SourceControlSyncJobClient { - return &SourceControlSyncJobClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSourceControlSyncJobClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SourceControlSyncJobClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SourceControlSyncJobClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Creates the sync job for a source control. @@ -86,7 +94,7 @@ func (client *SourceControlSyncJobClient) createCreateRequest(ctx context.Contex func (client *SourceControlSyncJobClient) createHandleResponse(resp *http.Response) (SourceControlSyncJobCreateResponse, error) { result := SourceControlSyncJobCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SourceControlSyncJob); err != nil { - return SourceControlSyncJobCreateResponse{}, err + return SourceControlSyncJobCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -156,7 +164,7 @@ func (client *SourceControlSyncJobClient) getCreateRequest(ctx context.Context, func (client *SourceControlSyncJobClient) getHandleResponse(resp *http.Response) (SourceControlSyncJobGetResponse, error) { result := SourceControlSyncJobGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SourceControlSyncJobByID); err != nil { - return SourceControlSyncJobGetResponse{}, err + return SourceControlSyncJobGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -225,7 +233,7 @@ func (client *SourceControlSyncJobClient) listByAutomationAccountCreateRequest(c func (client *SourceControlSyncJobClient) listByAutomationAccountHandleResponse(resp *http.Response) (SourceControlSyncJobListByAutomationAccountResponse, error) { result := SourceControlSyncJobListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SourceControlSyncJobListResult); err != nil { - return SourceControlSyncJobListByAutomationAccountResponse{}, err + return SourceControlSyncJobListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_sourcecontrolsyncjobstreams_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_sourcecontrolsyncjobstreams_client.go index 8dec9529f39b..31f3e0eb4760 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_sourcecontrolsyncjobstreams_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_sourcecontrolsyncjobstreams_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SourceControlSyncJobStreamsClient contains the methods for the SourceControlSyncJobStreams group. @@ -30,8 +31,15 @@ type SourceControlSyncJobStreamsClient struct { } // NewSourceControlSyncJobStreamsClient creates a new instance of SourceControlSyncJobStreamsClient with the specified values. -func NewSourceControlSyncJobStreamsClient(con *arm.Connection, subscriptionID string) *SourceControlSyncJobStreamsClient { - return &SourceControlSyncJobStreamsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSourceControlSyncJobStreamsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SourceControlSyncJobStreamsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SourceControlSyncJobStreamsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Retrieve a sync job stream identified by stream id. @@ -90,7 +98,7 @@ func (client *SourceControlSyncJobStreamsClient) getCreateRequest(ctx context.Co func (client *SourceControlSyncJobStreamsClient) getHandleResponse(resp *http.Response) (SourceControlSyncJobStreamsGetResponse, error) { result := SourceControlSyncJobStreamsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SourceControlSyncJobStreamByID); err != nil { - return SourceControlSyncJobStreamsGetResponse{}, err + return SourceControlSyncJobStreamsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -160,7 +168,7 @@ func (client *SourceControlSyncJobStreamsClient) listBySyncJobCreateRequest(ctx func (client *SourceControlSyncJobStreamsClient) listBySyncJobHandleResponse(resp *http.Response) (SourceControlSyncJobStreamsListBySyncJobResponse, error) { result := SourceControlSyncJobStreamsListBySyncJobResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SourceControlSyncJobStreamsListBySyncJob); err != nil { - return SourceControlSyncJobStreamsListBySyncJobResponse{}, err + return SourceControlSyncJobStreamsListBySyncJobResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_statistics_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_statistics_client.go index 8da68977be40..3ec80ef5706d 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_statistics_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_statistics_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // StatisticsClient contains the methods for the Statistics group. @@ -30,8 +31,15 @@ type StatisticsClient struct { } // NewStatisticsClient creates a new instance of StatisticsClient with the specified values. -func NewStatisticsClient(con *arm.Connection, subscriptionID string) *StatisticsClient { - return &StatisticsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewStatisticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *StatisticsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &StatisticsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByAutomationAccount - Retrieve the statistics for the account. @@ -84,7 +92,7 @@ func (client *StatisticsClient) listByAutomationAccountCreateRequest(ctx context func (client *StatisticsClient) listByAutomationAccountHandleResponse(resp *http.Response) (StatisticsListByAutomationAccountResponse, error) { result := StatisticsListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StatisticsListResult); err != nil { - return StatisticsListByAutomationAccountResponse{}, err + return StatisticsListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_testjob_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_testjob_client.go index 54a5e61a15bb..926fb75d9b43 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_testjob_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_testjob_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TestJobClient contains the methods for the TestJob group. @@ -30,8 +31,15 @@ type TestJobClient struct { } // NewTestJobClient creates a new instance of TestJobClient with the specified values. -func NewTestJobClient(con *arm.Connection, subscriptionID string) *TestJobClient { - return &TestJobClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTestJobClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TestJobClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TestJobClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Create a test job of the runbook. @@ -85,7 +93,7 @@ func (client *TestJobClient) createCreateRequest(ctx context.Context, resourceGr func (client *TestJobClient) createHandleResponse(resp *http.Response) (TestJobCreateResponse, error) { result := TestJobCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TestJob); err != nil { - return TestJobCreateResponse{}, err + return TestJobCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -154,7 +162,7 @@ func (client *TestJobClient) getCreateRequest(ctx context.Context, resourceGroup func (client *TestJobClient) getHandleResponse(resp *http.Response) (TestJobGetResponse, error) { result := TestJobGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TestJob); err != nil { - return TestJobGetResponse{}, err + return TestJobGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_testjobstreams_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_testjobstreams_client.go index 15d89e8dd74c..5aae730ebf5b 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_testjobstreams_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_testjobstreams_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TestJobStreamsClient contains the methods for the TestJobStreams group. @@ -30,8 +31,15 @@ type TestJobStreamsClient struct { } // NewTestJobStreamsClient creates a new instance of TestJobStreamsClient with the specified values. -func NewTestJobStreamsClient(con *arm.Connection, subscriptionID string) *TestJobStreamsClient { - return &TestJobStreamsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTestJobStreamsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TestJobStreamsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TestJobStreamsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Retrieve a test job stream of the test job identified by runbook name and stream id. @@ -89,7 +97,7 @@ func (client *TestJobStreamsClient) getCreateRequest(ctx context.Context, resour func (client *TestJobStreamsClient) getHandleResponse(resp *http.Response) (TestJobStreamsGetResponse, error) { result := TestJobStreamsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobStream); err != nil { - return TestJobStreamsGetResponse{}, err + return TestJobStreamsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -158,7 +166,7 @@ func (client *TestJobStreamsClient) listByTestJobCreateRequest(ctx context.Conte func (client *TestJobStreamsClient) listByTestJobHandleResponse(resp *http.Response) (TestJobStreamsListByTestJobResponse, error) { result := TestJobStreamsListByTestJobResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobStreamListResult); err != nil { - return TestJobStreamsListByTestJobResponse{}, err + return TestJobStreamsListByTestJobResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_time_rfc3339.go b/sdk/resourcemanager/automation/armautomation/zz_generated_time_rfc3339.go index be3f53d5185d..6c2e068e3860 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armautomation import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_usages_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_usages_client.go index f81f5e8e4457..6c00ee120de1 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_usages_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_usages_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // UsagesClient contains the methods for the Usages group. @@ -30,8 +31,15 @@ type UsagesClient struct { } // NewUsagesClient creates a new instance of UsagesClient with the specified values. -func NewUsagesClient(con *arm.Connection, subscriptionID string) *UsagesClient { - return &UsagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UsagesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &UsagesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByAutomationAccount - Retrieve the usage for the account id. @@ -81,7 +89,7 @@ func (client *UsagesClient) listByAutomationAccountCreateRequest(ctx context.Con func (client *UsagesClient) listByAutomationAccountHandleResponse(resp *http.Response) (UsagesListByAutomationAccountResponse, error) { result := UsagesListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UsageListResult); err != nil { - return UsagesListByAutomationAccountResponse{}, err + return UsagesListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_variable_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_variable_client.go index 6d418845ce07..81b73ededb53 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_variable_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_variable_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VariableClient contains the methods for the Variable group. @@ -30,8 +31,15 @@ type VariableClient struct { } // NewVariableClient creates a new instance of VariableClient with the specified values. -func NewVariableClient(con *arm.Connection, subscriptionID string) *VariableClient { - return &VariableClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVariableClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VariableClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VariableClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create a variable. @@ -85,7 +93,7 @@ func (client *VariableClient) createOrUpdateCreateRequest(ctx context.Context, r func (client *VariableClient) createOrUpdateHandleResponse(resp *http.Response) (VariableCreateOrUpdateResponse, error) { result := VariableCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Variable); err != nil { - return VariableCreateOrUpdateResponse{}, err + return VariableCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *VariableClient) getCreateRequest(ctx context.Context, resourceGrou func (client *VariableClient) getHandleResponse(resp *http.Response) (VariableGetResponse, error) { result := VariableGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Variable); err != nil { - return VariableGetResponse{}, err + return VariableGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -276,7 +284,7 @@ func (client *VariableClient) listByAutomationAccountCreateRequest(ctx context.C func (client *VariableClient) listByAutomationAccountHandleResponse(resp *http.Response) (VariableListByAutomationAccountResponse, error) { result := VariableListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VariableListResult); err != nil { - return VariableListByAutomationAccountResponse{}, err + return VariableListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -345,7 +353,7 @@ func (client *VariableClient) updateCreateRequest(ctx context.Context, resourceG func (client *VariableClient) updateHandleResponse(resp *http.Response) (VariableUpdateResponse, error) { result := VariableUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Variable); err != nil { - return VariableUpdateResponse{}, err + return VariableUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_watcher_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_watcher_client.go index db2a2e0a89ad..d5936c234b64 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_watcher_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_watcher_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // WatcherClient contains the methods for the Watcher group. @@ -30,8 +31,15 @@ type WatcherClient struct { } // NewWatcherClient creates a new instance of WatcherClient with the specified values. -func NewWatcherClient(con *arm.Connection, subscriptionID string) *WatcherClient { - return &WatcherClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWatcherClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WatcherClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WatcherClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create the watcher identified by watcher name. @@ -85,7 +93,7 @@ func (client *WatcherClient) createOrUpdateCreateRequest(ctx context.Context, re func (client *WatcherClient) createOrUpdateHandleResponse(resp *http.Response) (WatcherCreateOrUpdateResponse, error) { result := WatcherCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Watcher); err != nil { - return WatcherCreateOrUpdateResponse{}, err + return WatcherCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *WatcherClient) getCreateRequest(ctx context.Context, resourceGroup func (client *WatcherClient) getHandleResponse(resp *http.Response) (WatcherGetResponse, error) { result := WatcherGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Watcher); err != nil { - return WatcherGetResponse{}, err + return WatcherGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -279,7 +287,7 @@ func (client *WatcherClient) listByAutomationAccountCreateRequest(ctx context.Co func (client *WatcherClient) listByAutomationAccountHandleResponse(resp *http.Response) (WatcherListByAutomationAccountResponse, error) { result := WatcherListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WatcherListResult); err != nil { - return WatcherListByAutomationAccountResponse{}, err + return WatcherListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -468,7 +476,7 @@ func (client *WatcherClient) updateCreateRequest(ctx context.Context, resourceGr func (client *WatcherClient) updateHandleResponse(resp *http.Response) (WatcherUpdateResponse, error) { result := WatcherUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Watcher); err != nil { - return WatcherUpdateResponse{}, err + return WatcherUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/automation/armautomation/zz_generated_webhook_client.go b/sdk/resourcemanager/automation/armautomation/zz_generated_webhook_client.go index 963f5e437be7..bff0d959de27 100644 --- a/sdk/resourcemanager/automation/armautomation/zz_generated_webhook_client.go +++ b/sdk/resourcemanager/automation/armautomation/zz_generated_webhook_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // WebhookClient contains the methods for the Webhook group. @@ -30,8 +31,15 @@ type WebhookClient struct { } // NewWebhookClient creates a new instance of WebhookClient with the specified values. -func NewWebhookClient(con *arm.Connection, subscriptionID string) *WebhookClient { - return &WebhookClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWebhookClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WebhookClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WebhookClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create the webhook identified by webhook name. @@ -85,7 +93,7 @@ func (client *WebhookClient) createOrUpdateCreateRequest(ctx context.Context, re func (client *WebhookClient) createOrUpdateHandleResponse(resp *http.Response) (WebhookCreateOrUpdateResponse, error) { result := WebhookCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Webhook); err != nil { - return WebhookCreateOrUpdateResponse{}, err + return WebhookCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -210,7 +218,7 @@ func (client *WebhookClient) generateURICreateRequest(ctx context.Context, resou func (client *WebhookClient) generateURIHandleResponse(resp *http.Response) (WebhookGenerateURIResponse, error) { result := WebhookGenerateURIResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Value); err != nil { - return WebhookGenerateURIResponse{}, err + return WebhookGenerateURIResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -279,7 +287,7 @@ func (client *WebhookClient) getCreateRequest(ctx context.Context, resourceGroup func (client *WebhookClient) getHandleResponse(resp *http.Response) (WebhookGetResponse, error) { result := WebhookGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Webhook); err != nil { - return WebhookGetResponse{}, err + return WebhookGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -344,7 +352,7 @@ func (client *WebhookClient) listByAutomationAccountCreateRequest(ctx context.Co func (client *WebhookClient) listByAutomationAccountHandleResponse(resp *http.Response) (WebhookListByAutomationAccountResponse, error) { result := WebhookListByAutomationAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebhookListResult); err != nil { - return WebhookListByAutomationAccountResponse{}, err + return WebhookListByAutomationAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -413,7 +421,7 @@ func (client *WebhookClient) updateCreateRequest(ctx context.Context, resourceGr func (client *WebhookClient) updateHandleResponse(resp *http.Response) (WebhookUpdateResponse, error) { result := WebhookUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Webhook); err != nil { - return WebhookUpdateResponse{}, err + return WebhookUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/CHANGELOG.md b/sdk/resourcemanager/cdn/armcdn/CHANGELOG.md index 34f86d5bb408..bd4524485ca1 100644 --- a/sdk/resourcemanager/cdn/armcdn/CHANGELOG.md +++ b/sdk/resourcemanager/cdn/armcdn/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-15) diff --git a/sdk/resourcemanager/cdn/armcdn/README.md b/sdk/resourcemanager/cdn/armcdn/README.md index d88c687b760d..fe66dac6f378 100644 --- a/sdk/resourcemanager/cdn/armcdn/README.md +++ b/sdk/resourcemanager/cdn/armcdn/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Content Delivery Network +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Content Delivery Network modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armcdn.NewCdnManagementClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Content Delivery Network modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armcdn.NewCdnManagementClient(con,subscriptionID) +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armcdn.NewCdnManagementClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/cdn/armcdn/autorest.md b/sdk/resourcemanager/cdn/armcdn/autorest.md index 21817a5861ed..ac144e318130 100644 --- a/sdk/resourcemanager/cdn/armcdn/autorest.md +++ b/sdk/resourcemanager/cdn/armcdn/autorest.md @@ -5,10 +5,10 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/314f28163917b9cfc527f7776b5e4a1dea69d295/specification/cdn/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/314f28163917b9cfc527f7776b5e4a1dea69d295/specification/cdn/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/cdn/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/cdn/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.1 +module-version: 0.2.0 modelerfour: lenient-model-deduplication: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/cdn/armcdn/go.mod b/sdk/resourcemanager/cdn/armcdn/go.mod index 8ea2c9d131b0..9008780496ab 100644 --- a/sdk/resourcemanager/cdn/armcdn/go.mod +++ b/sdk/resourcemanager/cdn/armcdn/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cdn/armcdn go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.1.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/cdn/armcdn/go.sum b/sdk/resourcemanager/cdn/armcdn/go.sum index f37ba2aef08b..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/cdn/armcdn/go.sum +++ b/sdk/resourcemanager/cdn/armcdn/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible h1:WFsr3Efy7uweykOAEfOHO3ACtuwIv+rrFmSn9K48VnA= -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_afdcustomdomains_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_afdcustomdomains_client.go index 87ed3a86bc76..240920767058 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_afdcustomdomains_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_afdcustomdomains_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type AFDCustomDomainsClient struct { } // NewAFDCustomDomainsClient creates a new instance of AFDCustomDomainsClient with the specified values. -func NewAFDCustomDomainsClient(con *arm.Connection, subscriptionID string) *AFDCustomDomainsClient { - return &AFDCustomDomainsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAFDCustomDomainsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AFDCustomDomainsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AFDCustomDomainsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new domain within the specified profile. @@ -245,7 +253,7 @@ func (client *AFDCustomDomainsClient) getCreateRequest(ctx context.Context, reso func (client *AFDCustomDomainsClient) getHandleResponse(resp *http.Response) (AFDCustomDomainsGetResponse, error) { result := AFDCustomDomainsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AFDDomain); err != nil { - return AFDCustomDomainsGetResponse{}, err + return AFDCustomDomainsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -307,7 +315,7 @@ func (client *AFDCustomDomainsClient) listByProfileCreateRequest(ctx context.Con func (client *AFDCustomDomainsClient) listByProfileHandleResponse(resp *http.Response) (AFDCustomDomainsListByProfileResponse, error) { result := AFDCustomDomainsListByProfileResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AFDDomainListResult); err != nil { - return AFDCustomDomainsListByProfileResponse{}, err + return AFDCustomDomainsListByProfileResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_afdendpoints_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_afdendpoints_client.go index ce22ff2cd3af..23b3cd56f0c9 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_afdendpoints_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_afdendpoints_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type AFDEndpointsClient struct { } // NewAFDEndpointsClient creates a new instance of AFDEndpointsClient with the specified values. -func NewAFDEndpointsClient(con *arm.Connection, subscriptionID string) *AFDEndpointsClient { - return &AFDEndpointsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAFDEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AFDEndpointsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AFDEndpointsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new AzureFrontDoor endpoint with the specified endpoint name under the specified subscription, resource group and profile. @@ -245,7 +253,7 @@ func (client *AFDEndpointsClient) getCreateRequest(ctx context.Context, resource func (client *AFDEndpointsClient) getHandleResponse(resp *http.Response) (AFDEndpointsGetResponse, error) { result := AFDEndpointsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AFDEndpoint); err != nil { - return AFDEndpointsGetResponse{}, err + return AFDEndpointsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -307,7 +315,7 @@ func (client *AFDEndpointsClient) listByProfileCreateRequest(ctx context.Context func (client *AFDEndpointsClient) listByProfileHandleResponse(resp *http.Response) (AFDEndpointsListByProfileResponse, error) { result := AFDEndpointsListByProfileResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AFDEndpointListResult); err != nil { - return AFDEndpointsListByProfileResponse{}, err + return AFDEndpointsListByProfileResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -373,7 +381,7 @@ func (client *AFDEndpointsClient) listResourceUsageCreateRequest(ctx context.Con func (client *AFDEndpointsClient) listResourceUsageHandleResponse(resp *http.Response) (AFDEndpointsListResourceUsageResponse, error) { result := AFDEndpointsListResourceUsageResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UsagesListResult); err != nil { - return AFDEndpointsListResourceUsageResponse{}, err + return AFDEndpointsListResourceUsageResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -608,7 +616,7 @@ func (client *AFDEndpointsClient) validateCustomDomainCreateRequest(ctx context. func (client *AFDEndpointsClient) validateCustomDomainHandleResponse(resp *http.Response) (AFDEndpointsValidateCustomDomainResponse, error) { result := AFDEndpointsValidateCustomDomainResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ValidateCustomDomainOutput); err != nil { - return AFDEndpointsValidateCustomDomainResponse{}, err + return AFDEndpointsValidateCustomDomainResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_afdorigingroups_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_afdorigingroups_client.go index 9df819a296c7..42dc5ec7b60a 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_afdorigingroups_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_afdorigingroups_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type AFDOriginGroupsClient struct { } // NewAFDOriginGroupsClient creates a new instance of AFDOriginGroupsClient with the specified values. -func NewAFDOriginGroupsClient(con *arm.Connection, subscriptionID string) *AFDOriginGroupsClient { - return &AFDOriginGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAFDOriginGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AFDOriginGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AFDOriginGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new origin group within the specified profile. @@ -245,7 +253,7 @@ func (client *AFDOriginGroupsClient) getCreateRequest(ctx context.Context, resou func (client *AFDOriginGroupsClient) getHandleResponse(resp *http.Response) (AFDOriginGroupsGetResponse, error) { result := AFDOriginGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AFDOriginGroup); err != nil { - return AFDOriginGroupsGetResponse{}, err + return AFDOriginGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -307,7 +315,7 @@ func (client *AFDOriginGroupsClient) listByProfileCreateRequest(ctx context.Cont func (client *AFDOriginGroupsClient) listByProfileHandleResponse(resp *http.Response) (AFDOriginGroupsListByProfileResponse, error) { result := AFDOriginGroupsListByProfileResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AFDOriginGroupListResult); err != nil { - return AFDOriginGroupsListByProfileResponse{}, err + return AFDOriginGroupsListByProfileResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -373,7 +381,7 @@ func (client *AFDOriginGroupsClient) listResourceUsageCreateRequest(ctx context. func (client *AFDOriginGroupsClient) listResourceUsageHandleResponse(resp *http.Response) (AFDOriginGroupsListResourceUsageResponse, error) { result := AFDOriginGroupsListResourceUsageResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UsagesListResult); err != nil { - return AFDOriginGroupsListResourceUsageResponse{}, err + return AFDOriginGroupsListResourceUsageResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_afdorigins_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_afdorigins_client.go index 66b72a28d0fa..dd07b8cc09e4 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_afdorigins_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_afdorigins_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type AFDOriginsClient struct { } // NewAFDOriginsClient creates a new instance of AFDOriginsClient with the specified values. -func NewAFDOriginsClient(con *arm.Connection, subscriptionID string) *AFDOriginsClient { - return &AFDOriginsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAFDOriginsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AFDOriginsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AFDOriginsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new origin within the specified origin group. @@ -257,7 +265,7 @@ func (client *AFDOriginsClient) getCreateRequest(ctx context.Context, resourceGr func (client *AFDOriginsClient) getHandleResponse(resp *http.Response) (AFDOriginsGetResponse, error) { result := AFDOriginsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AFDOrigin); err != nil { - return AFDOriginsGetResponse{}, err + return AFDOriginsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -323,7 +331,7 @@ func (client *AFDOriginsClient) listByOriginGroupCreateRequest(ctx context.Conte func (client *AFDOriginsClient) listByOriginGroupHandleResponse(resp *http.Response) (AFDOriginsListByOriginGroupResponse, error) { result := AFDOriginsListByOriginGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AFDOriginListResult); err != nil { - return AFDOriginsListByOriginGroupResponse{}, err + return AFDOriginsListByOriginGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_afdprofiles_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_afdprofiles_client.go index 544904844162..a300c69633e9 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_afdprofiles_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_afdprofiles_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -29,8 +31,15 @@ type AFDProfilesClient struct { } // NewAFDProfilesClient creates a new instance of AFDProfilesClient with the specified values. -func NewAFDProfilesClient(con *arm.Connection, subscriptionID string) *AFDProfilesClient { - return &AFDProfilesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAFDProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AFDProfilesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AFDProfilesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckHostNameAvailability - Validates the custom domain mapping to ensure it maps to the correct CDN endpoint in DNS. @@ -80,7 +89,7 @@ func (client *AFDProfilesClient) checkHostNameAvailabilityCreateRequest(ctx cont func (client *AFDProfilesClient) checkHostNameAvailabilityHandleResponse(resp *http.Response) (AFDProfilesCheckHostNameAvailabilityResponse, error) { result := AFDProfilesCheckHostNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ValidateCustomDomainOutput); err != nil { - return AFDProfilesCheckHostNameAvailabilityResponse{}, err + return AFDProfilesCheckHostNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -142,7 +151,7 @@ func (client *AFDProfilesClient) listResourceUsageCreateRequest(ctx context.Cont func (client *AFDProfilesClient) listResourceUsageHandleResponse(resp *http.Response) (AFDProfilesListResourceUsageResponse, error) { result := AFDProfilesListResourceUsageResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UsagesListResult); err != nil { - return AFDProfilesListResourceUsageResponse{}, err + return AFDProfilesListResourceUsageResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_cdnmanagementclient_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_cdnmanagementclient_client.go index edda623eedca..1b05fd87faad 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_cdnmanagementclient_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_cdnmanagementclient_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -29,8 +31,15 @@ type CdnManagementClient struct { } // NewCdnManagementClient creates a new instance of CdnManagementClient with the specified values. -func NewCdnManagementClient(con *arm.Connection, subscriptionID string) *CdnManagementClient { - return &CdnManagementClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCdnManagementClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CdnManagementClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CdnManagementClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNameAvailability - Check the availability of a resource name. This is needed for resources where name is globally unique, such as a CDN endpoint. @@ -68,7 +77,7 @@ func (client *CdnManagementClient) checkNameAvailabilityCreateRequest(ctx contex func (client *CdnManagementClient) checkNameAvailabilityHandleResponse(resp *http.Response) (CdnManagementClientCheckNameAvailabilityResponse, error) { result := CdnManagementClientCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityOutput); err != nil { - return CdnManagementClientCheckNameAvailabilityResponse{}, err + return CdnManagementClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -126,7 +135,7 @@ func (client *CdnManagementClient) checkNameAvailabilityWithSubscriptionCreateRe func (client *CdnManagementClient) checkNameAvailabilityWithSubscriptionHandleResponse(resp *http.Response) (CdnManagementClientCheckNameAvailabilityWithSubscriptionResponse, error) { result := CdnManagementClientCheckNameAvailabilityWithSubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityOutput); err != nil { - return CdnManagementClientCheckNameAvailabilityWithSubscriptionResponse{}, err + return CdnManagementClientCheckNameAvailabilityWithSubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -185,7 +194,7 @@ func (client *CdnManagementClient) validateProbeCreateRequest(ctx context.Contex func (client *CdnManagementClient) validateProbeHandleResponse(resp *http.Response) (CdnManagementClientValidateProbeResponse, error) { result := CdnManagementClientValidateProbeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ValidateProbeOutput); err != nil { - return CdnManagementClientValidateProbeResponse{}, err + return CdnManagementClientValidateProbeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_constants.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_constants.go index e82b487d37da..bd3455a7400a 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_constants.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_constants.go @@ -10,7 +10,7 @@ package armcdn const ( module = "armcdn" - version = "v0.1.1" + version = "v0.2.0" ) // AFDEndpointProtocols - Supported protocols for the customer's endpoint. diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_customdomains_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_customdomains_client.go index 6882261d69db..ec9335bc64d0 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_customdomains_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_customdomains_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type CustomDomainsClient struct { } // NewCustomDomainsClient creates a new instance of CustomDomainsClient with the specified values. -func NewCustomDomainsClient(con *arm.Connection, subscriptionID string) *CustomDomainsClient { - return &CustomDomainsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCustomDomainsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CustomDomainsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CustomDomainsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new custom domain within an endpoint. @@ -428,7 +436,7 @@ func (client *CustomDomainsClient) getCreateRequest(ctx context.Context, resourc func (client *CustomDomainsClient) getHandleResponse(resp *http.Response) (CustomDomainsGetResponse, error) { result := CustomDomainsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CustomDomain); err != nil { - return CustomDomainsGetResponse{}, err + return CustomDomainsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -494,7 +502,7 @@ func (client *CustomDomainsClient) listByEndpointCreateRequest(ctx context.Conte func (client *CustomDomainsClient) listByEndpointHandleResponse(resp *http.Response) (CustomDomainsListByEndpointResponse, error) { result := CustomDomainsListByEndpointResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CustomDomainListResult); err != nil { - return CustomDomainsListByEndpointResponse{}, err + return CustomDomainsListByEndpointResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_edgenodes_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_edgenodes_client.go index a04cd09c5fa3..a21701cb3337 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_edgenodes_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_edgenodes_client.go @@ -11,7 +11,9 @@ package armcdn import ( "context" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,8 +27,15 @@ type EdgeNodesClient struct { } // NewEdgeNodesClient creates a new instance of EdgeNodesClient with the specified values. -func NewEdgeNodesClient(con *arm.Connection) *EdgeNodesClient { - return &EdgeNodesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewEdgeNodesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *EdgeNodesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &EdgeNodesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Edgenodes are the global Point of Presence (POP) locations used to deliver CDN content to end users. @@ -61,7 +70,7 @@ func (client *EdgeNodesClient) listCreateRequest(ctx context.Context, options *E func (client *EdgeNodesClient) listHandleResponse(resp *http.Response) (EdgeNodesListResponse, error) { result := EdgeNodesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EdgenodeResult); err != nil { - return EdgeNodesListResponse{}, err + return EdgeNodesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_endpoints_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_endpoints_client.go index cde0af6e84e8..4d5d38a16cf4 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_endpoints_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_endpoints_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type EndpointsClient struct { } // NewEndpointsClient creates a new instance of EndpointsClient with the specified values. -func NewEndpointsClient(con *arm.Connection, subscriptionID string) *EndpointsClient { - return &EndpointsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *EndpointsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &EndpointsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new CDN endpoint with the specified endpoint name under the specified subscription, resource group and profile. @@ -245,7 +253,7 @@ func (client *EndpointsClient) getCreateRequest(ctx context.Context, resourceGro func (client *EndpointsClient) getHandleResponse(resp *http.Response) (EndpointsGetResponse, error) { result := EndpointsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Endpoint); err != nil { - return EndpointsGetResponse{}, err + return EndpointsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -307,7 +315,7 @@ func (client *EndpointsClient) listByProfileCreateRequest(ctx context.Context, r func (client *EndpointsClient) listByProfileHandleResponse(resp *http.Response) (EndpointsListByProfileResponse, error) { result := EndpointsListByProfileResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EndpointListResult); err != nil { - return EndpointsListByProfileResponse{}, err + return EndpointsListByProfileResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -373,7 +381,7 @@ func (client *EndpointsClient) listResourceUsageCreateRequest(ctx context.Contex func (client *EndpointsClient) listResourceUsageHandleResponse(resp *http.Response) (EndpointsListResourceUsageResponse, error) { result := EndpointsListResourceUsageResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceUsageListResult); err != nil { - return EndpointsListResourceUsageResponse{}, err + return EndpointsListResourceUsageResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -848,7 +856,7 @@ func (client *EndpointsClient) validateCustomDomainCreateRequest(ctx context.Con func (client *EndpointsClient) validateCustomDomainHandleResponse(resp *http.Response) (EndpointsValidateCustomDomainResponse, error) { result := EndpointsValidateCustomDomainResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ValidateCustomDomainOutput); err != nil { - return EndpointsValidateCustomDomainResponse{}, err + return EndpointsValidateCustomDomainResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_loganalytics_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_loganalytics_client.go index 31d912188d3e..3320cd9b2533 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_loganalytics_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_loganalytics_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -31,8 +33,15 @@ type LogAnalyticsClient struct { } // NewLogAnalyticsClient creates a new instance of LogAnalyticsClient with the specified values. -func NewLogAnalyticsClient(con *arm.Connection, subscriptionID string) *LogAnalyticsClient { - return &LogAnalyticsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLogAnalyticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LogAnalyticsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LogAnalyticsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetLogAnalyticsLocations - Get all available location names for AFD log analytics report. @@ -82,7 +91,7 @@ func (client *LogAnalyticsClient) getLogAnalyticsLocationsCreateRequest(ctx cont func (client *LogAnalyticsClient) getLogAnalyticsLocationsHandleResponse(resp *http.Response) (LogAnalyticsGetLogAnalyticsLocationsResponse, error) { result := LogAnalyticsGetLogAnalyticsLocationsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ContinentsResponse); err != nil { - return LogAnalyticsGetLogAnalyticsLocationsResponse{}, err + return LogAnalyticsGetLogAnalyticsLocationsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -174,7 +183,7 @@ func (client *LogAnalyticsClient) getLogAnalyticsMetricsCreateRequest(ctx contex func (client *LogAnalyticsClient) getLogAnalyticsMetricsHandleResponse(resp *http.Response) (LogAnalyticsGetLogAnalyticsMetricsResponse, error) { result := LogAnalyticsGetLogAnalyticsMetricsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricsResponse); err != nil { - return LogAnalyticsGetLogAnalyticsMetricsResponse{}, err + return LogAnalyticsGetLogAnalyticsMetricsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -253,7 +262,7 @@ func (client *LogAnalyticsClient) getLogAnalyticsRankingsCreateRequest(ctx conte func (client *LogAnalyticsClient) getLogAnalyticsRankingsHandleResponse(resp *http.Response) (LogAnalyticsGetLogAnalyticsRankingsResponse, error) { result := LogAnalyticsGetLogAnalyticsRankingsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RankingsResponse); err != nil { - return LogAnalyticsGetLogAnalyticsRankingsResponse{}, err + return LogAnalyticsGetLogAnalyticsRankingsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -318,7 +327,7 @@ func (client *LogAnalyticsClient) getLogAnalyticsResourcesCreateRequest(ctx cont func (client *LogAnalyticsClient) getLogAnalyticsResourcesHandleResponse(resp *http.Response) (LogAnalyticsGetLogAnalyticsResourcesResponse, error) { result := LogAnalyticsGetLogAnalyticsResourcesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourcesResponse); err != nil { - return LogAnalyticsGetLogAnalyticsResourcesResponse{}, err + return LogAnalyticsGetLogAnalyticsResourcesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -404,7 +413,7 @@ func (client *LogAnalyticsClient) getWafLogAnalyticsMetricsCreateRequest(ctx con func (client *LogAnalyticsClient) getWafLogAnalyticsMetricsHandleResponse(resp *http.Response) (LogAnalyticsGetWafLogAnalyticsMetricsResponse, error) { result := LogAnalyticsGetWafLogAnalyticsMetricsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WafMetricsResponse); err != nil { - return LogAnalyticsGetWafLogAnalyticsMetricsResponse{}, err + return LogAnalyticsGetWafLogAnalyticsMetricsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -488,7 +497,7 @@ func (client *LogAnalyticsClient) getWafLogAnalyticsRankingsCreateRequest(ctx co func (client *LogAnalyticsClient) getWafLogAnalyticsRankingsHandleResponse(resp *http.Response) (LogAnalyticsGetWafLogAnalyticsRankingsResponse, error) { result := LogAnalyticsGetWafLogAnalyticsRankingsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WafRankingsResponse); err != nil { - return LogAnalyticsGetWafLogAnalyticsRankingsResponse{}, err + return LogAnalyticsGetWafLogAnalyticsRankingsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_managedrulesets_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_managedrulesets_client.go index 3696fe35a027..3d56feac838b 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_managedrulesets_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_managedrulesets_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -29,8 +31,15 @@ type ManagedRuleSetsClient struct { } // NewManagedRuleSetsClient creates a new instance of ManagedRuleSetsClient with the specified values. -func NewManagedRuleSetsClient(con *arm.Connection, subscriptionID string) *ManagedRuleSetsClient { - return &ManagedRuleSetsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedRuleSetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedRuleSetsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedRuleSetsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all available managed rule sets. @@ -69,7 +78,7 @@ func (client *ManagedRuleSetsClient) listCreateRequest(ctx context.Context, opti func (client *ManagedRuleSetsClient) listHandleResponse(resp *http.Response) (ManagedRuleSetsListResponse, error) { result := ManagedRuleSetsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedRuleSetDefinitionList); err != nil { - return ManagedRuleSetsListResponse{}, err + return ManagedRuleSetsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_models.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_models.go index ef111198607f..df6607061348 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_models.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_models.go @@ -1062,7 +1062,7 @@ type Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDa // MarshalJSON implements the json.Marshaller interface for type Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems. func (c Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsPropertiesDataItems) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "dateTime", (*timeRFC3339)(c.DateTime)) + populateTimeRFC3339(objectMap, "dateTime", c.DateTime) populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } @@ -1077,9 +1077,7 @@ func (c *Components18OrqelSchemasWafmetricsresponsePropertiesSeriesItemsProperti var err error switch key { case "dateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.DateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.DateTime) delete(rawMsg, key) case "value": err = unpopulate(val, &c.Value) @@ -1100,7 +1098,7 @@ type Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataI // MarshalJSON implements the json.Marshaller interface for type Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems. func (c Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesDataItems) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "dateTime", (*timeRFC3339)(c.DateTime)) + populateTimeRFC3339(objectMap, "dateTime", c.DateTime) populate(objectMap, "value", c.Value) return json.Marshal(objectMap) } @@ -1115,9 +1113,7 @@ func (c *Components1Gs0LlpSchemasMetricsresponsePropertiesSeriesItemsPropertiesD var err error switch key { case "dateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.DateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.DateTime) delete(rawMsg, key) case "value": err = unpopulate(val, &c.Value) @@ -1318,6 +1314,9 @@ type CustomDomainProperties struct { // REQUIRED; The host name of the custom domain. Must be a domain name. HostName *string `json:"hostName,omitempty"` + // Certificate parameters for securing custom HTTPS + CustomHTTPSParameters CustomDomainHTTPSParametersClassification `json:"customHttpsParameters,omitempty"` + // Special validation or data may be required when delivering CDN to some regions due to local compliance reasons. E.g. ICP license number of a custom domain // is required to deliver content in China. ValidationData *string `json:"validationData,omitempty"` @@ -1335,6 +1334,57 @@ type CustomDomainProperties struct { ResourceState *CustomDomainResourceState `json:"resourceState,omitempty" azure:"ro"` } +// MarshalJSON implements the json.Marshaller interface for type CustomDomainProperties. +func (c CustomDomainProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "customHttpsParameters", c.CustomHTTPSParameters) + populate(objectMap, "customHttpsProvisioningState", c.CustomHTTPSProvisioningState) + populate(objectMap, "customHttpsProvisioningSubstate", c.CustomHTTPSProvisioningSubstate) + populate(objectMap, "hostName", c.HostName) + populate(objectMap, "provisioningState", c.ProvisioningState) + populate(objectMap, "resourceState", c.ResourceState) + populate(objectMap, "validationData", c.ValidationData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomDomainProperties. +func (c *CustomDomainProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "customHttpsParameters": + c.CustomHTTPSParameters, err = unmarshalCustomDomainHTTPSParametersClassification(val) + delete(rawMsg, key) + case "customHttpsProvisioningState": + err = unpopulate(val, &c.CustomHTTPSProvisioningState) + delete(rawMsg, key) + case "customHttpsProvisioningSubstate": + err = unpopulate(val, &c.CustomHTTPSProvisioningSubstate) + delete(rawMsg, key) + case "hostName": + err = unpopulate(val, &c.HostName) + delete(rawMsg, key) + case "provisioningState": + err = unpopulate(val, &c.ProvisioningState) + delete(rawMsg, key) + case "resourceState": + err = unpopulate(val, &c.ResourceState) + delete(rawMsg, key) + case "validationData": + err = unpopulate(val, &c.ValidationData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + // CustomDomainPropertiesParameters - The JSON object that contains the properties of the custom domain to create. type CustomDomainPropertiesParameters struct { // REQUIRED; The host name of the custom domain. Must be a domain name. @@ -3224,8 +3274,8 @@ type MetricsResponse struct { // MarshalJSON implements the json.Marshaller interface for type MetricsResponse. func (m MetricsResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "dateTimeBegin", (*timeRFC3339)(m.DateTimeBegin)) - populate(objectMap, "dateTimeEnd", (*timeRFC3339)(m.DateTimeEnd)) + populateTimeRFC3339(objectMap, "dateTimeBegin", m.DateTimeBegin) + populateTimeRFC3339(objectMap, "dateTimeEnd", m.DateTimeEnd) populate(objectMap, "granularity", m.Granularity) populate(objectMap, "series", m.Series) return json.Marshal(objectMap) @@ -3241,14 +3291,10 @@ func (m *MetricsResponse) UnmarshalJSON(data []byte) error { var err error switch key { case "dateTimeBegin": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.DateTimeBegin = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.DateTimeBegin) delete(rawMsg, key) case "dateTimeEnd": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.DateTimeEnd = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.DateTimeEnd) delete(rawMsg, key) case "granularity": err = unpopulate(val, &m.Granularity) @@ -3863,8 +3909,8 @@ type RankingsResponse struct { // MarshalJSON implements the json.Marshaller interface for type RankingsResponse. func (r RankingsResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "dateTimeBegin", (*timeRFC3339)(r.DateTimeBegin)) - populate(objectMap, "dateTimeEnd", (*timeRFC3339)(r.DateTimeEnd)) + populateTimeRFC3339(objectMap, "dateTimeBegin", r.DateTimeBegin) + populateTimeRFC3339(objectMap, "dateTimeEnd", r.DateTimeEnd) populate(objectMap, "tables", r.Tables) return json.Marshal(objectMap) } @@ -3879,14 +3925,10 @@ func (r *RankingsResponse) UnmarshalJSON(data []byte) error { var err error switch key { case "dateTimeBegin": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.DateTimeBegin = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.DateTimeBegin) delete(rawMsg, key) case "dateTimeEnd": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.DateTimeEnd = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.DateTimeEnd) delete(rawMsg, key) case "tables": err = unpopulate(val, &r.Tables) @@ -5085,10 +5127,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -5104,9 +5146,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -5115,9 +5155,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) @@ -5647,8 +5685,8 @@ type WafMetricsResponse struct { // MarshalJSON implements the json.Marshaller interface for type WafMetricsResponse. func (w WafMetricsResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "dateTimeBegin", (*timeRFC3339)(w.DateTimeBegin)) - populate(objectMap, "dateTimeEnd", (*timeRFC3339)(w.DateTimeEnd)) + populateTimeRFC3339(objectMap, "dateTimeBegin", w.DateTimeBegin) + populateTimeRFC3339(objectMap, "dateTimeEnd", w.DateTimeEnd) populate(objectMap, "granularity", w.Granularity) populate(objectMap, "series", w.Series) return json.Marshal(objectMap) @@ -5664,14 +5702,10 @@ func (w *WafMetricsResponse) UnmarshalJSON(data []byte) error { var err error switch key { case "dateTimeBegin": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.DateTimeBegin = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.DateTimeBegin) delete(rawMsg, key) case "dateTimeEnd": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.DateTimeEnd = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.DateTimeEnd) delete(rawMsg, key) case "granularity": err = unpopulate(val, &w.Granularity) @@ -5721,8 +5755,8 @@ type WafRankingsResponse struct { func (w WafRankingsResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "data", w.Data) - populate(objectMap, "dateTimeBegin", (*timeRFC3339)(w.DateTimeBegin)) - populate(objectMap, "dateTimeEnd", (*timeRFC3339)(w.DateTimeEnd)) + populateTimeRFC3339(objectMap, "dateTimeBegin", w.DateTimeBegin) + populateTimeRFC3339(objectMap, "dateTimeEnd", w.DateTimeEnd) populate(objectMap, "groups", w.Groups) return json.Marshal(objectMap) } @@ -5740,14 +5774,10 @@ func (w *WafRankingsResponse) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.Data) delete(rawMsg, key) case "dateTimeBegin": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.DateTimeBegin = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.DateTimeBegin) delete(rawMsg, key) case "dateTimeEnd": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.DateTimeEnd = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.DateTimeEnd) delete(rawMsg, key) case "groups": err = unpopulate(val, &w.Groups) diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_operations_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_operations_client.go index 736633755995..2470d93f848d 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_operations_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_operations_client.go @@ -11,7 +11,9 @@ package armcdn import ( "context" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available CDN REST API operations. @@ -61,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationsListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_origingroups_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_origingroups_client.go index 197e9068a543..43f5f2b13638 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_origingroups_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_origingroups_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type OriginGroupsClient struct { } // NewOriginGroupsClient creates a new instance of OriginGroupsClient with the specified values. -func NewOriginGroupsClient(con *arm.Connection, subscriptionID string) *OriginGroupsClient { - return &OriginGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewOriginGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OriginGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OriginGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new origin group within the specified endpoint. @@ -257,7 +265,7 @@ func (client *OriginGroupsClient) getCreateRequest(ctx context.Context, resource func (client *OriginGroupsClient) getHandleResponse(resp *http.Response) (OriginGroupsGetResponse, error) { result := OriginGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OriginGroup); err != nil { - return OriginGroupsGetResponse{}, err + return OriginGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -323,7 +331,7 @@ func (client *OriginGroupsClient) listByEndpointCreateRequest(ctx context.Contex func (client *OriginGroupsClient) listByEndpointHandleResponse(resp *http.Response) (OriginGroupsListByEndpointResponse, error) { result := OriginGroupsListByEndpointResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OriginGroupListResult); err != nil { - return OriginGroupsListByEndpointResponse{}, err + return OriginGroupsListByEndpointResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_origins_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_origins_client.go index 7b64fdb91bd9..51150e1ec4bc 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_origins_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_origins_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type OriginsClient struct { } // NewOriginsClient creates a new instance of OriginsClient with the specified values. -func NewOriginsClient(con *arm.Connection, subscriptionID string) *OriginsClient { - return &OriginsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewOriginsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OriginsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OriginsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new origin within the specified endpoint. @@ -257,7 +265,7 @@ func (client *OriginsClient) getCreateRequest(ctx context.Context, resourceGroup func (client *OriginsClient) getHandleResponse(resp *http.Response) (OriginsGetResponse, error) { result := OriginsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Origin); err != nil { - return OriginsGetResponse{}, err + return OriginsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -323,7 +331,7 @@ func (client *OriginsClient) listByEndpointCreateRequest(ctx context.Context, re func (client *OriginsClient) listByEndpointHandleResponse(resp *http.Response) (OriginsListByEndpointResponse, error) { result := OriginsListByEndpointResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OriginListResult); err != nil { - return OriginsListByEndpointResponse{}, err + return OriginsListByEndpointResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_policies_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_policies_client.go index 8876a0978f2b..7115701d8469 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_policies_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_policies_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type PoliciesClient struct { } // NewPoliciesClient creates a new instance of PoliciesClient with the specified values. -func NewPoliciesClient(con *arm.Connection, subscriptionID string) *PoliciesClient { - return &PoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update policy with specified rule set name within a resource group. @@ -211,7 +219,7 @@ func (client *PoliciesClient) getCreateRequest(ctx context.Context, resourceGrou func (client *PoliciesClient) getHandleResponse(resp *http.Response) (PoliciesGetResponse, error) { result := PoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CdnWebApplicationFirewallPolicy); err != nil { - return PoliciesGetResponse{}, err + return PoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -269,7 +277,7 @@ func (client *PoliciesClient) listCreateRequest(ctx context.Context, resourceGro func (client *PoliciesClient) listHandleResponse(resp *http.Response) (PoliciesListResponse, error) { result := PoliciesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CdnWebApplicationFirewallPolicyList); err != nil { - return PoliciesListResponse{}, err + return PoliciesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_polymorphic_helpers.go index 91a894460ce4..ce2f69f0695a 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_polymorphic_helpers.go @@ -49,6 +49,25 @@ func unmarshalCustomDomainHTTPSParametersClassificationArray(rawMsg json.RawMess return fArray, nil } +func unmarshalCustomDomainHTTPSParametersClassificationMap(rawMsg json.RawMessage) (map[string]CustomDomainHTTPSParametersClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]CustomDomainHTTPSParametersClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalCustomDomainHTTPSParametersClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalDeliveryRuleActionAutoGeneratedClassification(rawMsg json.RawMessage) (DeliveryRuleActionAutoGeneratedClassification, error) { if rawMsg == nil { return nil, nil @@ -100,6 +119,25 @@ func unmarshalDeliveryRuleActionAutoGeneratedClassificationArray(rawMsg json.Raw return fArray, nil } +func unmarshalDeliveryRuleActionAutoGeneratedClassificationMap(rawMsg json.RawMessage) (map[string]DeliveryRuleActionAutoGeneratedClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]DeliveryRuleActionAutoGeneratedClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalDeliveryRuleActionAutoGeneratedClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalDeliveryRuleConditionClassification(rawMsg json.RawMessage) (DeliveryRuleConditionClassification, error) { if rawMsg == nil { return nil, nil @@ -163,6 +201,25 @@ func unmarshalDeliveryRuleConditionClassificationArray(rawMsg json.RawMessage) ( return fArray, nil } +func unmarshalDeliveryRuleConditionClassificationMap(rawMsg json.RawMessage) (map[string]DeliveryRuleConditionClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]DeliveryRuleConditionClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalDeliveryRuleConditionClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalSecretParametersClassification(rawMsg json.RawMessage) (SecretParametersClassification, error) { if rawMsg == nil { return nil, nil @@ -204,6 +261,25 @@ func unmarshalSecretParametersClassificationArray(rawMsg json.RawMessage) ([]Sec return fArray, nil } +func unmarshalSecretParametersClassificationMap(rawMsg json.RawMessage) (map[string]SecretParametersClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]SecretParametersClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalSecretParametersClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalSecurityPolicyParametersClassification(rawMsg json.RawMessage) (SecurityPolicyParametersClassification, error) { if rawMsg == nil { return nil, nil @@ -240,3 +316,22 @@ func unmarshalSecurityPolicyParametersClassificationArray(rawMsg json.RawMessage } return fArray, nil } + +func unmarshalSecurityPolicyParametersClassificationMap(rawMsg json.RawMessage) (map[string]SecurityPolicyParametersClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]SecurityPolicyParametersClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalSecurityPolicyParametersClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_profiles_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_profiles_client.go index 358d555d751c..5e55fccb46d8 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_profiles_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_profiles_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type ProfilesClient struct { } // NewProfilesClient creates a new instance of ProfilesClient with the specified values. -func NewProfilesClient(con *arm.Connection, subscriptionID string) *ProfilesClient { - return &ProfilesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ProfilesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ProfilesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new CDN profile with a profile name under the specified subscription and resource group. @@ -238,7 +246,7 @@ func (client *ProfilesClient) generateSsoURICreateRequest(ctx context.Context, r func (client *ProfilesClient) generateSsoURIHandleResponse(resp *http.Response) (ProfilesGenerateSsoURIResponse, error) { result := ProfilesGenerateSsoURIResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SsoURI); err != nil { - return ProfilesGenerateSsoURIResponse{}, err + return ProfilesGenerateSsoURIResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -303,7 +311,7 @@ func (client *ProfilesClient) getCreateRequest(ctx context.Context, resourceGrou func (client *ProfilesClient) getHandleResponse(resp *http.Response) (ProfilesGetResponse, error) { result := ProfilesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Profile); err != nil { - return ProfilesGetResponse{}, err + return ProfilesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -357,7 +365,7 @@ func (client *ProfilesClient) listCreateRequest(ctx context.Context, options *Pr func (client *ProfilesClient) listHandleResponse(resp *http.Response) (ProfilesListResponse, error) { result := ProfilesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProfileListResult); err != nil { - return ProfilesListResponse{}, err + return ProfilesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -415,7 +423,7 @@ func (client *ProfilesClient) listByResourceGroupCreateRequest(ctx context.Conte func (client *ProfilesClient) listByResourceGroupHandleResponse(resp *http.Response) (ProfilesListByResourceGroupResponse, error) { result := ProfilesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProfileListResult); err != nil { - return ProfilesListByResourceGroupResponse{}, err + return ProfilesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -477,7 +485,7 @@ func (client *ProfilesClient) listResourceUsageCreateRequest(ctx context.Context func (client *ProfilesClient) listResourceUsageHandleResponse(resp *http.Response) (ProfilesListResourceUsageResponse, error) { result := ProfilesListResourceUsageResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceUsageListResult); err != nil { - return ProfilesListResourceUsageResponse{}, err + return ProfilesListResourceUsageResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -543,7 +551,7 @@ func (client *ProfilesClient) listSupportedOptimizationTypesCreateRequest(ctx co func (client *ProfilesClient) listSupportedOptimizationTypesHandleResponse(resp *http.Response) (ProfilesListSupportedOptimizationTypesResponse, error) { result := ProfilesListSupportedOptimizationTypesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SupportedOptimizationTypesListResult); err != nil { - return ProfilesListSupportedOptimizationTypesResponse{}, err + return ProfilesListSupportedOptimizationTypesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_resourceusage_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_resourceusage_client.go index bfe8d2dd8649..fd6853e8982b 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_resourceusage_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_resourceusage_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -29,8 +31,15 @@ type ResourceUsageClient struct { } // NewResourceUsageClient creates a new instance of ResourceUsageClient with the specified values. -func NewResourceUsageClient(con *arm.Connection, subscriptionID string) *ResourceUsageClient { - return &ResourceUsageClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewResourceUsageClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ResourceUsageClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ResourceUsageClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Check the quota and actual usage of the CDN profiles under the given subscription. @@ -69,7 +78,7 @@ func (client *ResourceUsageClient) listCreateRequest(ctx context.Context, option func (client *ResourceUsageClient) listHandleResponse(resp *http.Response) (ResourceUsageListResponse, error) { result := ResourceUsageListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceUsageListResult); err != nil { - return ResourceUsageListResponse{}, err + return ResourceUsageListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_response_types.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_response_types.go index eb3ee98ce8d6..fc81bda5a91f 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_response_types.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_response_types.go @@ -25,6 +25,8 @@ type AFDCustomDomainsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AFDCustomDomainsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AFDCustomDomainsCreateResponse, error) { respType := AFDCustomDomainsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AFDDomain) @@ -75,6 +77,8 @@ type AFDCustomDomainsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AFDCustomDomainsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AFDCustomDomainsDeleteResponse, error) { respType := AFDCustomDomainsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -143,6 +147,8 @@ type AFDCustomDomainsRefreshValidationTokenPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AFDCustomDomainsRefreshValidationTokenPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AFDCustomDomainsRefreshValidationTokenResponse, error) { respType := AFDCustomDomainsRefreshValidationTokenResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ValidationToken) @@ -193,6 +199,8 @@ type AFDCustomDomainsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AFDCustomDomainsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AFDCustomDomainsUpdateResponse, error) { respType := AFDCustomDomainsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AFDDomain) @@ -243,6 +251,8 @@ type AFDEndpointsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AFDEndpointsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AFDEndpointsCreateResponse, error) { respType := AFDEndpointsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AFDEndpoint) @@ -293,6 +303,8 @@ type AFDEndpointsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AFDEndpointsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AFDEndpointsDeleteResponse, error) { respType := AFDEndpointsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -373,6 +385,8 @@ type AFDEndpointsPurgeContentPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AFDEndpointsPurgeContentPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AFDEndpointsPurgeContentResponse, error) { respType := AFDEndpointsPurgeContentResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -417,6 +431,8 @@ type AFDEndpointsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AFDEndpointsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AFDEndpointsUpdateResponse, error) { respType := AFDEndpointsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AFDEndpoint) @@ -479,6 +495,8 @@ type AFDOriginGroupsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AFDOriginGroupsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AFDOriginGroupsCreateResponse, error) { respType := AFDOriginGroupsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AFDOriginGroup) @@ -529,6 +547,8 @@ type AFDOriginGroupsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AFDOriginGroupsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AFDOriginGroupsDeleteResponse, error) { respType := AFDOriginGroupsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -609,6 +629,8 @@ type AFDOriginGroupsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AFDOriginGroupsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AFDOriginGroupsUpdateResponse, error) { respType := AFDOriginGroupsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AFDOriginGroup) @@ -659,6 +681,8 @@ type AFDOriginsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AFDOriginsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AFDOriginsCreateResponse, error) { respType := AFDOriginsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AFDOrigin) @@ -709,6 +733,8 @@ type AFDOriginsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AFDOriginsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AFDOriginsDeleteResponse, error) { respType := AFDOriginsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -777,6 +803,8 @@ type AFDOriginsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AFDOriginsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AFDOriginsUpdateResponse, error) { respType := AFDOriginsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AFDOrigin) @@ -887,6 +915,8 @@ type CustomDomainsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CustomDomainsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CustomDomainsCreateResponse, error) { respType := CustomDomainsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CustomDomain) @@ -937,6 +967,8 @@ type CustomDomainsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CustomDomainsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CustomDomainsDeleteResponse, error) { respType := CustomDomainsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CustomDomain) @@ -987,6 +1019,8 @@ type CustomDomainsDisableCustomHTTPSPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CustomDomainsDisableCustomHTTPSPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CustomDomainsDisableCustomHTTPSResponse, error) { respType := CustomDomainsDisableCustomHTTPSResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CustomDomain) @@ -1037,6 +1071,8 @@ type CustomDomainsEnableCustomHTTPSPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CustomDomainsEnableCustomHTTPSPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CustomDomainsEnableCustomHTTPSResponse, error) { respType := CustomDomainsEnableCustomHTTPSResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CustomDomain) @@ -1123,6 +1159,8 @@ type EndpointsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l EndpointsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (EndpointsCreateResponse, error) { respType := EndpointsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Endpoint) @@ -1173,6 +1211,8 @@ type EndpointsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l EndpointsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (EndpointsDeleteResponse, error) { respType := EndpointsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1253,6 +1293,8 @@ type EndpointsLoadContentPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l EndpointsLoadContentPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (EndpointsLoadContentResponse, error) { respType := EndpointsLoadContentResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1297,6 +1339,8 @@ type EndpointsPurgeContentPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l EndpointsPurgeContentPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (EndpointsPurgeContentResponse, error) { respType := EndpointsPurgeContentResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1341,6 +1385,8 @@ type EndpointsStartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l EndpointsStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (EndpointsStartResponse, error) { respType := EndpointsStartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Endpoint) @@ -1391,6 +1437,8 @@ type EndpointsStopPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l EndpointsStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (EndpointsStopResponse, error) { respType := EndpointsStopResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Endpoint) @@ -1441,6 +1489,8 @@ type EndpointsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l EndpointsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (EndpointsUpdateResponse, error) { respType := EndpointsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Endpoint) @@ -1599,6 +1649,8 @@ type OriginGroupsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l OriginGroupsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (OriginGroupsCreateResponse, error) { respType := OriginGroupsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.OriginGroup) @@ -1649,6 +1701,8 @@ type OriginGroupsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l OriginGroupsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (OriginGroupsDeleteResponse, error) { respType := OriginGroupsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1717,6 +1771,8 @@ type OriginGroupsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l OriginGroupsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (OriginGroupsUpdateResponse, error) { respType := OriginGroupsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.OriginGroup) @@ -1767,6 +1823,8 @@ type OriginsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l OriginsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (OriginsCreateResponse, error) { respType := OriginsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Origin) @@ -1817,6 +1875,8 @@ type OriginsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l OriginsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (OriginsDeleteResponse, error) { respType := OriginsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1885,6 +1945,8 @@ type OriginsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l OriginsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (OriginsUpdateResponse, error) { respType := OriginsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Origin) @@ -1935,6 +1997,8 @@ type PoliciesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PoliciesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PoliciesCreateOrUpdateResponse, error) { respType := PoliciesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CdnWebApplicationFirewallPolicy) @@ -2015,6 +2079,8 @@ type PoliciesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PoliciesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PoliciesUpdateResponse, error) { respType := PoliciesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CdnWebApplicationFirewallPolicy) @@ -2065,6 +2131,8 @@ type ProfilesCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ProfilesCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ProfilesCreateResponse, error) { respType := ProfilesCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Profile) @@ -2115,6 +2183,8 @@ type ProfilesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ProfilesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ProfilesDeleteResponse, error) { respType := ProfilesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2231,6 +2301,8 @@ type ProfilesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ProfilesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ProfilesUpdateResponse, error) { respType := ProfilesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Profile) @@ -2293,6 +2365,8 @@ type RoutesCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RoutesCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RoutesCreateResponse, error) { respType := RoutesCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Route) @@ -2343,6 +2417,8 @@ type RoutesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RoutesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RoutesDeleteResponse, error) { respType := RoutesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2411,6 +2487,8 @@ type RoutesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RoutesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RoutesUpdateResponse, error) { respType := RoutesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Route) @@ -2461,6 +2539,8 @@ type RuleSetsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RuleSetsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RuleSetsCreateResponse, error) { respType := RuleSetsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RuleSet) @@ -2511,6 +2591,8 @@ type RuleSetsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RuleSetsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RuleSetsDeleteResponse, error) { respType := RuleSetsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2591,6 +2673,8 @@ type RulesCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RulesCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RulesCreateResponse, error) { respType := RulesCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Rule) @@ -2641,6 +2725,8 @@ type RulesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RulesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RulesDeleteResponse, error) { respType := RulesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2709,6 +2795,8 @@ type RulesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RulesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RulesUpdateResponse, error) { respType := RulesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Rule) @@ -2759,6 +2847,8 @@ type SecretsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SecretsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SecretsCreateResponse, error) { respType := SecretsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Secret) @@ -2809,6 +2899,8 @@ type SecretsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SecretsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SecretsDeleteResponse, error) { respType := SecretsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2877,6 +2969,8 @@ type SecretsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SecretsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SecretsUpdateResponse, error) { respType := SecretsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Secret) @@ -2927,6 +3021,8 @@ type SecurityPoliciesCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SecurityPoliciesCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SecurityPoliciesCreateResponse, error) { respType := SecurityPoliciesCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SecurityPolicy) @@ -2977,6 +3073,8 @@ type SecurityPoliciesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SecurityPoliciesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SecurityPoliciesDeleteResponse, error) { respType := SecurityPoliciesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3045,6 +3143,8 @@ type SecurityPoliciesPatchPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SecurityPoliciesPatchPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SecurityPoliciesPatchResponse, error) { respType := SecurityPoliciesPatchResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SecurityPolicy) diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_routes_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_routes_client.go index fd9487145fee..37a9270f0ea3 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_routes_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_routes_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type RoutesClient struct { } // NewRoutesClient creates a new instance of RoutesClient with the specified values. -func NewRoutesClient(con *arm.Connection, subscriptionID string) *RoutesClient { - return &RoutesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRoutesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RoutesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RoutesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new route with the specified route name under the specified subscription, resource group, profile, and AzureFrontDoor endpoint. @@ -257,7 +265,7 @@ func (client *RoutesClient) getCreateRequest(ctx context.Context, resourceGroupN func (client *RoutesClient) getHandleResponse(resp *http.Response) (RoutesGetResponse, error) { result := RoutesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Route); err != nil { - return RoutesGetResponse{}, err + return RoutesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -323,7 +331,7 @@ func (client *RoutesClient) listByEndpointCreateRequest(ctx context.Context, res func (client *RoutesClient) listByEndpointHandleResponse(resp *http.Response) (RoutesListByEndpointResponse, error) { result := RoutesListByEndpointResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RouteListResult); err != nil { - return RoutesListByEndpointResponse{}, err + return RoutesListByEndpointResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_rules_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_rules_client.go index bfe4a7dfaa34..59616b5d93ca 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_rules_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_rules_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type RulesClient struct { } // NewRulesClient creates a new instance of RulesClient with the specified values. -func NewRulesClient(con *arm.Connection, subscriptionID string) *RulesClient { - return &RulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new delivery rule within the specified rule set. @@ -257,7 +265,7 @@ func (client *RulesClient) getCreateRequest(ctx context.Context, resourceGroupNa func (client *RulesClient) getHandleResponse(resp *http.Response) (RulesGetResponse, error) { result := RulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Rule); err != nil { - return RulesGetResponse{}, err + return RulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -323,7 +331,7 @@ func (client *RulesClient) listByRuleSetCreateRequest(ctx context.Context, resou func (client *RulesClient) listByRuleSetHandleResponse(resp *http.Response) (RulesListByRuleSetResponse, error) { result := RulesListByRuleSetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RuleListResult); err != nil { - return RulesListByRuleSetResponse{}, err + return RulesListByRuleSetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_rulesets_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_rulesets_client.go index 91f8c6990ecb..4b16c58d7e4b 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_rulesets_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_rulesets_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type RuleSetsClient struct { } // NewRuleSetsClient creates a new instance of RuleSetsClient with the specified values. -func NewRuleSetsClient(con *arm.Connection, subscriptionID string) *RuleSetsClient { - return &RuleSetsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRuleSetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RuleSetsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RuleSetsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new rule set within the specified profile. @@ -245,7 +253,7 @@ func (client *RuleSetsClient) getCreateRequest(ctx context.Context, resourceGrou func (client *RuleSetsClient) getHandleResponse(resp *http.Response) (RuleSetsGetResponse, error) { result := RuleSetsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RuleSet); err != nil { - return RuleSetsGetResponse{}, err + return RuleSetsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -307,7 +315,7 @@ func (client *RuleSetsClient) listByProfileCreateRequest(ctx context.Context, re func (client *RuleSetsClient) listByProfileHandleResponse(resp *http.Response) (RuleSetsListByProfileResponse, error) { result := RuleSetsListByProfileResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RuleSetListResult); err != nil { - return RuleSetsListByProfileResponse{}, err + return RuleSetsListByProfileResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -373,7 +381,7 @@ func (client *RuleSetsClient) listResourceUsageCreateRequest(ctx context.Context func (client *RuleSetsClient) listResourceUsageHandleResponse(resp *http.Response) (RuleSetsListResourceUsageResponse, error) { result := RuleSetsListResourceUsageResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UsagesListResult); err != nil { - return RuleSetsListResourceUsageResponse{}, err + return RuleSetsListResourceUsageResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_secrets_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_secrets_client.go index 054f5a6bb6da..9e2744f58986 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_secrets_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_secrets_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type SecretsClient struct { } // NewSecretsClient creates a new instance of SecretsClient with the specified values. -func NewSecretsClient(con *arm.Connection, subscriptionID string) *SecretsClient { - return &SecretsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSecretsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SecretsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SecretsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new Secret within the specified profile. @@ -245,7 +253,7 @@ func (client *SecretsClient) getCreateRequest(ctx context.Context, resourceGroup func (client *SecretsClient) getHandleResponse(resp *http.Response) (SecretsGetResponse, error) { result := SecretsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Secret); err != nil { - return SecretsGetResponse{}, err + return SecretsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -307,7 +315,7 @@ func (client *SecretsClient) listByProfileCreateRequest(ctx context.Context, res func (client *SecretsClient) listByProfileHandleResponse(resp *http.Response) (SecretsListByProfileResponse, error) { result := SecretsListByProfileResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecretListResult); err != nil { - return SecretsListByProfileResponse{}, err + return SecretsListByProfileResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_securitypolicies_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_securitypolicies_client.go index 0f21c86838ac..1c96734c4bae 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_securitypolicies_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_securitypolicies_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type SecurityPoliciesClient struct { } // NewSecurityPoliciesClient creates a new instance of SecurityPoliciesClient with the specified values. -func NewSecurityPoliciesClient(con *arm.Connection, subscriptionID string) *SecurityPoliciesClient { - return &SecurityPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSecurityPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SecurityPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SecurityPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new security policy within the specified profile. @@ -245,7 +253,7 @@ func (client *SecurityPoliciesClient) getCreateRequest(ctx context.Context, reso func (client *SecurityPoliciesClient) getHandleResponse(resp *http.Response) (SecurityPoliciesGetResponse, error) { result := SecurityPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityPolicy); err != nil { - return SecurityPoliciesGetResponse{}, err + return SecurityPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -307,7 +315,7 @@ func (client *SecurityPoliciesClient) listByProfileCreateRequest(ctx context.Con func (client *SecurityPoliciesClient) listByProfileHandleResponse(resp *http.Response) (SecurityPoliciesListByProfileResponse, error) { result := SecurityPoliciesListByProfileResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityPolicyListResult); err != nil { - return SecurityPoliciesListByProfileResponse{}, err + return SecurityPoliciesListByProfileResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_time_rfc3339.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_time_rfc3339.go index 7ab03e78fa61..43610662a4e1 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armcdn import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/cdn/armcdn/zz_generated_validate_client.go b/sdk/resourcemanager/cdn/armcdn/zz_generated_validate_client.go index e95373f71d8f..dddb1d4d07dd 100644 --- a/sdk/resourcemanager/cdn/armcdn/zz_generated_validate_client.go +++ b/sdk/resourcemanager/cdn/armcdn/zz_generated_validate_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -29,8 +31,15 @@ type ValidateClient struct { } // NewValidateClient creates a new instance of ValidateClient with the specified values. -func NewValidateClient(con *arm.Connection, subscriptionID string) *ValidateClient { - return &ValidateClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewValidateClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ValidateClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ValidateClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Secret - Validate a Secret in the profile. @@ -72,7 +81,7 @@ func (client *ValidateClient) secretCreateRequest(ctx context.Context, validateS func (client *ValidateClient) secretHandleResponse(resp *http.Response) (ValidateSecretResponse, error) { result := ValidateSecretResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ValidateSecretOutput); err != nil { - return ValidateSecretResponse{}, err + return ValidateSecretResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md index e4f3d9f035c1..6ee9f3587c1a 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-26) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/README.md b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/README.md index 56ee86537c2b..0aa32e0394fc 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/README.md +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Cognitive Services +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Cognitive Services modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armcognitiveservices.NewResourceSKUsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Cognitive Services modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armcognitiveservices.NewResourceSKUsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armcognitiveservices.NewResourceSKUsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/autorest.md b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/autorest.md index dad8cdf5c096..8e85a773159a 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/autorest.md +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/762ca1046eedf2b2dba28784dd4aebffab2a9897/specification/cognitiveservices/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/762ca1046eedf2b2dba28784dd4aebffab2a9897/specification/cognitiveservices/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/cognitiveservices/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/cognitiveservices/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.mod b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.mod index 7ecf7161507b..11ddc8afccb1 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.mod +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cognitiveservices/a go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.2.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum index c8ff7a2143ad..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible h1:iCb2tuoEm3N7ZpUDOvu1Yxl1B3iOVDmaD6weaRuIPzs= -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_accounts_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_accounts_client.go index bf9d076cdaf1..6fce4cc399ea 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_accounts_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_accounts_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AccountsClient contains the methods for the Accounts group. @@ -31,8 +31,15 @@ type AccountsClient struct { } // NewAccountsClient creates a new instance of AccountsClient with the specified values. -func NewAccountsClient(con *arm.Connection, subscriptionID string) *AccountsClient { - return &AccountsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AccountsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AccountsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Create Cognitive Services Account. Accounts is a resource group wide resource type. It holds the keys for developer to access intelligent @@ -236,7 +243,7 @@ func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGrou func (client *AccountsClient) getHandleResponse(resp *http.Response) (AccountsGetResponse, error) { result := AccountsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Account); err != nil { - return AccountsGetResponse{}, err + return AccountsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -290,7 +297,7 @@ func (client *AccountsClient) listCreateRequest(ctx context.Context, options *Ac func (client *AccountsClient) listHandleResponse(resp *http.Response) (AccountsListResponse, error) { result := AccountsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccountListResult); err != nil { - return AccountsListResponse{}, err + return AccountsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -348,7 +355,7 @@ func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Conte func (client *AccountsClient) listByResourceGroupHandleResponse(resp *http.Response) (AccountsListByResourceGroupResponse, error) { result := AccountsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccountListResult); err != nil { - return AccountsListByResourceGroupResponse{}, err + return AccountsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -413,7 +420,7 @@ func (client *AccountsClient) listKeysCreateRequest(ctx context.Context, resourc func (client *AccountsClient) listKeysHandleResponse(resp *http.Response) (AccountsListKeysResponse, error) { result := AccountsListKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIKeys); err != nil { - return AccountsListKeysResponse{}, err + return AccountsListKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -478,7 +485,7 @@ func (client *AccountsClient) listSKUsCreateRequest(ctx context.Context, resourc func (client *AccountsClient) listSKUsHandleResponse(resp *http.Response) (AccountsListSKUsResponse, error) { result := AccountsListSKUsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccountSKUListResult); err != nil { - return AccountsListSKUsResponse{}, err + return AccountsListSKUsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -546,7 +553,7 @@ func (client *AccountsClient) listUsagesCreateRequest(ctx context.Context, resou func (client *AccountsClient) listUsagesHandleResponse(resp *http.Response) (AccountsListUsagesResponse, error) { result := AccountsListUsagesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UsageListResult); err != nil { - return AccountsListUsagesResponse{}, err + return AccountsListUsagesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -611,7 +618,7 @@ func (client *AccountsClient) regenerateKeyCreateRequest(ctx context.Context, re func (client *AccountsClient) regenerateKeyHandleResponse(resp *http.Response) (AccountsRegenerateKeyResponse, error) { result := AccountsRegenerateKeyResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIKeys); err != nil { - return AccountsRegenerateKeyResponse{}, err + return AccountsRegenerateKeyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_cognitiveservicesmanagementclient_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_cognitiveservicesmanagementclient_client.go index 655168c11edd..c70ed01c0da2 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_cognitiveservicesmanagementclient_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_cognitiveservicesmanagementclient_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CognitiveServicesManagementClient contains the methods for the CognitiveServicesManagementClient group. @@ -30,8 +31,15 @@ type CognitiveServicesManagementClient struct { } // NewCognitiveServicesManagementClient creates a new instance of CognitiveServicesManagementClient with the specified values. -func NewCognitiveServicesManagementClient(con *arm.Connection, subscriptionID string) *CognitiveServicesManagementClient { - return &CognitiveServicesManagementClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCognitiveServicesManagementClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CognitiveServicesManagementClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CognitiveServicesManagementClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckDomainAvailability - Check whether a domain is available. @@ -73,7 +81,7 @@ func (client *CognitiveServicesManagementClient) checkDomainAvailabilityCreateRe func (client *CognitiveServicesManagementClient) checkDomainAvailabilityHandleResponse(resp *http.Response) (CognitiveServicesManagementClientCheckDomainAvailabilityResponse, error) { result := CognitiveServicesManagementClientCheckDomainAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DomainAvailability); err != nil { - return CognitiveServicesManagementClientCheckDomainAvailabilityResponse{}, err + return CognitiveServicesManagementClientCheckDomainAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -134,7 +142,7 @@ func (client *CognitiveServicesManagementClient) checkSKUAvailabilityCreateReque func (client *CognitiveServicesManagementClient) checkSKUAvailabilityHandleResponse(resp *http.Response) (CognitiveServicesManagementClientCheckSKUAvailabilityResponse, error) { result := CognitiveServicesManagementClientCheckSKUAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SKUAvailabilityListResult); err != nil { - return CognitiveServicesManagementClientCheckSKUAvailabilityResponse{}, err + return CognitiveServicesManagementClientCheckSKUAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_constants.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_constants.go index 5dc939f987b3..246ec7aca896 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_constants.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_constants.go @@ -10,7 +10,7 @@ package armcognitiveservices const ( module = "armcognitiveservices" - version = "v0.1.1" + version = "v0.2.0" ) // ActionType - Enum. Indicates the action type. "Internal" refers to actions that are for internal only APIs. diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_deletedaccounts_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_deletedaccounts_client.go index a2d192e3fc48..f35fc8e8a4f4 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_deletedaccounts_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_deletedaccounts_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DeletedAccountsClient contains the methods for the DeletedAccounts group. @@ -31,8 +31,15 @@ type DeletedAccountsClient struct { } // NewDeletedAccountsClient creates a new instance of DeletedAccountsClient with the specified values. -func NewDeletedAccountsClient(con *arm.Connection, subscriptionID string) *DeletedAccountsClient { - return &DeletedAccountsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDeletedAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DeletedAccountsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DeletedAccountsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Returns a Cognitive Services account specified by the parameters. @@ -86,7 +93,7 @@ func (client *DeletedAccountsClient) getCreateRequest(ctx context.Context, locat func (client *DeletedAccountsClient) getHandleResponse(resp *http.Response) (DeletedAccountsGetResponse, error) { result := DeletedAccountsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Account); err != nil { - return DeletedAccountsGetResponse{}, err + return DeletedAccountsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -140,7 +147,7 @@ func (client *DeletedAccountsClient) listCreateRequest(ctx context.Context, opti func (client *DeletedAccountsClient) listHandleResponse(resp *http.Response) (DeletedAccountsListResponse, error) { result := DeletedAccountsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccountListResult); err != nil { - return DeletedAccountsListResponse{}, err + return DeletedAccountsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_models.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_models.go index a62c0168f3c7..f6772fc7470d 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_models.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_models.go @@ -10,10 +10,9 @@ package armcognitiveservices import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // APIKeys - The access keys for the cognitive services account. @@ -1064,10 +1063,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -1083,9 +1082,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -1094,9 +1091,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_operations_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_operations_client.go index b153e5f5288c..90cac6725565 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_operations_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armcognitiveservices import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all the available Cognitive Services account operations. @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_pagers.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_pagers.go index 73b8bc6d6f1f..7388574254fb 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_pagers.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armcognitiveservices import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // AccountsListByResourceGroupPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_pollers.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_pollers.go index bb1f7f6fbf93..69d7b3dfe8b8 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_pollers.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armcognitiveservices import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // AccountsCreatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_privateendpointconnections_client.go index 8899e266bf13..8036132dcbe9 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_privateendpointconnections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. @@ -31,8 +31,15 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { - return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Update the state of specified private endpoint connection associated with the Cognitive Services account. @@ -246,7 +253,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsGetResponse{}, err + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -311,7 +318,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListResponse, error) { result := PrivateEndpointConnectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionsListResponse{}, err + return PrivateEndpointConnectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_privatelinkresources_client.go index 0f90dc208383..c380f341f09e 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_privatelinkresources_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. @@ -30,8 +31,15 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { - return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets the private link resources that need to be created for a Cognitive Services account. @@ -81,7 +89,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, func (client *PrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (PrivateLinkResourcesListResponse, error) { result := PrivateLinkResourcesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { - return PrivateLinkResourcesListResponse{}, err + return PrivateLinkResourcesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_resourceskus_client.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_resourceskus_client.go index 49f428a17a10..76045142937a 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_resourceskus_client.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_resourceskus_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ResourceSKUsClient contains the methods for the ResourceSKUs group. @@ -30,8 +31,15 @@ type ResourceSKUsClient struct { } // NewResourceSKUsClient creates a new instance of ResourceSKUsClient with the specified values. -func NewResourceSKUsClient(con *arm.Connection, subscriptionID string) *ResourceSKUsClient { - return &ResourceSKUsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewResourceSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ResourceSKUsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ResourceSKUsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets the list of Microsoft.CognitiveServices SKUs available for your Subscription. @@ -70,7 +78,7 @@ func (client *ResourceSKUsClient) listCreateRequest(ctx context.Context, options func (client *ResourceSKUsClient) listHandleResponse(resp *http.Response) (ResourceSKUsListResponse, error) { result := ResourceSKUsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceSKUListResult); err != nil { - return ResourceSKUsListResponse{}, err + return ResourceSKUsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_response_types.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_response_types.go index aa0f6a05b1b8..e7bb7249835b 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_response_types.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armcognitiveservices import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // AccountsCreatePollerResponse contains the response from method Accounts.Create. @@ -26,6 +25,8 @@ type AccountsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AccountsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountsCreateResponse, error) { respType := AccountsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Account) @@ -76,6 +77,8 @@ type AccountsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AccountsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountsDeleteResponse, error) { respType := AccountsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -204,6 +207,8 @@ type AccountsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AccountsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountsUpdateResponse, error) { respType := AccountsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Account) @@ -302,6 +307,8 @@ type DeletedAccountsPurgePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeletedAccountsPurgePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeletedAccountsPurgeResponse, error) { respType := DeletedAccountsPurgeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -358,6 +365,8 @@ type PrivateEndpointConnectionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsCreateOrUpdateResponse, error) { respType := PrivateEndpointConnectionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) @@ -408,6 +417,8 @@ type PrivateEndpointConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsDeleteResponse, error) { respType := PrivateEndpointConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_time_rfc3339.go b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_time_rfc3339.go index f25a0f5022ef..f769601e4edf 100644 --- a/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/cognitiveservices/armcognitiveservices/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armcognitiveservices import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/compute/armcompute/CHANGELOG.md b/sdk/resourcemanager/compute/armcompute/CHANGELOG.md index b885d556c626..f728a4fd4d16 100644 --- a/sdk/resourcemanager/compute/armcompute/CHANGELOG.md +++ b/sdk/resourcemanager/compute/armcompute/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-09-29) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/compute/armcompute") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/compute/armcompute/README.md b/sdk/resourcemanager/compute/armcompute/README.md index 927781d2b420..5e31866782c8 100644 --- a/sdk/resourcemanager/compute/armcompute/README.md +++ b/sdk/resourcemanager/compute/armcompute/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Compute +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Compute modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armcompute.NewLogAnalyticsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Compute modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armcompute.NewLogAnalyticsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armcompute.NewLogAnalyticsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/compute/armcompute/autorest.md b/sdk/resourcemanager/compute/armcompute/autorest.md index 90249875c559..d483f76acec6 100644 --- a/sdk/resourcemanager/compute/armcompute/autorest.md +++ b/sdk/resourcemanager/compute/armcompute/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7919a8694f46cea4259ea5b62b1e797573175e16/specification/compute/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7919a8694f46cea4259ea5b62b1e797573175e16/specification/compute/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/compute/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/compute/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/compute/armcompute/example_availabilitysets_test.go b/sdk/resourcemanager/compute/armcompute/example_availabilitysets_test.go index 66a8b283698b..ac7aa0c332ce 100644 --- a/sdk/resourcemanager/compute/armcompute/example_availabilitysets_test.go +++ b/sdk/resourcemanager/compute/armcompute/example_availabilitysets_test.go @@ -10,7 +10,6 @@ import ( "context" "log" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" @@ -21,7 +20,7 @@ func ExampleAvailabilitySetsClient_CreateOrUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewAvailabilitySetsClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewAvailabilitySetsClient("", cred, nil) resp, err := client.CreateOrUpdate( context.Background(), "", @@ -52,7 +51,7 @@ func ExampleAvailabilitySetsClient_Get() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewAvailabilitySetsClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewAvailabilitySetsClient("", cred, nil) resp, err := client.Get(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) diff --git a/sdk/resourcemanager/compute/armcompute/example_disks_test.go b/sdk/resourcemanager/compute/armcompute/example_disks_test.go index 4ccf65198cb0..0176b2782354 100644 --- a/sdk/resourcemanager/compute/armcompute/example_disks_test.go +++ b/sdk/resourcemanager/compute/armcompute/example_disks_test.go @@ -11,7 +11,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" @@ -22,7 +21,7 @@ func ExampleDisksClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewDisksClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewDisksClient("", cred, nil) poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -56,7 +55,7 @@ func ExampleDisksClient_Get() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewDisksClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewDisksClient("", cred, nil) resp, err := client.Get(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) diff --git a/sdk/resourcemanager/compute/armcompute/example_virtualmachineextensions_test.go b/sdk/resourcemanager/compute/armcompute/example_virtualmachineextensions_test.go index a77014228217..6c0cf09ef940 100644 --- a/sdk/resourcemanager/compute/armcompute/example_virtualmachineextensions_test.go +++ b/sdk/resourcemanager/compute/armcompute/example_virtualmachineextensions_test.go @@ -12,7 +12,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" @@ -23,7 +22,7 @@ func ExampleVirtualMachineExtensionsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachineExtensionsClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachineExtensionsClient("", cred, nil) poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -70,7 +69,7 @@ func ExampleVirtualMachineExtensionsClient_Get() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachineExtensionsClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachineExtensionsClient("", cred, nil) resp, err := client.Get(context.Background(), "", "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) diff --git a/sdk/resourcemanager/compute/armcompute/example_virtualmachines_test.go b/sdk/resourcemanager/compute/armcompute/example_virtualmachines_test.go index cc612e514ca3..03ed5eef40a4 100644 --- a/sdk/resourcemanager/compute/armcompute/example_virtualmachines_test.go +++ b/sdk/resourcemanager/compute/armcompute/example_virtualmachines_test.go @@ -12,7 +12,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" @@ -25,7 +24,7 @@ func ExampleVirtualMachinesClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachinesClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachinesClient("", cred, nil) poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -95,7 +94,7 @@ func ExampleVirtualMachinesClient_BeginCreateOrUpdate_withDisk() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachinesClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachinesClient("", cred, nil) poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -173,7 +172,7 @@ func ExampleVirtualMachinesClient_BeginCreateOrUpdate_withLoadBalancer() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachinesClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachinesClient("", cred, nil) poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -236,7 +235,7 @@ func ExampleVirtualMachinesClient_Get() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachinesClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachinesClient("", cred, nil) resp, err := client.Get(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) @@ -249,7 +248,7 @@ func ExampleVirtualMachinesClient_BeginDeallocate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachinesClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachinesClient("", cred, nil) poller, err := client.BeginDeallocate(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) @@ -265,7 +264,7 @@ func ExampleVirtualMachinesClient_BeginUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachinesClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachinesClient("", cred, nil) poller, err := client.BeginUpdate( context.Background(), "", @@ -295,7 +294,7 @@ func ExampleVirtualMachinesClient_BeginStart() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachinesClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachinesClient("", cred, nil) poller, err := client.BeginStart( context.Background(), "", @@ -316,7 +315,7 @@ func ExampleVirtualMachinesClient_BeginRestart() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachinesClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachinesClient("", cred, nil) poller, err := client.BeginRestart( context.Background(), "", @@ -337,7 +336,7 @@ func ExampleVirtualMachinesClient_BeginPowerOff() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachinesClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachinesClient("", cred, nil) poller, err := client.BeginPowerOff( context.Background(), "", diff --git a/sdk/resourcemanager/compute/armcompute/example_virtualmachinescalesets_test.go b/sdk/resourcemanager/compute/armcompute/example_virtualmachinescalesets_test.go index 26ee3650c273..85c572b11b5b 100644 --- a/sdk/resourcemanager/compute/armcompute/example_virtualmachinescalesets_test.go +++ b/sdk/resourcemanager/compute/armcompute/example_virtualmachinescalesets_test.go @@ -12,7 +12,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute" @@ -33,7 +32,7 @@ func ExampleVirtualMachineScaleSetsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachineScaleSetsClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachineScaleSetsClient("", cred, nil) poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -121,7 +120,7 @@ func ExampleVirtualMachineScaleSetsClient_Get() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachineScaleSetsClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachineScaleSetsClient("", cred, nil) resp, err := client.Get(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) @@ -134,7 +133,7 @@ func ExampleVirtualMachineScaleSetsClient_BeginUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachineScaleSetsClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachineScaleSetsClient("", cred, nil) poller, err := client.BeginUpdate( context.Background(), "", @@ -164,7 +163,7 @@ func ExampleVirtualMachineScaleSetsClient_BeginDeallocate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachineScaleSetsClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachineScaleSetsClient("", cred, nil) poller, err := client.BeginDeallocate(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) @@ -180,7 +179,7 @@ func ExampleVirtualMachineScaleSetsClient_BeginStart() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachineScaleSetsClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachineScaleSetsClient("", cred, nil) poller, err := client.BeginStart(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) @@ -196,7 +195,7 @@ func ExampleVirtualMachineScaleSetsClient_BeginRestart() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachineScaleSetsClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachineScaleSetsClient("", cred, nil) poller, err := client.BeginRestart(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) @@ -212,7 +211,7 @@ func ExampleVirtualMachineScaleSetsClient_BeginPowerOff() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armcompute.NewVirtualMachineScaleSetsClient(arm.NewDefaultConnection(cred, nil), "") + client := armcompute.NewVirtualMachineScaleSetsClient("", cred, nil) poller, err := client.BeginPowerOff(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) diff --git a/sdk/resourcemanager/compute/armcompute/go.mod b/sdk/resourcemanager/compute/armcompute/go.mod index 9115f230ca6b..cab869387076 100644 --- a/sdk/resourcemanager/compute/armcompute/go.mod +++ b/sdk/resourcemanager/compute/armcompute/go.mod @@ -3,7 +3,9 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/compute/armcompute go 1.16 require ( - github.com/Azure/azure-sdk-for-go v57.4.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0 ) + +replace github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0 => ../../../azidentity diff --git a/sdk/resourcemanager/compute/armcompute/go.sum b/sdk/resourcemanager/compute/armcompute/go.sum index ffc329a511d0..0a36ef05b718 100644 --- a/sdk/resourcemanager/compute/armcompute/go.sum +++ b/sdk/resourcemanager/compute/armcompute/go.sum @@ -1,15 +1,13 @@ -github.com/Azure/azure-sdk-for-go v57.4.0+incompatible h1:uzhy/mTwu4rq6Be/fJJnE82PRx2A2vjGjzsA3aQ6Qu0= -github.com/Azure/azure-sdk-for-go v57.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0 h1:OYa9vmRX2XC5GXRAzeggG12sF/z5D9Ahtdm9EJ00WN4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= @@ -19,22 +17,26 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_availabilitysets_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_availabilitysets_client.go index b83978956a9a..d6a294c04865 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_availabilitysets_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_availabilitysets_client.go @@ -11,13 +11,14 @@ package armcompute import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AvailabilitySetsClient contains the methods for the AvailabilitySets group. @@ -29,8 +30,15 @@ type AvailabilitySetsClient struct { } // NewAvailabilitySetsClient creates a new instance of AvailabilitySetsClient with the specified values. -func NewAvailabilitySetsClient(con *arm.Connection, subscriptionID string) *AvailabilitySetsClient { - return &AvailabilitySetsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAvailabilitySetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AvailabilitySetsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AvailabilitySetsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update an availability set. @@ -80,7 +88,7 @@ func (client *AvailabilitySetsClient) createOrUpdateCreateRequest(ctx context.Co func (client *AvailabilitySetsClient) createOrUpdateHandleResponse(resp *http.Response) (AvailabilitySetsCreateOrUpdateResponse, error) { result := AvailabilitySetsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilitySet); err != nil { - return AvailabilitySetsCreateOrUpdateResponse{}, err + return AvailabilitySetsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -198,7 +206,7 @@ func (client *AvailabilitySetsClient) getCreateRequest(ctx context.Context, reso func (client *AvailabilitySetsClient) getHandleResponse(resp *http.Response) (AvailabilitySetsGetResponse, error) { result := AvailabilitySetsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilitySet); err != nil { - return AvailabilitySetsGetResponse{}, err + return AvailabilitySetsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -255,7 +263,7 @@ func (client *AvailabilitySetsClient) listCreateRequest(ctx context.Context, res func (client *AvailabilitySetsClient) listHandleResponse(resp *http.Response) (AvailabilitySetsListResponse, error) { result := AvailabilitySetsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilitySetListResult); err != nil { - return AvailabilitySetsListResponse{}, err + return AvailabilitySetsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -319,7 +327,7 @@ func (client *AvailabilitySetsClient) listAvailableSizesCreateRequest(ctx contex func (client *AvailabilitySetsClient) listAvailableSizesHandleResponse(resp *http.Response) (AvailabilitySetsListAvailableSizesResponse, error) { result := AvailabilitySetsListAvailableSizesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineSizeListResult); err != nil { - return AvailabilitySetsListAvailableSizesResponse{}, err + return AvailabilitySetsListAvailableSizesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -375,7 +383,7 @@ func (client *AvailabilitySetsClient) listBySubscriptionCreateRequest(ctx contex func (client *AvailabilitySetsClient) listBySubscriptionHandleResponse(resp *http.Response) (AvailabilitySetsListBySubscriptionResponse, error) { result := AvailabilitySetsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilitySetListResult); err != nil { - return AvailabilitySetsListBySubscriptionResponse{}, err + return AvailabilitySetsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -439,7 +447,7 @@ func (client *AvailabilitySetsClient) updateCreateRequest(ctx context.Context, r func (client *AvailabilitySetsClient) updateHandleResponse(resp *http.Response) (AvailabilitySetsUpdateResponse, error) { result := AvailabilitySetsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilitySet); err != nil { - return AvailabilitySetsUpdateResponse{}, err + return AvailabilitySetsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_capacityreservationgroups_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_capacityreservationgroups_client.go index e870da898f1a..8aaba8ce113c 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_capacityreservationgroups_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_capacityreservationgroups_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CapacityReservationGroupsClient contains the methods for the CapacityReservationGroups group. @@ -30,8 +31,15 @@ type CapacityReservationGroupsClient struct { } // NewCapacityReservationGroupsClient creates a new instance of CapacityReservationGroupsClient with the specified values. -func NewCapacityReservationGroupsClient(con *arm.Connection, subscriptionID string) *CapacityReservationGroupsClient { - return &CapacityReservationGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCapacityReservationGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CapacityReservationGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CapacityReservationGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - The operation to create or update a capacity reservation group. When updating a capacity reservation group, only tags may be modified. @@ -83,7 +91,7 @@ func (client *CapacityReservationGroupsClient) createOrUpdateCreateRequest(ctx c func (client *CapacityReservationGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (CapacityReservationGroupsCreateOrUpdateResponse, error) { result := CapacityReservationGroupsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationGroup); err != nil { - return CapacityReservationGroupsCreateOrUpdateResponse{}, err + return CapacityReservationGroupsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -209,7 +217,7 @@ func (client *CapacityReservationGroupsClient) getCreateRequest(ctx context.Cont func (client *CapacityReservationGroupsClient) getHandleResponse(resp *http.Response) (CapacityReservationGroupsGetResponse, error) { result := CapacityReservationGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationGroup); err != nil { - return CapacityReservationGroupsGetResponse{}, err + return CapacityReservationGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -271,7 +279,7 @@ func (client *CapacityReservationGroupsClient) listByResourceGroupCreateRequest( func (client *CapacityReservationGroupsClient) listByResourceGroupHandleResponse(resp *http.Response) (CapacityReservationGroupsListByResourceGroupResponse, error) { result := CapacityReservationGroupsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationGroupListResult); err != nil { - return CapacityReservationGroupsListByResourceGroupResponse{}, err + return CapacityReservationGroupsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -329,7 +337,7 @@ func (client *CapacityReservationGroupsClient) listBySubscriptionCreateRequest(c func (client *CapacityReservationGroupsClient) listBySubscriptionHandleResponse(resp *http.Response) (CapacityReservationGroupsListBySubscriptionResponse, error) { result := CapacityReservationGroupsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationGroupListResult); err != nil { - return CapacityReservationGroupsListBySubscriptionResponse{}, err + return CapacityReservationGroupsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -394,7 +402,7 @@ func (client *CapacityReservationGroupsClient) updateCreateRequest(ctx context.C func (client *CapacityReservationGroupsClient) updateHandleResponse(resp *http.Response) (CapacityReservationGroupsUpdateResponse, error) { result := CapacityReservationGroupsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationGroup); err != nil { - return CapacityReservationGroupsUpdateResponse{}, err + return CapacityReservationGroupsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_capacityreservations_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_capacityreservations_client.go index b58801ae5b6c..a8a90b38b8d7 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_capacityreservations_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_capacityreservations_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CapacityReservationsClient contains the methods for the CapacityReservations group. @@ -31,8 +31,15 @@ type CapacityReservationsClient struct { } // NewCapacityReservationsClient creates a new instance of CapacityReservationsClient with the specified values. -func NewCapacityReservationsClient(con *arm.Connection, subscriptionID string) *CapacityReservationsClient { - return &CapacityReservationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCapacityReservationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CapacityReservationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CapacityReservationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - The operation to create or update a capacity reservation. Please note some properties can be set only during capacity reservation @@ -257,7 +264,7 @@ func (client *CapacityReservationsClient) getCreateRequest(ctx context.Context, func (client *CapacityReservationsClient) getHandleResponse(resp *http.Response) (CapacityReservationsGetResponse, error) { result := CapacityReservationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservation); err != nil { - return CapacityReservationsGetResponse{}, err + return CapacityReservationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -320,7 +327,7 @@ func (client *CapacityReservationsClient) listByCapacityReservationGroupCreateRe func (client *CapacityReservationsClient) listByCapacityReservationGroupHandleResponse(resp *http.Response) (CapacityReservationsListByCapacityReservationGroupResponse, error) { result := CapacityReservationsListByCapacityReservationGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CapacityReservationListResult); err != nil { - return CapacityReservationsListByCapacityReservationGroupResponse{}, err + return CapacityReservationsListByCapacityReservationGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_cloudserviceoperatingsystems_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_cloudserviceoperatingsystems_client.go index 8d95295f56e0..81d37749e04c 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_cloudserviceoperatingsystems_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_cloudserviceoperatingsystems_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CloudServiceOperatingSystemsClient contains the methods for the CloudServiceOperatingSystems group. @@ -30,8 +31,15 @@ type CloudServiceOperatingSystemsClient struct { } // NewCloudServiceOperatingSystemsClient creates a new instance of CloudServiceOperatingSystemsClient with the specified values. -func NewCloudServiceOperatingSystemsClient(con *arm.Connection, subscriptionID string) *CloudServiceOperatingSystemsClient { - return &CloudServiceOperatingSystemsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCloudServiceOperatingSystemsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CloudServiceOperatingSystemsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CloudServiceOperatingSystemsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetOSFamily - Gets properties of a guest operating system family that can be specified in the XML service configuration (.cscfg) for a cloud service. @@ -81,7 +89,7 @@ func (client *CloudServiceOperatingSystemsClient) getOSFamilyCreateRequest(ctx c func (client *CloudServiceOperatingSystemsClient) getOSFamilyHandleResponse(resp *http.Response) (CloudServiceOperatingSystemsGetOSFamilyResponse, error) { result := CloudServiceOperatingSystemsGetOSFamilyResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OSFamily); err != nil { - return CloudServiceOperatingSystemsGetOSFamilyResponse{}, err + return CloudServiceOperatingSystemsGetOSFamilyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -146,7 +154,7 @@ func (client *CloudServiceOperatingSystemsClient) getOSVersionCreateRequest(ctx func (client *CloudServiceOperatingSystemsClient) getOSVersionHandleResponse(resp *http.Response) (CloudServiceOperatingSystemsGetOSVersionResponse, error) { result := CloudServiceOperatingSystemsGetOSVersionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OSVersion); err != nil { - return CloudServiceOperatingSystemsGetOSVersionResponse{}, err + return CloudServiceOperatingSystemsGetOSVersionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -206,7 +214,7 @@ func (client *CloudServiceOperatingSystemsClient) listOSFamiliesCreateRequest(ct func (client *CloudServiceOperatingSystemsClient) listOSFamiliesHandleResponse(resp *http.Response) (CloudServiceOperatingSystemsListOSFamiliesResponse, error) { result := CloudServiceOperatingSystemsListOSFamiliesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OSFamilyListResult); err != nil { - return CloudServiceOperatingSystemsListOSFamiliesResponse{}, err + return CloudServiceOperatingSystemsListOSFamiliesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -266,7 +274,7 @@ func (client *CloudServiceOperatingSystemsClient) listOSVersionsCreateRequest(ct func (client *CloudServiceOperatingSystemsClient) listOSVersionsHandleResponse(resp *http.Response) (CloudServiceOperatingSystemsListOSVersionsResponse, error) { result := CloudServiceOperatingSystemsListOSVersionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OSVersionListResult); err != nil { - return CloudServiceOperatingSystemsListOSVersionsResponse{}, err + return CloudServiceOperatingSystemsListOSVersionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_cloudserviceroleinstances_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_cloudserviceroleinstances_client.go index 9329d12553cb..a194280a54a0 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_cloudserviceroleinstances_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_cloudserviceroleinstances_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CloudServiceRoleInstancesClient contains the methods for the CloudServiceRoleInstances group. @@ -31,8 +31,15 @@ type CloudServiceRoleInstancesClient struct { } // NewCloudServiceRoleInstancesClient creates a new instance of CloudServiceRoleInstancesClient with the specified values. -func NewCloudServiceRoleInstancesClient(con *arm.Connection, subscriptionID string) *CloudServiceRoleInstancesClient { - return &CloudServiceRoleInstancesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCloudServiceRoleInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CloudServiceRoleInstancesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CloudServiceRoleInstancesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginDelete - Deletes a role instance from a cloud service. @@ -169,7 +176,7 @@ func (client *CloudServiceRoleInstancesClient) getCreateRequest(ctx context.Cont func (client *CloudServiceRoleInstancesClient) getHandleResponse(resp *http.Response) (CloudServiceRoleInstancesGetResponse, error) { result := CloudServiceRoleInstancesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleInstance); err != nil { - return CloudServiceRoleInstancesGetResponse{}, err + return CloudServiceRoleInstancesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -238,7 +245,7 @@ func (client *CloudServiceRoleInstancesClient) getInstanceViewCreateRequest(ctx func (client *CloudServiceRoleInstancesClient) getInstanceViewHandleResponse(resp *http.Response) (CloudServiceRoleInstancesGetInstanceViewResponse, error) { result := CloudServiceRoleInstancesGetInstanceViewResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleInstanceView); err != nil { - return CloudServiceRoleInstancesGetInstanceViewResponse{}, err + return CloudServiceRoleInstancesGetInstanceViewResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -364,7 +371,7 @@ func (client *CloudServiceRoleInstancesClient) listCreateRequest(ctx context.Con func (client *CloudServiceRoleInstancesClient) listHandleResponse(resp *http.Response) (CloudServiceRoleInstancesListResponse, error) { result := CloudServiceRoleInstancesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RoleInstanceListResult); err != nil { - return CloudServiceRoleInstancesListResponse{}, err + return CloudServiceRoleInstancesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_cloudserviceroles_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_cloudserviceroles_client.go index aab3e6be5368..234d7ce215e3 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_cloudserviceroles_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_cloudserviceroles_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CloudServiceRolesClient contains the methods for the CloudServiceRoles group. @@ -30,8 +31,15 @@ type CloudServiceRolesClient struct { } // NewCloudServiceRolesClient creates a new instance of CloudServiceRolesClient with the specified values. -func NewCloudServiceRolesClient(con *arm.Connection, subscriptionID string) *CloudServiceRolesClient { - return &CloudServiceRolesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCloudServiceRolesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CloudServiceRolesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CloudServiceRolesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a role from a cloud service. @@ -85,7 +93,7 @@ func (client *CloudServiceRolesClient) getCreateRequest(ctx context.Context, rol func (client *CloudServiceRolesClient) getHandleResponse(resp *http.Response) (CloudServiceRolesGetResponse, error) { result := CloudServiceRolesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CloudServiceRole); err != nil { - return CloudServiceRolesGetResponse{}, err + return CloudServiceRolesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -148,7 +156,7 @@ func (client *CloudServiceRolesClient) listCreateRequest(ctx context.Context, re func (client *CloudServiceRolesClient) listHandleResponse(resp *http.Response) (CloudServiceRolesListResponse, error) { result := CloudServiceRolesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CloudServiceRoleListResult); err != nil { - return CloudServiceRolesListResponse{}, err + return CloudServiceRolesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_cloudservices_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_cloudservices_client.go index 626c37c853c0..fabef7d39f24 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_cloudservices_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_cloudservices_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CloudServicesClient contains the methods for the CloudServices group. @@ -31,8 +31,15 @@ type CloudServicesClient struct { } // NewCloudServicesClient creates a new instance of CloudServicesClient with the specified values. -func NewCloudServicesClient(con *arm.Connection, subscriptionID string) *CloudServicesClient { - return &CloudServicesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCloudServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CloudServicesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CloudServicesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update a cloud service. Please note some properties can be set only during cloud service creation. @@ -316,7 +323,7 @@ func (client *CloudServicesClient) getCreateRequest(ctx context.Context, resourc func (client *CloudServicesClient) getHandleResponse(resp *http.Response) (CloudServicesGetResponse, error) { result := CloudServicesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CloudService); err != nil { - return CloudServicesGetResponse{}, err + return CloudServicesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -381,7 +388,7 @@ func (client *CloudServicesClient) getInstanceViewCreateRequest(ctx context.Cont func (client *CloudServicesClient) getInstanceViewHandleResponse(resp *http.Response) (CloudServicesGetInstanceViewResponse, error) { result := CloudServicesGetInstanceViewResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CloudServiceInstanceView); err != nil { - return CloudServicesGetInstanceViewResponse{}, err + return CloudServicesGetInstanceViewResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -440,7 +447,7 @@ func (client *CloudServicesClient) listCreateRequest(ctx context.Context, resour func (client *CloudServicesClient) listHandleResponse(resp *http.Response) (CloudServicesListResponse, error) { result := CloudServicesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CloudServiceListResult); err != nil { - return CloudServicesListResponse{}, err + return CloudServicesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -496,7 +503,7 @@ func (client *CloudServicesClient) listAllCreateRequest(ctx context.Context, opt func (client *CloudServicesClient) listAllHandleResponse(resp *http.Response) (CloudServicesListAllResponse, error) { result := CloudServicesListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CloudServiceListResult); err != nil { - return CloudServicesListAllResponse{}, err + return CloudServicesListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_cloudservicesupdatedomain_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_cloudservicesupdatedomain_client.go index d228a3727ee2..f6878e336bc5 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_cloudservicesupdatedomain_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_cloudservicesupdatedomain_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // CloudServicesUpdateDomainClient contains the methods for the CloudServicesUpdateDomain group. @@ -32,8 +32,15 @@ type CloudServicesUpdateDomainClient struct { } // NewCloudServicesUpdateDomainClient creates a new instance of CloudServicesUpdateDomainClient with the specified values. -func NewCloudServicesUpdateDomainClient(con *arm.Connection, subscriptionID string) *CloudServicesUpdateDomainClient { - return &CloudServicesUpdateDomainClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCloudServicesUpdateDomainClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CloudServicesUpdateDomainClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CloudServicesUpdateDomainClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetUpdateDomain - Gets the specified update domain of a cloud service. Use nextLink property in the response to get the next page of update domains. @@ -85,7 +92,7 @@ func (client *CloudServicesUpdateDomainClient) getUpdateDomainCreateRequest(ctx func (client *CloudServicesUpdateDomainClient) getUpdateDomainHandleResponse(resp *http.Response) (CloudServicesUpdateDomainGetUpdateDomainResponse, error) { result := CloudServicesUpdateDomainGetUpdateDomainResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UpdateDomain); err != nil { - return CloudServicesUpdateDomainGetUpdateDomainResponse{}, err + return CloudServicesUpdateDomainGetUpdateDomainResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -147,7 +154,7 @@ func (client *CloudServicesUpdateDomainClient) listUpdateDomainsCreateRequest(ct func (client *CloudServicesUpdateDomainClient) listUpdateDomainsHandleResponse(resp *http.Response) (CloudServicesUpdateDomainListUpdateDomainsResponse, error) { result := CloudServicesUpdateDomainListUpdateDomainsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UpdateDomainListResult); err != nil { - return CloudServicesUpdateDomainListUpdateDomainsResponse{}, err + return CloudServicesUpdateDomainListUpdateDomainsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_communitygalleries_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_communitygalleries_client.go new file mode 100644 index 000000000000..97f18b69f046 --- /dev/null +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_communitygalleries_client.go @@ -0,0 +1,108 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armcompute + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CommunityGalleriesClient contains the methods for the CommunityGalleries group. +// Don't use this type directly, use NewCommunityGalleriesClient() instead. +type CommunityGalleriesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewCommunityGalleriesClient creates a new instance of CommunityGalleriesClient with the specified values. +func NewCommunityGalleriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CommunityGalleriesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CommunityGalleriesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// Get - Get a community gallery by gallery public name. +// If the operation fails it returns the *CloudError error type. +func (client *CommunityGalleriesClient) Get(ctx context.Context, location string, publicGalleryName string, options *CommunityGalleriesGetOptions) (CommunityGalleriesGetResponse, error) { + req, err := client.getCreateRequest(ctx, location, publicGalleryName, options) + if err != nil { + return CommunityGalleriesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CommunityGalleriesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CommunityGalleriesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CommunityGalleriesClient) getCreateRequest(ctx context.Context, location string, publicGalleryName string, options *CommunityGalleriesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if publicGalleryName == "" { + return nil, errors.New("parameter publicGalleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicGalleryName}", url.PathEscape(publicGalleryName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CommunityGalleriesClient) getHandleResponse(resp *http.Response) (CommunityGalleriesGetResponse, error) { + result := CommunityGalleriesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CommunityGallery); err != nil { + return CommunityGalleriesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *CommunityGalleriesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_communitygalleryimages_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_communitygalleryimages_client.go new file mode 100644 index 000000000000..6274f65e843a --- /dev/null +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_communitygalleryimages_client.go @@ -0,0 +1,112 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armcompute + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CommunityGalleryImagesClient contains the methods for the CommunityGalleryImages group. +// Don't use this type directly, use NewCommunityGalleryImagesClient() instead. +type CommunityGalleryImagesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewCommunityGalleryImagesClient creates a new instance of CommunityGalleryImagesClient with the specified values. +func NewCommunityGalleryImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CommunityGalleryImagesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CommunityGalleryImagesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// Get - Get a community gallery image. +// If the operation fails it returns the *CloudError error type. +func (client *CommunityGalleryImagesClient) Get(ctx context.Context, location string, publicGalleryName string, galleryImageName string, options *CommunityGalleryImagesGetOptions) (CommunityGalleryImagesGetResponse, error) { + req, err := client.getCreateRequest(ctx, location, publicGalleryName, galleryImageName, options) + if err != nil { + return CommunityGalleryImagesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CommunityGalleryImagesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CommunityGalleryImagesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CommunityGalleryImagesClient) getCreateRequest(ctx context.Context, location string, publicGalleryName string, galleryImageName string, options *CommunityGalleryImagesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if publicGalleryName == "" { + return nil, errors.New("parameter publicGalleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicGalleryName}", url.PathEscape(publicGalleryName)) + if galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CommunityGalleryImagesClient) getHandleResponse(resp *http.Response) (CommunityGalleryImagesGetResponse, error) { + result := CommunityGalleryImagesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CommunityGalleryImage); err != nil { + return CommunityGalleryImagesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *CommunityGalleryImagesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_communitygalleryimageversions_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_communitygalleryimageversions_client.go new file mode 100644 index 000000000000..31c1fbdaad55 --- /dev/null +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_communitygalleryimageversions_client.go @@ -0,0 +1,116 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armcompute + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// CommunityGalleryImageVersionsClient contains the methods for the CommunityGalleryImageVersions group. +// Don't use this type directly, use NewCommunityGalleryImageVersionsClient() instead. +type CommunityGalleryImageVersionsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewCommunityGalleryImageVersionsClient creates a new instance of CommunityGalleryImageVersionsClient with the specified values. +func NewCommunityGalleryImageVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CommunityGalleryImageVersionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CommunityGalleryImageVersionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// Get - Get a community gallery image version. +// If the operation fails it returns the *CloudError error type. +func (client *CommunityGalleryImageVersionsClient) Get(ctx context.Context, location string, publicGalleryName string, galleryImageName string, galleryImageVersionName string, options *CommunityGalleryImageVersionsGetOptions) (CommunityGalleryImageVersionsGetResponse, error) { + req, err := client.getCreateRequest(ctx, location, publicGalleryName, galleryImageName, galleryImageVersionName, options) + if err != nil { + return CommunityGalleryImageVersionsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CommunityGalleryImageVersionsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CommunityGalleryImageVersionsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *CommunityGalleryImageVersionsClient) getCreateRequest(ctx context.Context, location string, publicGalleryName string, galleryImageName string, galleryImageVersionName string, options *CommunityGalleryImageVersionsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Compute/locations/{location}/communityGalleries/{publicGalleryName}/images/{galleryImageName}/versions/{galleryImageVersionName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if location == "" { + return nil, errors.New("parameter location cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{location}", url.PathEscape(location)) + if publicGalleryName == "" { + return nil, errors.New("parameter publicGalleryName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{publicGalleryName}", url.PathEscape(publicGalleryName)) + if galleryImageName == "" { + return nil, errors.New("parameter galleryImageName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageName}", url.PathEscape(galleryImageName)) + if galleryImageVersionName == "" { + return nil, errors.New("parameter galleryImageVersionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{galleryImageVersionName}", url.PathEscape(galleryImageVersionName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *CommunityGalleryImageVersionsClient) getHandleResponse(resp *http.Response) (CommunityGalleryImageVersionsGetResponse, error) { + result := CommunityGalleryImageVersionsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CommunityGalleryImageVersion); err != nil { + return CommunityGalleryImageVersionsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *CommunityGalleryImageVersionsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_constants.go b/sdk/resourcemanager/compute/armcompute/zz_generated_constants.go index 9780efddec35..ec405a44df19 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_constants.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_constants.go @@ -10,7 +10,7 @@ package armcompute const ( module = "armcompute" - version = "v0.1.0" + version = "v0.2.0" ) type AccessLevel string diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_dedicatedhostgroups_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_dedicatedhostgroups_client.go index 216517f20e1a..68f36aa5b6f7 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_dedicatedhostgroups_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_dedicatedhostgroups_client.go @@ -11,13 +11,14 @@ package armcompute import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DedicatedHostGroupsClient contains the methods for the DedicatedHostGroups group. @@ -29,8 +30,15 @@ type DedicatedHostGroupsClient struct { } // NewDedicatedHostGroupsClient creates a new instance of DedicatedHostGroupsClient with the specified values. -func NewDedicatedHostGroupsClient(con *arm.Connection, subscriptionID string) *DedicatedHostGroupsClient { - return &DedicatedHostGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDedicatedHostGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DedicatedHostGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DedicatedHostGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update a dedicated host group. For details of Dedicated Host and Dedicated Host Groups please see Dedicated Host Documentation @@ -81,7 +89,7 @@ func (client *DedicatedHostGroupsClient) createOrUpdateCreateRequest(ctx context func (client *DedicatedHostGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (DedicatedHostGroupsCreateOrUpdateResponse, error) { result := DedicatedHostGroupsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostGroup); err != nil { - return DedicatedHostGroupsCreateOrUpdateResponse{}, err + return DedicatedHostGroupsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -202,7 +210,7 @@ func (client *DedicatedHostGroupsClient) getCreateRequest(ctx context.Context, r func (client *DedicatedHostGroupsClient) getHandleResponse(resp *http.Response) (DedicatedHostGroupsGetResponse, error) { result := DedicatedHostGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostGroup); err != nil { - return DedicatedHostGroupsGetResponse{}, err + return DedicatedHostGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -260,7 +268,7 @@ func (client *DedicatedHostGroupsClient) listByResourceGroupCreateRequest(ctx co func (client *DedicatedHostGroupsClient) listByResourceGroupHandleResponse(resp *http.Response) (DedicatedHostGroupsListByResourceGroupResponse, error) { result := DedicatedHostGroupsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostGroupListResult); err != nil { - return DedicatedHostGroupsListByResourceGroupResponse{}, err + return DedicatedHostGroupsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -314,7 +322,7 @@ func (client *DedicatedHostGroupsClient) listBySubscriptionCreateRequest(ctx con func (client *DedicatedHostGroupsClient) listBySubscriptionHandleResponse(resp *http.Response) (DedicatedHostGroupsListBySubscriptionResponse, error) { result := DedicatedHostGroupsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostGroupListResult); err != nil { - return DedicatedHostGroupsListBySubscriptionResponse{}, err + return DedicatedHostGroupsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -378,7 +386,7 @@ func (client *DedicatedHostGroupsClient) updateCreateRequest(ctx context.Context func (client *DedicatedHostGroupsClient) updateHandleResponse(resp *http.Response) (DedicatedHostGroupsUpdateResponse, error) { result := DedicatedHostGroupsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostGroup); err != nil { - return DedicatedHostGroupsUpdateResponse{}, err + return DedicatedHostGroupsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_dedicatedhosts_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_dedicatedhosts_client.go index 6e955d7260a5..63a274471676 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_dedicatedhosts_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_dedicatedhosts_client.go @@ -11,14 +11,14 @@ package armcompute import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DedicatedHostsClient contains the methods for the DedicatedHosts group. @@ -30,8 +30,15 @@ type DedicatedHostsClient struct { } // NewDedicatedHostsClient creates a new instance of DedicatedHostsClient with the specified values. -func NewDedicatedHostsClient(con *arm.Connection, subscriptionID string) *DedicatedHostsClient { - return &DedicatedHostsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDedicatedHostsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DedicatedHostsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DedicatedHostsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update a dedicated host . @@ -245,7 +252,7 @@ func (client *DedicatedHostsClient) getCreateRequest(ctx context.Context, resour func (client *DedicatedHostsClient) getHandleResponse(resp *http.Response) (DedicatedHostsGetResponse, error) { result := DedicatedHostsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHost); err != nil { - return DedicatedHostsGetResponse{}, err + return DedicatedHostsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -307,7 +314,7 @@ func (client *DedicatedHostsClient) listByHostGroupCreateRequest(ctx context.Con func (client *DedicatedHostsClient) listByHostGroupHandleResponse(resp *http.Response) (DedicatedHostsListByHostGroupResponse, error) { result := DedicatedHostsListByHostGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DedicatedHostListResult); err != nil { - return DedicatedHostsListByHostGroupResponse{}, err + return DedicatedHostsListByHostGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_diskaccesses_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_diskaccesses_client.go index 1c353e5e3a5b..ec990d898c05 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_diskaccesses_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_diskaccesses_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DiskAccessesClient contains the methods for the DiskAccesses group. @@ -31,8 +31,15 @@ type DiskAccessesClient struct { } // NewDiskAccessesClient creates a new instance of DiskAccessesClient with the specified values. -func NewDiskAccessesClient(con *arm.Connection, subscriptionID string) *DiskAccessesClient { - return &DiskAccessesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDiskAccessesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DiskAccessesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DiskAccessesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a disk access resource @@ -314,7 +321,7 @@ func (client *DiskAccessesClient) getCreateRequest(ctx context.Context, resource func (client *DiskAccessesClient) getHandleResponse(resp *http.Response) (DiskAccessesGetResponse, error) { result := DiskAccessesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiskAccess); err != nil { - return DiskAccessesGetResponse{}, err + return DiskAccessesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -383,7 +390,7 @@ func (client *DiskAccessesClient) getAPrivateEndpointConnectionCreateRequest(ctx func (client *DiskAccessesClient) getAPrivateEndpointConnectionHandleResponse(resp *http.Response) (DiskAccessesGetAPrivateEndpointConnectionResponse, error) { result := DiskAccessesGetAPrivateEndpointConnectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return DiskAccessesGetAPrivateEndpointConnectionResponse{}, err + return DiskAccessesGetAPrivateEndpointConnectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -448,7 +455,7 @@ func (client *DiskAccessesClient) getPrivateLinkResourcesCreateRequest(ctx conte func (client *DiskAccessesClient) getPrivateLinkResourcesHandleResponse(resp *http.Response) (DiskAccessesGetPrivateLinkResourcesResponse, error) { result := DiskAccessesGetPrivateLinkResourcesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { - return DiskAccessesGetPrivateLinkResourcesResponse{}, err + return DiskAccessesGetPrivateLinkResourcesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -501,7 +508,7 @@ func (client *DiskAccessesClient) listCreateRequest(ctx context.Context, options func (client *DiskAccessesClient) listHandleResponse(resp *http.Response) (DiskAccessesListResponse, error) { result := DiskAccessesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiskAccessList); err != nil { - return DiskAccessesListResponse{}, err + return DiskAccessesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -559,7 +566,7 @@ func (client *DiskAccessesClient) listByResourceGroupCreateRequest(ctx context.C func (client *DiskAccessesClient) listByResourceGroupHandleResponse(resp *http.Response) (DiskAccessesListByResourceGroupResponse, error) { result := DiskAccessesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiskAccessList); err != nil { - return DiskAccessesListByResourceGroupResponse{}, err + return DiskAccessesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -621,7 +628,7 @@ func (client *DiskAccessesClient) listPrivateEndpointConnectionsCreateRequest(ct func (client *DiskAccessesClient) listPrivateEndpointConnectionsHandleResponse(resp *http.Response) (DiskAccessesListPrivateEndpointConnectionsResponse, error) { result := DiskAccessesListPrivateEndpointConnectionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return DiskAccessesListPrivateEndpointConnectionsResponse{}, err + return DiskAccessesListPrivateEndpointConnectionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_diskencryptionsets_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_diskencryptionsets_client.go index 15a2f1e2198d..025974910a65 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_diskencryptionsets_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_diskencryptionsets_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DiskEncryptionSetsClient contains the methods for the DiskEncryptionSets group. @@ -31,8 +31,15 @@ type DiskEncryptionSetsClient struct { } // NewDiskEncryptionSetsClient creates a new instance of DiskEncryptionSetsClient with the specified values. -func NewDiskEncryptionSetsClient(con *arm.Connection, subscriptionID string) *DiskEncryptionSetsClient { - return &DiskEncryptionSetsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDiskEncryptionSetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DiskEncryptionSetsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DiskEncryptionSetsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a disk encryption set @@ -234,7 +241,7 @@ func (client *DiskEncryptionSetsClient) getCreateRequest(ctx context.Context, re func (client *DiskEncryptionSetsClient) getHandleResponse(resp *http.Response) (DiskEncryptionSetsGetResponse, error) { result := DiskEncryptionSetsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiskEncryptionSet); err != nil { - return DiskEncryptionSetsGetResponse{}, err + return DiskEncryptionSetsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -288,7 +295,7 @@ func (client *DiskEncryptionSetsClient) listCreateRequest(ctx context.Context, o func (client *DiskEncryptionSetsClient) listHandleResponse(resp *http.Response) (DiskEncryptionSetsListResponse, error) { result := DiskEncryptionSetsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiskEncryptionSetList); err != nil { - return DiskEncryptionSetsListResponse{}, err + return DiskEncryptionSetsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -350,7 +357,7 @@ func (client *DiskEncryptionSetsClient) listAssociatedResourcesCreateRequest(ctx func (client *DiskEncryptionSetsClient) listAssociatedResourcesHandleResponse(resp *http.Response) (DiskEncryptionSetsListAssociatedResourcesResponse, error) { result := DiskEncryptionSetsListAssociatedResourcesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceURIList); err != nil { - return DiskEncryptionSetsListAssociatedResourcesResponse{}, err + return DiskEncryptionSetsListAssociatedResourcesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -408,7 +415,7 @@ func (client *DiskEncryptionSetsClient) listByResourceGroupCreateRequest(ctx con func (client *DiskEncryptionSetsClient) listByResourceGroupHandleResponse(resp *http.Response) (DiskEncryptionSetsListByResourceGroupResponse, error) { result := DiskEncryptionSetsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiskEncryptionSetList); err != nil { - return DiskEncryptionSetsListByResourceGroupResponse{}, err + return DiskEncryptionSetsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_diskrestorepoint_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_diskrestorepoint_client.go index 9081de3205d1..ee91590c328b 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_diskrestorepoint_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_diskrestorepoint_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DiskRestorePointClient contains the methods for the DiskRestorePoint group. @@ -31,8 +31,15 @@ type DiskRestorePointClient struct { } // NewDiskRestorePointClient creates a new instance of DiskRestorePointClient with the specified values. -func NewDiskRestorePointClient(con *arm.Connection, subscriptionID string) *DiskRestorePointClient { - return &DiskRestorePointClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDiskRestorePointClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DiskRestorePointClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DiskRestorePointClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get disk restorePoint resource @@ -90,7 +97,7 @@ func (client *DiskRestorePointClient) getCreateRequest(ctx context.Context, reso func (client *DiskRestorePointClient) getHandleResponse(resp *http.Response) (DiskRestorePointGetResponse, error) { result := DiskRestorePointGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiskRestorePoint); err != nil { - return DiskRestorePointGetResponse{}, err + return DiskRestorePointGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -240,7 +247,7 @@ func (client *DiskRestorePointClient) listByRestorePointCreateRequest(ctx contex func (client *DiskRestorePointClient) listByRestorePointHandleResponse(resp *http.Response) (DiskRestorePointListByRestorePointResponse, error) { result := DiskRestorePointListByRestorePointResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiskRestorePointList); err != nil { - return DiskRestorePointListByRestorePointResponse{}, err + return DiskRestorePointListByRestorePointResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_disks_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_disks_client.go index 6313957427c4..66c0aeb8f155 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_disks_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_disks_client.go @@ -11,14 +11,14 @@ package armcompute import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DisksClient contains the methods for the Disks group. @@ -30,8 +30,15 @@ type DisksClient struct { } // NewDisksClient creates a new instance of DisksClient with the specified values. -func NewDisksClient(con *arm.Connection, subscriptionID string) *DisksClient { - return &DisksClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDisksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DisksClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DisksClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a disk. @@ -230,7 +237,7 @@ func (client *DisksClient) getCreateRequest(ctx context.Context, resourceGroupNa func (client *DisksClient) getHandleResponse(resp *http.Response) (DisksGetResponse, error) { result := DisksGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Disk); err != nil { - return DisksGetResponse{}, err + return DisksGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -358,7 +365,7 @@ func (client *DisksClient) listCreateRequest(ctx context.Context, options *Disks func (client *DisksClient) listHandleResponse(resp *http.Response) (DisksListResponse, error) { result := DisksListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiskList); err != nil { - return DisksListResponse{}, err + return DisksListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -415,7 +422,7 @@ func (client *DisksClient) listByResourceGroupCreateRequest(ctx context.Context, func (client *DisksClient) listByResourceGroupHandleResponse(resp *http.Response) (DisksListByResourceGroupResponse, error) { result := DisksListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiskList); err != nil { - return DisksListByResourceGroupResponse{}, err + return DisksListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_galleries_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_galleries_client.go index 49d9fc3827d7..9e7b4d7b4652 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_galleries_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_galleries_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // GalleriesClient contains the methods for the Galleries group. @@ -31,8 +31,15 @@ type GalleriesClient struct { } // NewGalleriesClient creates a new instance of GalleriesClient with the specified values. -func NewGalleriesClient(con *arm.Connection, subscriptionID string) *GalleriesClient { - return &GalleriesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewGalleriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *GalleriesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &GalleriesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update a Shared Image Gallery. @@ -237,7 +244,7 @@ func (client *GalleriesClient) getCreateRequest(ctx context.Context, resourceGro func (client *GalleriesClient) getHandleResponse(resp *http.Response) (GalleriesGetResponse, error) { result := GalleriesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Gallery); err != nil { - return GalleriesGetResponse{}, err + return GalleriesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -291,7 +298,7 @@ func (client *GalleriesClient) listCreateRequest(ctx context.Context, options *G func (client *GalleriesClient) listHandleResponse(resp *http.Response) (GalleriesListResponse, error) { result := GalleriesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GalleryList); err != nil { - return GalleriesListResponse{}, err + return GalleriesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -349,7 +356,7 @@ func (client *GalleriesClient) listByResourceGroupCreateRequest(ctx context.Cont func (client *GalleriesClient) listByResourceGroupHandleResponse(resp *http.Response) (GalleriesListByResourceGroupResponse, error) { result := GalleriesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GalleryList); err != nil { - return GalleriesListByResourceGroupResponse{}, err + return GalleriesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_galleryapplications_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_galleryapplications_client.go index 4f150462736b..9696214403f0 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_galleryapplications_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_galleryapplications_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // GalleryApplicationsClient contains the methods for the GalleryApplications group. @@ -31,8 +31,15 @@ type GalleryApplicationsClient struct { } // NewGalleryApplicationsClient creates a new instance of GalleryApplicationsClient with the specified values. -func NewGalleryApplicationsClient(con *arm.Connection, subscriptionID string) *GalleryApplicationsClient { - return &GalleryApplicationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewGalleryApplicationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *GalleryApplicationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &GalleryApplicationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update a gallery Application Definition. @@ -246,7 +253,7 @@ func (client *GalleryApplicationsClient) getCreateRequest(ctx context.Context, r func (client *GalleryApplicationsClient) getHandleResponse(resp *http.Response) (GalleryApplicationsGetResponse, error) { result := GalleryApplicationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GalleryApplication); err != nil { - return GalleryApplicationsGetResponse{}, err + return GalleryApplicationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -308,7 +315,7 @@ func (client *GalleryApplicationsClient) listByGalleryCreateRequest(ctx context. func (client *GalleryApplicationsClient) listByGalleryHandleResponse(resp *http.Response) (GalleryApplicationsListByGalleryResponse, error) { result := GalleryApplicationsListByGalleryResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GalleryApplicationList); err != nil { - return GalleryApplicationsListByGalleryResponse{}, err + return GalleryApplicationsListByGalleryResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_galleryapplicationversions_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_galleryapplicationversions_client.go index 823c5d640a8f..95c01283d38d 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_galleryapplicationversions_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_galleryapplicationversions_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // GalleryApplicationVersionsClient contains the methods for the GalleryApplicationVersions group. @@ -31,8 +31,15 @@ type GalleryApplicationVersionsClient struct { } // NewGalleryApplicationVersionsClient creates a new instance of GalleryApplicationVersionsClient with the specified values. -func NewGalleryApplicationVersionsClient(con *arm.Connection, subscriptionID string) *GalleryApplicationVersionsClient { - return &GalleryApplicationVersionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewGalleryApplicationVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *GalleryApplicationVersionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &GalleryApplicationVersionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update a gallery Application Version. @@ -261,7 +268,7 @@ func (client *GalleryApplicationVersionsClient) getCreateRequest(ctx context.Con func (client *GalleryApplicationVersionsClient) getHandleResponse(resp *http.Response) (GalleryApplicationVersionsGetResponse, error) { result := GalleryApplicationVersionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GalleryApplicationVersion); err != nil { - return GalleryApplicationVersionsGetResponse{}, err + return GalleryApplicationVersionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -327,7 +334,7 @@ func (client *GalleryApplicationVersionsClient) listByGalleryApplicationCreateRe func (client *GalleryApplicationVersionsClient) listByGalleryApplicationHandleResponse(resp *http.Response) (GalleryApplicationVersionsListByGalleryApplicationResponse, error) { result := GalleryApplicationVersionsListByGalleryApplicationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GalleryApplicationVersionList); err != nil { - return GalleryApplicationVersionsListByGalleryApplicationResponse{}, err + return GalleryApplicationVersionsListByGalleryApplicationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_galleryimages_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_galleryimages_client.go index 70f9b48b1d91..e56444576aaf 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_galleryimages_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_galleryimages_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // GalleryImagesClient contains the methods for the GalleryImages group. @@ -31,8 +31,15 @@ type GalleryImagesClient struct { } // NewGalleryImagesClient creates a new instance of GalleryImagesClient with the specified values. -func NewGalleryImagesClient(con *arm.Connection, subscriptionID string) *GalleryImagesClient { - return &GalleryImagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewGalleryImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *GalleryImagesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &GalleryImagesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update a gallery image definition. @@ -246,7 +253,7 @@ func (client *GalleryImagesClient) getCreateRequest(ctx context.Context, resourc func (client *GalleryImagesClient) getHandleResponse(resp *http.Response) (GalleryImagesGetResponse, error) { result := GalleryImagesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GalleryImage); err != nil { - return GalleryImagesGetResponse{}, err + return GalleryImagesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -308,7 +315,7 @@ func (client *GalleryImagesClient) listByGalleryCreateRequest(ctx context.Contex func (client *GalleryImagesClient) listByGalleryHandleResponse(resp *http.Response) (GalleryImagesListByGalleryResponse, error) { result := GalleryImagesListByGalleryResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GalleryImageList); err != nil { - return GalleryImagesListByGalleryResponse{}, err + return GalleryImagesListByGalleryResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_galleryimageversions_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_galleryimageversions_client.go index d7243b8eae3d..27b7a37581c3 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_galleryimageversions_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_galleryimageversions_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // GalleryImageVersionsClient contains the methods for the GalleryImageVersions group. @@ -31,8 +31,15 @@ type GalleryImageVersionsClient struct { } // NewGalleryImageVersionsClient creates a new instance of GalleryImageVersionsClient with the specified values. -func NewGalleryImageVersionsClient(con *arm.Connection, subscriptionID string) *GalleryImageVersionsClient { - return &GalleryImageVersionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewGalleryImageVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *GalleryImageVersionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &GalleryImageVersionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update a gallery image version. @@ -261,7 +268,7 @@ func (client *GalleryImageVersionsClient) getCreateRequest(ctx context.Context, func (client *GalleryImageVersionsClient) getHandleResponse(resp *http.Response) (GalleryImageVersionsGetResponse, error) { result := GalleryImageVersionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GalleryImageVersion); err != nil { - return GalleryImageVersionsGetResponse{}, err + return GalleryImageVersionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -327,7 +334,7 @@ func (client *GalleryImageVersionsClient) listByGalleryImageCreateRequest(ctx co func (client *GalleryImageVersionsClient) listByGalleryImageHandleResponse(resp *http.Response) (GalleryImageVersionsListByGalleryImageResponse, error) { result := GalleryImageVersionsListByGalleryImageResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GalleryImageVersionList); err != nil { - return GalleryImageVersionsListByGalleryImageResponse{}, err + return GalleryImageVersionsListByGalleryImageResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_gallerysharingprofile_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_gallerysharingprofile_client.go index 1bfc848c1d9e..471e70130122 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_gallerysharingprofile_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_gallerysharingprofile_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // GallerySharingProfileClient contains the methods for the GallerySharingProfile group. @@ -31,8 +31,15 @@ type GallerySharingProfileClient struct { } // NewGallerySharingProfileClient creates a new instance of GallerySharingProfileClient with the specified values. -func NewGallerySharingProfileClient(con *arm.Connection, subscriptionID string) *GallerySharingProfileClient { - return &GallerySharingProfileClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewGallerySharingProfileClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *GallerySharingProfileClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &GallerySharingProfileClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginUpdate - Update sharing profile of a gallery. diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_images_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_images_client.go index 826bf8770ad1..22eab8d76860 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_images_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_images_client.go @@ -11,14 +11,14 @@ package armcompute import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ImagesClient contains the methods for the Images group. @@ -30,8 +30,15 @@ type ImagesClient struct { } // NewImagesClient creates a new instance of ImagesClient with the specified values. -func NewImagesClient(con *arm.Connection, subscriptionID string) *ImagesClient { - return &ImagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ImagesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ImagesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update an image. @@ -233,7 +240,7 @@ func (client *ImagesClient) getCreateRequest(ctx context.Context, resourceGroupN func (client *ImagesClient) getHandleResponse(resp *http.Response) (ImagesGetResponse, error) { result := ImagesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Image); err != nil { - return ImagesGetResponse{}, err + return ImagesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -287,7 +294,7 @@ func (client *ImagesClient) listCreateRequest(ctx context.Context, options *Imag func (client *ImagesClient) listHandleResponse(resp *http.Response) (ImagesListResponse, error) { result := ImagesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ImageListResult); err != nil { - return ImagesListResponse{}, err + return ImagesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -344,7 +351,7 @@ func (client *ImagesClient) listByResourceGroupCreateRequest(ctx context.Context func (client *ImagesClient) listByResourceGroupHandleResponse(resp *http.Response) (ImagesListByResourceGroupResponse, error) { result := ImagesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ImageListResult); err != nil { - return ImagesListByResourceGroupResponse{}, err + return ImagesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_loganalytics_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_loganalytics_client.go index 9ad56496608d..dffcf77e5a2f 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_loganalytics_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_loganalytics_client.go @@ -11,14 +11,14 @@ package armcompute import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LogAnalyticsClient contains the methods for the LogAnalytics group. @@ -30,8 +30,15 @@ type LogAnalyticsClient struct { } // NewLogAnalyticsClient creates a new instance of LogAnalyticsClient with the specified values. -func NewLogAnalyticsClient(con *arm.Connection, subscriptionID string) *LogAnalyticsClient { - return &LogAnalyticsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLogAnalyticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LogAnalyticsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LogAnalyticsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginExportRequestRateByInterval - Export logs that show Api requests made by this subscription in the given time window to show throttling activities. diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_models.go b/sdk/resourcemanager/compute/armcompute/zz_generated_models.go index ad584eaab376..f50fb82845c9 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_models.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_models.go @@ -10,10 +10,9 @@ package armcompute import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // APIEntityReference - The API entity reference. @@ -307,10 +306,10 @@ func (a AvailablePatchSummary) MarshalJSON() ([]byte, error) { populate(objectMap, "assessmentActivityId", a.AssessmentActivityID) populate(objectMap, "criticalAndSecurityPatchCount", a.CriticalAndSecurityPatchCount) populate(objectMap, "error", a.Error) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(a.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", a.LastModifiedTime) populate(objectMap, "otherPatchCount", a.OtherPatchCount) populate(objectMap, "rebootPending", a.RebootPending) - populate(objectMap, "startTime", (*timeRFC3339)(a.StartTime)) + populateTimeRFC3339(objectMap, "startTime", a.StartTime) populate(objectMap, "status", a.Status) return json.Marshal(objectMap) } @@ -334,9 +333,7 @@ func (a *AvailablePatchSummary) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.Error) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.LastModifiedTime) delete(rawMsg, key) case "otherPatchCount": err = unpopulate(val, &a.OtherPatchCount) @@ -345,9 +342,7 @@ func (a *AvailablePatchSummary) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.RebootPending) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &a.Status) @@ -645,7 +640,7 @@ func (c CapacityReservationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "instanceView", c.InstanceView) populate(objectMap, "provisioningState", c.ProvisioningState) - populate(objectMap, "provisioningTime", (*timeRFC3339)(c.ProvisioningTime)) + populateTimeRFC3339(objectMap, "provisioningTime", c.ProvisioningTime) populate(objectMap, "reservationId", c.ReservationID) populate(objectMap, "virtualMachinesAssociated", c.VirtualMachinesAssociated) return json.Marshal(objectMap) @@ -667,9 +662,7 @@ func (c *CapacityReservationProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.ProvisioningState) delete(rawMsg, key) case "provisioningTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.ProvisioningTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.ProvisioningTime) delete(rawMsg, key) case "reservationId": err = unpopulate(val, &c.ReservationID) @@ -1268,6 +1261,178 @@ type CloudServicesUpdateDomainListUpdateDomainsOptions struct { // placeholder for future optional parameters } +// CommunityGalleriesGetOptions contains the optional parameters for the CommunityGalleries.Get method. +type CommunityGalleriesGetOptions struct { + // placeholder for future optional parameters +} + +// CommunityGallery - Specifies information about the Community Gallery that you want to create or update. +type CommunityGallery struct { + PirCommunityGalleryResource +} + +// CommunityGalleryIdentifier - The identifier information of community gallery. +type CommunityGalleryIdentifier struct { + // The unique id of this community gallery. + UniqueID *string `json:"uniqueId,omitempty"` +} + +// CommunityGalleryImage - Specifies information about the gallery image definition that you want to create or update. +type CommunityGalleryImage struct { + PirCommunityGalleryResource + // Describes the properties of a gallery image definition. + Properties *CommunityGalleryImageProperties `json:"properties,omitempty"` +} + +// CommunityGalleryImageProperties - Describes the properties of a gallery image definition. +type CommunityGalleryImageProperties struct { + // REQUIRED; This is the gallery image definition identifier. + Identifier *GalleryImageIdentifier `json:"identifier,omitempty"` + + // REQUIRED; This property allows the user to specify whether the virtual machines created under this image are 'Generalized' or 'Specialized'. + OSState *OperatingSystemStateTypes `json:"osState,omitempty"` + + // REQUIRED; This property allows you to specify the type of the OS that is included in the disk when creating a VM from a managed image. + // Possible values are: + // Windows + // Linux + OSType *OperatingSystemTypes `json:"osType,omitempty"` + + // Describes the disallowed disk types. + Disallowed *Disallowed `json:"disallowed,omitempty"` + + // The end of life date of the gallery image definition. This property can be used for decommissioning purposes. This property is updatable. + EndOfLifeDate *time.Time `json:"endOfLifeDate,omitempty"` + + // A list of gallery image features. + Features []*GalleryImageFeature `json:"features,omitempty"` + + // The hypervisor generation of the Virtual Machine. Applicable to OS disks only. + HyperVGeneration *HyperVGeneration `json:"hyperVGeneration,omitempty"` + + // Describes the gallery image definition purchase plan. This is used by marketplace images. + PurchasePlan *ImagePurchasePlan `json:"purchasePlan,omitempty"` + + // The properties describe the recommended machine configuration for this Image Definition. These properties are updatable. + Recommended *RecommendedMachineConfiguration `json:"recommended,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CommunityGalleryImageProperties. +func (c CommunityGalleryImageProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "disallowed", c.Disallowed) + populateTimeRFC3339(objectMap, "endOfLifeDate", c.EndOfLifeDate) + populate(objectMap, "features", c.Features) + populate(objectMap, "hyperVGeneration", c.HyperVGeneration) + populate(objectMap, "identifier", c.Identifier) + populate(objectMap, "osState", c.OSState) + populate(objectMap, "osType", c.OSType) + populate(objectMap, "purchasePlan", c.PurchasePlan) + populate(objectMap, "recommended", c.Recommended) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryImageProperties. +func (c *CommunityGalleryImageProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "disallowed": + err = unpopulate(val, &c.Disallowed) + delete(rawMsg, key) + case "endOfLifeDate": + err = unpopulateTimeRFC3339(val, &c.EndOfLifeDate) + delete(rawMsg, key) + case "features": + err = unpopulate(val, &c.Features) + delete(rawMsg, key) + case "hyperVGeneration": + err = unpopulate(val, &c.HyperVGeneration) + delete(rawMsg, key) + case "identifier": + err = unpopulate(val, &c.Identifier) + delete(rawMsg, key) + case "osState": + err = unpopulate(val, &c.OSState) + delete(rawMsg, key) + case "osType": + err = unpopulate(val, &c.OSType) + delete(rawMsg, key) + case "purchasePlan": + err = unpopulate(val, &c.PurchasePlan) + delete(rawMsg, key) + case "recommended": + err = unpopulate(val, &c.Recommended) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// CommunityGalleryImageVersion - Specifies information about the gallery image version that you want to create or update. +type CommunityGalleryImageVersion struct { + PirCommunityGalleryResource + // Describes the properties of a gallery image version. + Properties *CommunityGalleryImageVersionProperties `json:"properties,omitempty"` +} + +// CommunityGalleryImageVersionProperties - Describes the properties of a gallery image version. +type CommunityGalleryImageVersionProperties struct { + // The end of life date of the gallery image version Definition. This property can be used for decommissioning purposes. This property is updatable. + EndOfLifeDate *time.Time `json:"endOfLifeDate,omitempty"` + + // The published date of the gallery image version Definition. This property can be used for decommissioning purposes. This property is updatable. + PublishedDate *time.Time `json:"publishedDate,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CommunityGalleryImageVersionProperties. +func (c CommunityGalleryImageVersionProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "endOfLifeDate", c.EndOfLifeDate) + populateTimeRFC3339(objectMap, "publishedDate", c.PublishedDate) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CommunityGalleryImageVersionProperties. +func (c *CommunityGalleryImageVersionProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "endOfLifeDate": + err = unpopulateTimeRFC3339(val, &c.EndOfLifeDate) + delete(rawMsg, key) + case "publishedDate": + err = unpopulateTimeRFC3339(val, &c.PublishedDate) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// CommunityGalleryImageVersionsGetOptions contains the optional parameters for the CommunityGalleryImageVersions.Get method. +type CommunityGalleryImageVersionsGetOptions struct { + // placeholder for future optional parameters +} + +// CommunityGalleryImagesGetOptions contains the optional parameters for the CommunityGalleryImages.Get method. +type CommunityGalleryImagesGetOptions struct { + // placeholder for future optional parameters +} + // ComputeOperationListResult - The List Compute Operation operation response. type ComputeOperationListResult struct { // READ-ONLY; The list of compute operations @@ -1706,7 +1871,7 @@ func (d DedicatedHostProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "licenseType", d.LicenseType) populate(objectMap, "platformFaultDomain", d.PlatformFaultDomain) populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "provisioningTime", (*timeRFC3339)(d.ProvisioningTime)) + populateTimeRFC3339(objectMap, "provisioningTime", d.ProvisioningTime) populate(objectMap, "virtualMachines", d.VirtualMachines) return json.Marshal(objectMap) } @@ -1739,9 +1904,7 @@ func (d *DedicatedHostProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.ProvisioningState) delete(rawMsg, key) case "provisioningTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.ProvisioningTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.ProvisioningTime) delete(rawMsg, key) case "virtualMachines": err = unpopulate(val, &d.VirtualMachines) @@ -1927,7 +2090,7 @@ func (d DiskAccessProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "privateEndpointConnections", d.PrivateEndpointConnections) populate(objectMap, "provisioningState", d.ProvisioningState) - populate(objectMap, "timeCreated", (*timeRFC3339)(d.TimeCreated)) + populateTimeRFC3339(objectMap, "timeCreated", d.TimeCreated) return json.Marshal(objectMap) } @@ -1947,9 +2110,7 @@ func (d *DiskAccessProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.ProvisioningState) delete(rawMsg, key) case "timeCreated": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.TimeCreated = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.TimeCreated) delete(rawMsg, key) } if err != nil { @@ -2318,7 +2479,7 @@ func (d DiskProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "supportedCapabilities", d.SupportedCapabilities) populate(objectMap, "supportsHibernation", d.SupportsHibernation) populate(objectMap, "tier", d.Tier) - populate(objectMap, "timeCreated", (*timeRFC3339)(d.TimeCreated)) + populateTimeRFC3339(objectMap, "timeCreated", d.TimeCreated) populate(objectMap, "uniqueId", d.UniqueID) return json.Marshal(objectMap) } @@ -2411,9 +2572,7 @@ func (d *DiskProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.Tier) delete(rawMsg, key) case "timeCreated": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.TimeCreated = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.TimeCreated) delete(rawMsg, key) case "uniqueId": err = unpopulate(val, &d.UniqueID) @@ -2546,7 +2705,7 @@ func (d DiskRestorePointProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "sourceUniqueId", d.SourceUniqueID) populate(objectMap, "supportedCapabilities", d.SupportedCapabilities) populate(objectMap, "supportsHibernation", d.SupportsHibernation) - populate(objectMap, "timeCreated", (*timeRFC3339)(d.TimeCreated)) + populateTimeRFC3339(objectMap, "timeCreated", d.TimeCreated) return json.Marshal(objectMap) } @@ -2599,9 +2758,7 @@ func (d *DiskRestorePointProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.SupportsHibernation) delete(rawMsg, key) case "timeCreated": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.TimeCreated = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.TimeCreated) delete(rawMsg, key) } if err != nil { @@ -2825,7 +2982,7 @@ func (e EncryptionSetProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "activeKey", e.ActiveKey) populate(objectMap, "autoKeyRotationError", e.AutoKeyRotationError) populate(objectMap, "encryptionType", e.EncryptionType) - populate(objectMap, "lastKeyRotationTimestamp", (*timeRFC3339)(e.LastKeyRotationTimestamp)) + populateTimeRFC3339(objectMap, "lastKeyRotationTimestamp", e.LastKeyRotationTimestamp) populate(objectMap, "previousKeys", e.PreviousKeys) populate(objectMap, "provisioningState", e.ProvisioningState) populate(objectMap, "rotationToLatestKeyVersionEnabled", e.RotationToLatestKeyVersionEnabled) @@ -2851,9 +3008,7 @@ func (e *EncryptionSetProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.EncryptionType) delete(rawMsg, key) case "lastKeyRotationTimestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.LastKeyRotationTimestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.LastKeyRotationTimestamp) delete(rawMsg, key) case "previousKeys": err = unpopulate(val, &e.PreviousKeys) @@ -3031,7 +3186,7 @@ type GalleryApplicationProperties struct { func (g GalleryApplicationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "description", g.Description) - populate(objectMap, "endOfLifeDate", (*timeRFC3339)(g.EndOfLifeDate)) + populateTimeRFC3339(objectMap, "endOfLifeDate", g.EndOfLifeDate) populate(objectMap, "eula", g.Eula) populate(objectMap, "privacyStatementUri", g.PrivacyStatementURI) populate(objectMap, "releaseNoteUri", g.ReleaseNoteURI) @@ -3052,9 +3207,7 @@ func (g *GalleryApplicationProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &g.Description) delete(rawMsg, key) case "endOfLifeDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - g.EndOfLifeDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &g.EndOfLifeDate) delete(rawMsg, key) case "eula": err = unpopulate(val, &g.Eula) @@ -3294,9 +3447,9 @@ func (g *GalleryArtifactPublishingProfileBase) UnmarshalJSON(data []byte) error } func (g GalleryArtifactPublishingProfileBase) marshalInternal(objectMap map[string]interface{}) { - populate(objectMap, "endOfLifeDate", (*timeRFC3339)(g.EndOfLifeDate)) + populateTimeRFC3339(objectMap, "endOfLifeDate", g.EndOfLifeDate) populate(objectMap, "excludeFromLatest", g.ExcludeFromLatest) - populate(objectMap, "publishedDate", (*timeRFC3339)(g.PublishedDate)) + populateTimeRFC3339(objectMap, "publishedDate", g.PublishedDate) populate(objectMap, "replicaCount", g.ReplicaCount) populate(objectMap, "replicationMode", g.ReplicationMode) populate(objectMap, "storageAccountType", g.StorageAccountType) @@ -3308,17 +3461,13 @@ func (g *GalleryArtifactPublishingProfileBase) unmarshalInternal(rawMsg map[stri var err error switch key { case "endOfLifeDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - g.EndOfLifeDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &g.EndOfLifeDate) delete(rawMsg, key) case "excludeFromLatest": err = unpopulate(val, &g.ExcludeFromLatest) delete(rawMsg, key) case "publishedDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - g.PublishedDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &g.PublishedDate) delete(rawMsg, key) case "replicaCount": err = unpopulate(val, &g.ReplicaCount) @@ -3488,7 +3637,7 @@ func (g GalleryImageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "description", g.Description) populate(objectMap, "disallowed", g.Disallowed) - populate(objectMap, "endOfLifeDate", (*timeRFC3339)(g.EndOfLifeDate)) + populateTimeRFC3339(objectMap, "endOfLifeDate", g.EndOfLifeDate) populate(objectMap, "eula", g.Eula) populate(objectMap, "features", g.Features) populate(objectMap, "hyperVGeneration", g.HyperVGeneration) @@ -3519,9 +3668,7 @@ func (g *GalleryImageProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &g.Disallowed) delete(rawMsg, key) case "endOfLifeDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - g.EndOfLifeDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &g.EndOfLifeDate) delete(rawMsg, key) case "eula": err = unpopulate(val, &g.Eula) @@ -4090,7 +4237,7 @@ func (i InstanceViewStatus) MarshalJSON() ([]byte, error) { populate(objectMap, "displayStatus", i.DisplayStatus) populate(objectMap, "level", i.Level) populate(objectMap, "message", i.Message) - populate(objectMap, "time", (*timeRFC3339)(i.Time)) + populateTimeRFC3339(objectMap, "time", i.Time) return json.Marshal(objectMap) } @@ -4116,9 +4263,7 @@ func (i *InstanceViewStatus) UnmarshalJSON(data []byte) error { err = unpopulate(val, &i.Message) delete(rawMsg, key) case "time": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.Time = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.Time) delete(rawMsg, key) } if err != nil { @@ -4234,11 +4379,11 @@ func (l LastPatchInstallationSummary) MarshalJSON() ([]byte, error) { populate(objectMap, "failedPatchCount", l.FailedPatchCount) populate(objectMap, "installationActivityId", l.InstallationActivityID) populate(objectMap, "installedPatchCount", l.InstalledPatchCount) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(l.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", l.LastModifiedTime) populate(objectMap, "maintenanceWindowExceeded", l.MaintenanceWindowExceeded) populate(objectMap, "notSelectedPatchCount", l.NotSelectedPatchCount) populate(objectMap, "pendingPatchCount", l.PendingPatchCount) - populate(objectMap, "startTime", (*timeRFC3339)(l.StartTime)) + populateTimeRFC3339(objectMap, "startTime", l.StartTime) populate(objectMap, "status", l.Status) return json.Marshal(objectMap) } @@ -4268,9 +4413,7 @@ func (l *LastPatchInstallationSummary) UnmarshalJSON(data []byte) error { err = unpopulate(val, &l.InstalledPatchCount) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.LastModifiedTime) delete(rawMsg, key) case "maintenanceWindowExceeded": err = unpopulate(val, &l.MaintenanceWindowExceeded) @@ -4282,9 +4425,7 @@ func (l *LastPatchInstallationSummary) UnmarshalJSON(data []byte) error { err = unpopulate(val, &l.PendingPatchCount) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &l.Status) @@ -4474,13 +4615,13 @@ func (l *LogAnalyticsInputBase) UnmarshalJSON(data []byte) error { func (l LogAnalyticsInputBase) marshalInternal(objectMap map[string]interface{}) { populate(objectMap, "blobContainerSasUri", l.BlobContainerSasURI) - populate(objectMap, "fromTime", (*timeRFC3339)(l.FromTime)) + populateTimeRFC3339(objectMap, "fromTime", l.FromTime) populate(objectMap, "groupByClientApplicationId", l.GroupByClientApplicationID) populate(objectMap, "groupByOperationName", l.GroupByOperationName) populate(objectMap, "groupByResourceName", l.GroupByResourceName) populate(objectMap, "groupByThrottlePolicy", l.GroupByThrottlePolicy) populate(objectMap, "groupByUserAgent", l.GroupByUserAgent) - populate(objectMap, "toTime", (*timeRFC3339)(l.ToTime)) + populateTimeRFC3339(objectMap, "toTime", l.ToTime) } func (l *LogAnalyticsInputBase) unmarshalInternal(rawMsg map[string]json.RawMessage) error { @@ -4491,9 +4632,7 @@ func (l *LogAnalyticsInputBase) unmarshalInternal(rawMsg map[string]json.RawMess err = unpopulate(val, &l.BlobContainerSasURI) delete(rawMsg, key) case "fromTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.FromTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.FromTime) delete(rawMsg, key) case "groupByClientApplicationId": err = unpopulate(val, &l.GroupByClientApplicationID) @@ -4511,9 +4650,7 @@ func (l *LogAnalyticsInputBase) unmarshalInternal(rawMsg map[string]json.RawMess err = unpopulate(val, &l.GroupByUserAgent) delete(rawMsg, key) case "toTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.ToTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.ToTime) delete(rawMsg, key) } if err != nil { @@ -4565,10 +4702,10 @@ func (m MaintenanceRedeployStatus) MarshalJSON() ([]byte, error) { populate(objectMap, "isCustomerInitiatedMaintenanceAllowed", m.IsCustomerInitiatedMaintenanceAllowed) populate(objectMap, "lastOperationMessage", m.LastOperationMessage) populate(objectMap, "lastOperationResultCode", m.LastOperationResultCode) - populate(objectMap, "maintenanceWindowEndTime", (*timeRFC3339)(m.MaintenanceWindowEndTime)) - populate(objectMap, "maintenanceWindowStartTime", (*timeRFC3339)(m.MaintenanceWindowStartTime)) - populate(objectMap, "preMaintenanceWindowEndTime", (*timeRFC3339)(m.PreMaintenanceWindowEndTime)) - populate(objectMap, "preMaintenanceWindowStartTime", (*timeRFC3339)(m.PreMaintenanceWindowStartTime)) + populateTimeRFC3339(objectMap, "maintenanceWindowEndTime", m.MaintenanceWindowEndTime) + populateTimeRFC3339(objectMap, "maintenanceWindowStartTime", m.MaintenanceWindowStartTime) + populateTimeRFC3339(objectMap, "preMaintenanceWindowEndTime", m.PreMaintenanceWindowEndTime) + populateTimeRFC3339(objectMap, "preMaintenanceWindowStartTime", m.PreMaintenanceWindowStartTime) return json.Marshal(objectMap) } @@ -4591,24 +4728,16 @@ func (m *MaintenanceRedeployStatus) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.LastOperationResultCode) delete(rawMsg, key) case "maintenanceWindowEndTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.MaintenanceWindowEndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.MaintenanceWindowEndTime) delete(rawMsg, key) case "maintenanceWindowStartTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.MaintenanceWindowStartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.MaintenanceWindowStartTime) delete(rawMsg, key) case "preMaintenanceWindowEndTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.PreMaintenanceWindowEndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.PreMaintenanceWindowEndTime) delete(rawMsg, key) case "preMaintenanceWindowStartTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.PreMaintenanceWindowStartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.PreMaintenanceWindowStartTime) delete(rawMsg, key) } if err != nil { @@ -5045,6 +5174,21 @@ type PatchSettings struct { PatchMode *WindowsVMGuestPatchMode `json:"patchMode,omitempty"` } +// PirCommunityGalleryResource - Base information about the community gallery resource in pir. +type PirCommunityGalleryResource struct { + // The identifier information of community gallery. + Identifier *CommunityGalleryIdentifier `json:"identifier,omitempty"` + + // READ-ONLY; Resource location + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; Resource name + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; Resource type + Type *string `json:"type,omitempty" azure:"ro"` +} + // PirResource - The Resource model definition. type PirResource struct { // READ-ONLY; Resource location @@ -5488,7 +5632,7 @@ func (r ResourceInstanceViewStatus) MarshalJSON() ([]byte, error) { populate(objectMap, "displayStatus", r.DisplayStatus) populate(objectMap, "level", r.Level) populate(objectMap, "message", r.Message) - populate(objectMap, "time", (*timeRFC3339)(r.Time)) + populateTimeRFC3339(objectMap, "time", r.Time) return json.Marshal(objectMap) } @@ -5514,9 +5658,7 @@ func (r *ResourceInstanceViewStatus) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.Message) delete(rawMsg, key) case "time": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.Time = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.Time) delete(rawMsg, key) } if err != nil { @@ -5889,12 +6031,12 @@ type RestorePointProperties struct { // List of disk resource ids that the customer wishes to exclude from the restore point. If no disks are specified, all disks will be included. ExcludeDisks []*APIEntityReference `json:"excludeDisks,omitempty"` + // Gets the creation time of the restore point. + TimeCreated *time.Time `json:"timeCreated,omitempty"` + // READ-ONLY; Gets the consistency mode for the restore point. Please refer to https://aka.ms/RestorePoints for more details. ConsistencyMode *ConsistencyModeTypes `json:"consistencyMode,omitempty" azure:"ro"` - // READ-ONLY; Gets the provisioning details set by the server during Create restore point operation. - ProvisioningDetails *RestorePointProvisioningDetails `json:"provisioningDetails,omitempty" azure:"ro"` - // READ-ONLY; Gets the provisioning state of the restore point. ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` @@ -5907,39 +6049,14 @@ func (r RestorePointProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "consistencyMode", r.ConsistencyMode) populate(objectMap, "excludeDisks", r.ExcludeDisks) - populate(objectMap, "provisioningDetails", r.ProvisioningDetails) populate(objectMap, "provisioningState", r.ProvisioningState) populate(objectMap, "sourceMetadata", r.SourceMetadata) + populateTimeRFC3339(objectMap, "timeCreated", r.TimeCreated) return json.Marshal(objectMap) } -// RestorePointProvisioningDetails - Restore Point Provisioning details. -type RestorePointProvisioningDetails struct { - // Gets the creation time of the restore point. - CreationTime *time.Time `json:"creationTime,omitempty"` - - // Gets the status of the Create restore point operation. - StatusCode *int32 `json:"statusCode,omitempty"` - - // Gets the status message of the Create restore point operation. - StatusMessage *string `json:"statusMessage,omitempty"` - - // Gets the total size of the data in all the disks which are part of the restore point. - TotalUsedSizeInBytes *int64 `json:"totalUsedSizeInBytes,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type RestorePointProvisioningDetails. -func (r RestorePointProvisioningDetails) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(r.CreationTime)) - populate(objectMap, "statusCode", r.StatusCode) - populate(objectMap, "statusMessage", r.StatusMessage) - populate(objectMap, "totalUsedSizeInBytes", r.TotalUsedSizeInBytes) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePointProvisioningDetails. -func (r *RestorePointProvisioningDetails) UnmarshalJSON(data []byte) error { +// UnmarshalJSON implements the json.Unmarshaller interface for type RestorePointProperties. +func (r *RestorePointProperties) UnmarshalJSON(data []byte) error { var rawMsg map[string]json.RawMessage if err := json.Unmarshal(data, &rawMsg); err != nil { return err @@ -5947,19 +6064,20 @@ func (r *RestorePointProvisioningDetails) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { - case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreationTime = (*time.Time)(&aux) + case "consistencyMode": + err = unpopulate(val, &r.ConsistencyMode) + delete(rawMsg, key) + case "excludeDisks": + err = unpopulate(val, &r.ExcludeDisks) delete(rawMsg, key) - case "statusCode": - err = unpopulate(val, &r.StatusCode) + case "provisioningState": + err = unpopulate(val, &r.ProvisioningState) delete(rawMsg, key) - case "statusMessage": - err = unpopulate(val, &r.StatusMessage) + case "sourceMetadata": + err = unpopulate(val, &r.SourceMetadata) delete(rawMsg, key) - case "totalUsedSizeInBytes": - err = unpopulate(val, &r.TotalUsedSizeInBytes) + case "timeCreated": + err = unpopulateTimeRFC3339(val, &r.TimeCreated) delete(rawMsg, key) } if err != nil { @@ -6269,8 +6387,8 @@ func (r RollingUpgradeRunningStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "code", r.Code) populate(objectMap, "lastAction", r.LastAction) - populate(objectMap, "lastActionTime", (*timeRFC3339)(r.LastActionTime)) - populate(objectMap, "startTime", (*timeRFC3339)(r.StartTime)) + populateTimeRFC3339(objectMap, "lastActionTime", r.LastActionTime) + populateTimeRFC3339(objectMap, "startTime", r.StartTime) return json.Marshal(objectMap) } @@ -6290,14 +6408,10 @@ func (r *RollingUpgradeRunningStatus) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.LastAction) delete(rawMsg, key) case "lastActionTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.LastActionTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.LastActionTime) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.StartTime) delete(rawMsg, key) } if err != nil { @@ -6746,7 +6860,7 @@ type SharedGalleryImageProperties struct { func (s SharedGalleryImageProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "disallowed", s.Disallowed) - populate(objectMap, "endOfLifeDate", (*timeRFC3339)(s.EndOfLifeDate)) + populateTimeRFC3339(objectMap, "endOfLifeDate", s.EndOfLifeDate) populate(objectMap, "features", s.Features) populate(objectMap, "hyperVGeneration", s.HyperVGeneration) populate(objectMap, "identifier", s.Identifier) @@ -6770,9 +6884,7 @@ func (s *SharedGalleryImageProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Disallowed) delete(rawMsg, key) case "endOfLifeDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.EndOfLifeDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.EndOfLifeDate) delete(rawMsg, key) case "features": err = unpopulate(val, &s.Features) @@ -6839,8 +6951,8 @@ type SharedGalleryImageVersionProperties struct { // MarshalJSON implements the json.Marshaller interface for type SharedGalleryImageVersionProperties. func (s SharedGalleryImageVersionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "endOfLifeDate", (*timeRFC3339)(s.EndOfLifeDate)) - populate(objectMap, "publishedDate", (*timeRFC3339)(s.PublishedDate)) + populateTimeRFC3339(objectMap, "endOfLifeDate", s.EndOfLifeDate) + populateTimeRFC3339(objectMap, "publishedDate", s.PublishedDate) return json.Marshal(objectMap) } @@ -6854,14 +6966,10 @@ func (s *SharedGalleryImageVersionProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "endOfLifeDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.EndOfLifeDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.EndOfLifeDate) delete(rawMsg, key) case "publishedDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.PublishedDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.PublishedDate) delete(rawMsg, key) } if err != nil { @@ -7099,7 +7207,7 @@ func (s SnapshotProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "purchasePlan", s.PurchasePlan) populate(objectMap, "supportedCapabilities", s.SupportedCapabilities) populate(objectMap, "supportsHibernation", s.SupportsHibernation) - populate(objectMap, "timeCreated", (*timeRFC3339)(s.TimeCreated)) + populateTimeRFC3339(objectMap, "timeCreated", s.TimeCreated) populate(objectMap, "uniqueId", s.UniqueID) return json.Marshal(objectMap) } @@ -7165,9 +7273,7 @@ func (s *SnapshotProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.SupportsHibernation) delete(rawMsg, key) case "timeCreated": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.TimeCreated = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.TimeCreated) delete(rawMsg, key) case "uniqueId": err = unpopulate(val, &s.UniqueID) @@ -7552,8 +7658,8 @@ type UpgradeOperationHistoryStatus struct { func (u UpgradeOperationHistoryStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "code", u.Code) - populate(objectMap, "endTime", (*timeRFC3339)(u.EndTime)) - populate(objectMap, "startTime", (*timeRFC3339)(u.StartTime)) + populateTimeRFC3339(objectMap, "endTime", u.EndTime) + populateTimeRFC3339(objectMap, "startTime", u.StartTime) return json.Marshal(objectMap) } @@ -7570,14 +7676,10 @@ func (u *UpgradeOperationHistoryStatus) UnmarshalJSON(data []byte) error { err = unpopulate(val, &u.Code) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - u.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &u.EndTime) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - u.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &u.StartTime) delete(rawMsg, key) } if err != nil { @@ -7846,7 +7948,7 @@ func (v VirtualMachineAssessPatchesResult) MarshalJSON() ([]byte, error) { populate(objectMap, "error", v.Error) populate(objectMap, "otherPatchCount", v.OtherPatchCount) populate(objectMap, "rebootPending", v.RebootPending) - populate(objectMap, "startDateTime", (*timeRFC3339)(v.StartDateTime)) + populateTimeRFC3339(objectMap, "startDateTime", v.StartDateTime) populate(objectMap, "status", v.Status) return json.Marshal(objectMap) } @@ -7879,9 +7981,7 @@ func (v *VirtualMachineAssessPatchesResult) UnmarshalJSON(data []byte) error { err = unpopulate(val, &v.RebootPending) delete(rawMsg, key) case "startDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - v.StartDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &v.StartDateTime) delete(rawMsg, key) case "status": err = unpopulate(val, &v.Status) @@ -8428,7 +8528,7 @@ func (v VirtualMachineInstallPatchesResult) MarshalJSON() ([]byte, error) { populate(objectMap, "patches", v.Patches) populate(objectMap, "pendingPatchCount", v.PendingPatchCount) populate(objectMap, "rebootStatus", v.RebootStatus) - populate(objectMap, "startDateTime", (*timeRFC3339)(v.StartDateTime)) + populateTimeRFC3339(objectMap, "startDateTime", v.StartDateTime) populate(objectMap, "status", v.Status) return json.Marshal(objectMap) } @@ -8473,9 +8573,7 @@ func (v *VirtualMachineInstallPatchesResult) UnmarshalJSON(data []byte) error { err = unpopulate(val, &v.RebootStatus) delete(rawMsg, key) case "startDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - v.StartDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &v.StartDateTime) delete(rawMsg, key) case "status": err = unpopulate(val, &v.Status) @@ -8960,13 +9058,13 @@ type VirtualMachineRunCommandInstanceView struct { // MarshalJSON implements the json.Marshaller interface for type VirtualMachineRunCommandInstanceView. func (v VirtualMachineRunCommandInstanceView) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "endTime", (*timeRFC3339)(v.EndTime)) + populateTimeRFC3339(objectMap, "endTime", v.EndTime) populate(objectMap, "error", v.Error) populate(objectMap, "executionMessage", v.ExecutionMessage) populate(objectMap, "executionState", v.ExecutionState) populate(objectMap, "exitCode", v.ExitCode) populate(objectMap, "output", v.Output) - populate(objectMap, "startTime", (*timeRFC3339)(v.StartTime)) + populateTimeRFC3339(objectMap, "startTime", v.StartTime) populate(objectMap, "statuses", v.Statuses) return json.Marshal(objectMap) } @@ -8981,9 +9079,7 @@ func (v *VirtualMachineRunCommandInstanceView) UnmarshalJSON(data []byte) error var err error switch key { case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - v.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &v.EndTime) delete(rawMsg, key) case "error": err = unpopulate(val, &v.Error) @@ -9001,9 +9097,7 @@ func (v *VirtualMachineRunCommandInstanceView) UnmarshalJSON(data []byte) error err = unpopulate(val, &v.Output) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - v.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &v.StartTime) delete(rawMsg, key) case "statuses": err = unpopulate(val, &v.Statuses) @@ -11150,10 +11244,10 @@ func (v VirtualMachineSoftwarePatchProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "assessmentState", v.AssessmentState) populate(objectMap, "classifications", v.Classifications) populate(objectMap, "kbId", v.KbID) - populate(objectMap, "lastModifiedDateTime", (*timeRFC3339)(v.LastModifiedDateTime)) + populateTimeRFC3339(objectMap, "lastModifiedDateTime", v.LastModifiedDateTime) populate(objectMap, "name", v.Name) populate(objectMap, "patchId", v.PatchID) - populate(objectMap, "publishedDate", (*timeRFC3339)(v.PublishedDate)) + populateTimeRFC3339(objectMap, "publishedDate", v.PublishedDate) populate(objectMap, "rebootBehavior", v.RebootBehavior) populate(objectMap, "version", v.Version) return json.Marshal(objectMap) @@ -11181,9 +11275,7 @@ func (v *VirtualMachineSoftwarePatchProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, &v.KbID) delete(rawMsg, key) case "lastModifiedDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - v.LastModifiedDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &v.LastModifiedDateTime) delete(rawMsg, key) case "name": err = unpopulate(val, &v.Name) @@ -11192,9 +11284,7 @@ func (v *VirtualMachineSoftwarePatchProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, &v.PatchID) delete(rawMsg, key) case "publishedDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - v.PublishedDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &v.PublishedDate) delete(rawMsg, key) case "rebootBehavior": err = unpopulate(val, &v.RebootBehavior) @@ -11278,7 +11368,7 @@ type VirtualMachinesBeginDeallocateOptions struct { // VirtualMachinesBeginDeleteOptions contains the optional parameters for the VirtualMachines.BeginDelete method. type VirtualMachinesBeginDeleteOptions struct { - // Optional parameter to force delete virtual machines.(Feature in Preview) + // Optional parameter to force delete virtual machines. ForceDeletion *bool } @@ -11486,7 +11576,7 @@ func (w WindowsParameters) MarshalJSON() ([]byte, error) { populate(objectMap, "excludeKbsRequiringReboot", w.ExcludeKbsRequiringReboot) populate(objectMap, "kbNumbersToExclude", w.KbNumbersToExclude) populate(objectMap, "kbNumbersToInclude", w.KbNumbersToInclude) - populate(objectMap, "maxPatchPublishDate", (*timeRFC3339)(w.MaxPatchPublishDate)) + populateTimeRFC3339(objectMap, "maxPatchPublishDate", w.MaxPatchPublishDate) return json.Marshal(objectMap) } @@ -11512,9 +11602,7 @@ func (w *WindowsParameters) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.KbNumbersToInclude) delete(rawMsg, key) case "maxPatchPublishDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.MaxPatchPublishDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.MaxPatchPublishDate) delete(rawMsg, key) } if err != nil { diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_operations_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_operations_client.go index d83914f91b1f..a164458426eb 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_operations_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armcompute import ( "context" "errors" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets a list of compute operations. @@ -65,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ComputeOperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_pagers.go b/sdk/resourcemanager/compute/armcompute/zz_generated_pagers.go index e280dfa0251a..438db92b6085 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_pagers.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armcompute import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // AvailabilitySetsListBySubscriptionPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_pollers.go b/sdk/resourcemanager/compute/armcompute/zz_generated_pollers.go index 41bb4bc6041f..ca00ae33eb8b 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_pollers.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armcompute import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // CapacityReservationsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_proximityplacementgroups_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_proximityplacementgroups_client.go index 1a18b411a1fc..c50ee12c030a 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_proximityplacementgroups_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_proximityplacementgroups_client.go @@ -11,13 +11,14 @@ package armcompute import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ProximityPlacementGroupsClient contains the methods for the ProximityPlacementGroups group. @@ -29,8 +30,15 @@ type ProximityPlacementGroupsClient struct { } // NewProximityPlacementGroupsClient creates a new instance of ProximityPlacementGroupsClient with the specified values. -func NewProximityPlacementGroupsClient(con *arm.Connection, subscriptionID string) *ProximityPlacementGroupsClient { - return &ProximityPlacementGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewProximityPlacementGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ProximityPlacementGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ProximityPlacementGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update a proximity placement group. @@ -80,7 +88,7 @@ func (client *ProximityPlacementGroupsClient) createOrUpdateCreateRequest(ctx co func (client *ProximityPlacementGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (ProximityPlacementGroupsCreateOrUpdateResponse, error) { result := ProximityPlacementGroupsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProximityPlacementGroup); err != nil { - return ProximityPlacementGroupsCreateOrUpdateResponse{}, err + return ProximityPlacementGroupsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -201,7 +209,7 @@ func (client *ProximityPlacementGroupsClient) getCreateRequest(ctx context.Conte func (client *ProximityPlacementGroupsClient) getHandleResponse(resp *http.Response) (ProximityPlacementGroupsGetResponse, error) { result := ProximityPlacementGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProximityPlacementGroup); err != nil { - return ProximityPlacementGroupsGetResponse{}, err + return ProximityPlacementGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -258,7 +266,7 @@ func (client *ProximityPlacementGroupsClient) listByResourceGroupCreateRequest(c func (client *ProximityPlacementGroupsClient) listByResourceGroupHandleResponse(resp *http.Response) (ProximityPlacementGroupsListByResourceGroupResponse, error) { result := ProximityPlacementGroupsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProximityPlacementGroupListResult); err != nil { - return ProximityPlacementGroupsListByResourceGroupResponse{}, err + return ProximityPlacementGroupsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -311,7 +319,7 @@ func (client *ProximityPlacementGroupsClient) listBySubscriptionCreateRequest(ct func (client *ProximityPlacementGroupsClient) listBySubscriptionHandleResponse(resp *http.Response) (ProximityPlacementGroupsListBySubscriptionResponse, error) { result := ProximityPlacementGroupsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProximityPlacementGroupListResult); err != nil { - return ProximityPlacementGroupsListBySubscriptionResponse{}, err + return ProximityPlacementGroupsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -375,7 +383,7 @@ func (client *ProximityPlacementGroupsClient) updateCreateRequest(ctx context.Co func (client *ProximityPlacementGroupsClient) updateHandleResponse(resp *http.Response) (ProximityPlacementGroupsUpdateResponse, error) { result := ProximityPlacementGroupsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProximityPlacementGroup); err != nil { - return ProximityPlacementGroupsUpdateResponse{}, err + return ProximityPlacementGroupsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_resourceskus_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_resourceskus_client.go index 9a96d01d0e42..71e79410ee90 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_resourceskus_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_resourceskus_client.go @@ -11,13 +11,14 @@ package armcompute import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ResourceSKUsClient contains the methods for the ResourceSKUs group. @@ -29,8 +30,15 @@ type ResourceSKUsClient struct { } // NewResourceSKUsClient creates a new instance of ResourceSKUsClient with the specified values. -func NewResourceSKUsClient(con *arm.Connection, subscriptionID string) *ResourceSKUsClient { - return &ResourceSKUsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewResourceSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ResourceSKUsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ResourceSKUsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets the list of Microsoft.Compute SKUs available for your Subscription. @@ -75,7 +83,7 @@ func (client *ResourceSKUsClient) listCreateRequest(ctx context.Context, options func (client *ResourceSKUsClient) listHandleResponse(resp *http.Response) (ResourceSKUsListResponse, error) { result := ResourceSKUsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceSKUsResult); err != nil { - return ResourceSKUsListResponse{}, err + return ResourceSKUsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_response_types.go b/sdk/resourcemanager/compute/armcompute/zz_generated_response_types.go index abc0f2956d52..007ccc880642 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_response_types.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armcompute import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // AvailabilitySetsCreateOrUpdateResponse contains the response from method AvailabilitySets.CreateOrUpdate. @@ -170,6 +169,8 @@ type CapacityReservationsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CapacityReservationsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CapacityReservationsCreateOrUpdateResponse, error) { respType := CapacityReservationsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CapacityReservation) @@ -220,6 +221,8 @@ type CapacityReservationsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CapacityReservationsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CapacityReservationsDeleteResponse, error) { respType := CapacityReservationsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -288,6 +291,8 @@ type CapacityReservationsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CapacityReservationsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CapacityReservationsUpdateResponse, error) { respType := CapacityReservationsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CapacityReservation) @@ -386,6 +391,8 @@ type CloudServiceRoleInstancesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CloudServiceRoleInstancesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServiceRoleInstancesDeleteResponse, error) { respType := CloudServiceRoleInstancesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -472,6 +479,8 @@ type CloudServiceRoleInstancesRebuildPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CloudServiceRoleInstancesRebuildPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServiceRoleInstancesRebuildResponse, error) { respType := CloudServiceRoleInstancesRebuildResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -516,6 +525,8 @@ type CloudServiceRoleInstancesReimagePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CloudServiceRoleInstancesReimagePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServiceRoleInstancesReimageResponse, error) { respType := CloudServiceRoleInstancesReimageResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -560,6 +571,8 @@ type CloudServiceRoleInstancesRestartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CloudServiceRoleInstancesRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServiceRoleInstancesRestartResponse, error) { respType := CloudServiceRoleInstancesRestartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -628,6 +641,8 @@ type CloudServicesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CloudServicesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesCreateOrUpdateResponse, error) { respType := CloudServicesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CloudService) @@ -678,6 +693,8 @@ type CloudServicesDeleteInstancesPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CloudServicesDeleteInstancesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesDeleteInstancesResponse, error) { respType := CloudServicesDeleteInstancesResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -722,6 +739,8 @@ type CloudServicesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CloudServicesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesDeleteResponse, error) { respType := CloudServicesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -814,6 +833,8 @@ type CloudServicesPowerOffPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CloudServicesPowerOffPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesPowerOffResponse, error) { respType := CloudServicesPowerOffResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -858,6 +879,8 @@ type CloudServicesRebuildPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CloudServicesRebuildPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesRebuildResponse, error) { respType := CloudServicesRebuildResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -902,6 +925,8 @@ type CloudServicesReimagePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CloudServicesReimagePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesReimageResponse, error) { respType := CloudServicesReimageResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -946,6 +971,8 @@ type CloudServicesRestartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CloudServicesRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesRestartResponse, error) { respType := CloudServicesRestartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -990,6 +1017,8 @@ type CloudServicesStartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CloudServicesStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesStartResponse, error) { respType := CloudServicesStartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1058,6 +1087,8 @@ type CloudServicesUpdateDomainWalkUpdateDomainPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CloudServicesUpdateDomainWalkUpdateDomainPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesUpdateDomainWalkUpdateDomainResponse, error) { respType := CloudServicesUpdateDomainWalkUpdateDomainResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1102,6 +1133,8 @@ type CloudServicesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CloudServicesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CloudServicesUpdateResponse, error) { respType := CloudServicesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CloudService) @@ -1142,6 +1175,42 @@ type CloudServicesUpdateResult struct { CloudService } +// CommunityGalleriesGetResponse contains the response from method CommunityGalleries.Get. +type CommunityGalleriesGetResponse struct { + CommunityGalleriesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// CommunityGalleriesGetResult contains the result from method CommunityGalleries.Get. +type CommunityGalleriesGetResult struct { + CommunityGallery +} + +// CommunityGalleryImageVersionsGetResponse contains the response from method CommunityGalleryImageVersions.Get. +type CommunityGalleryImageVersionsGetResponse struct { + CommunityGalleryImageVersionsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// CommunityGalleryImageVersionsGetResult contains the result from method CommunityGalleryImageVersions.Get. +type CommunityGalleryImageVersionsGetResult struct { + CommunityGalleryImageVersion +} + +// CommunityGalleryImagesGetResponse contains the response from method CommunityGalleryImages.Get. +type CommunityGalleryImagesGetResponse struct { + CommunityGalleryImagesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// CommunityGalleryImagesGetResult contains the result from method CommunityGalleryImages.Get. +type CommunityGalleryImagesGetResult struct { + CommunityGalleryImage +} + // DedicatedHostGroupsCreateOrUpdateResponse contains the response from method DedicatedHostGroups.CreateOrUpdate. type DedicatedHostGroupsCreateOrUpdateResponse struct { DedicatedHostGroupsCreateOrUpdateResult @@ -1218,6 +1287,8 @@ type DedicatedHostsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DedicatedHostsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DedicatedHostsCreateOrUpdateResponse, error) { respType := DedicatedHostsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DedicatedHost) @@ -1268,6 +1339,8 @@ type DedicatedHostsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DedicatedHostsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DedicatedHostsDeleteResponse, error) { respType := DedicatedHostsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1336,6 +1409,8 @@ type DedicatedHostsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DedicatedHostsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DedicatedHostsUpdateResponse, error) { respType := DedicatedHostsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DedicatedHost) @@ -1386,6 +1461,8 @@ type DiskAccessesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DiskAccessesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskAccessesCreateOrUpdateResponse, error) { respType := DiskAccessesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DiskAccess) @@ -1436,6 +1513,8 @@ type DiskAccessesDeleteAPrivateEndpointConnectionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DiskAccessesDeleteAPrivateEndpointConnectionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskAccessesDeleteAPrivateEndpointConnectionResponse, error) { respType := DiskAccessesDeleteAPrivateEndpointConnectionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1480,6 +1559,8 @@ type DiskAccessesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DiskAccessesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskAccessesDeleteResponse, error) { respType := DiskAccessesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1596,6 +1677,8 @@ type DiskAccessesUpdateAPrivateEndpointConnectionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DiskAccessesUpdateAPrivateEndpointConnectionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskAccessesUpdateAPrivateEndpointConnectionResponse, error) { respType := DiskAccessesUpdateAPrivateEndpointConnectionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) @@ -1646,6 +1729,8 @@ type DiskAccessesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DiskAccessesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskAccessesUpdateResponse, error) { respType := DiskAccessesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DiskAccess) @@ -1696,6 +1781,8 @@ type DiskEncryptionSetsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DiskEncryptionSetsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskEncryptionSetsCreateOrUpdateResponse, error) { respType := DiskEncryptionSetsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DiskEncryptionSet) @@ -1746,6 +1833,8 @@ type DiskEncryptionSetsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DiskEncryptionSetsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskEncryptionSetsDeleteResponse, error) { respType := DiskEncryptionSetsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1838,6 +1927,8 @@ type DiskEncryptionSetsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DiskEncryptionSetsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskEncryptionSetsUpdateResponse, error) { respType := DiskEncryptionSetsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DiskEncryptionSet) @@ -1900,6 +1991,8 @@ type DiskRestorePointGrantAccessPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DiskRestorePointGrantAccessPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskRestorePointGrantAccessResponse, error) { respType := DiskRestorePointGrantAccessResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AccessURI) @@ -1962,6 +2055,8 @@ type DiskRestorePointRevokeAccessPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DiskRestorePointRevokeAccessPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DiskRestorePointRevokeAccessResponse, error) { respType := DiskRestorePointRevokeAccessResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2006,6 +2101,8 @@ type DisksCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DisksCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DisksCreateOrUpdateResponse, error) { respType := DisksCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Disk) @@ -2056,6 +2153,8 @@ type DisksDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DisksDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DisksDeleteResponse, error) { respType := DisksDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2112,6 +2211,8 @@ type DisksGrantAccessPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DisksGrantAccessPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DisksGrantAccessResponse, error) { respType := DisksGrantAccessResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AccessURI) @@ -2186,6 +2287,8 @@ type DisksRevokeAccessPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DisksRevokeAccessPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DisksRevokeAccessResponse, error) { respType := DisksRevokeAccessResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2230,6 +2333,8 @@ type DisksUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DisksUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DisksUpdateResponse, error) { respType := DisksUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Disk) @@ -2280,6 +2385,8 @@ type GalleriesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GalleriesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleriesCreateOrUpdateResponse, error) { respType := GalleriesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Gallery) @@ -2330,6 +2437,8 @@ type GalleriesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GalleriesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleriesDeleteResponse, error) { respType := GalleriesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2410,6 +2519,8 @@ type GalleriesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GalleriesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleriesUpdateResponse, error) { respType := GalleriesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Gallery) @@ -2460,6 +2571,8 @@ type GalleryApplicationVersionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GalleryApplicationVersionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryApplicationVersionsCreateOrUpdateResponse, error) { respType := GalleryApplicationVersionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GalleryApplicationVersion) @@ -2510,6 +2623,8 @@ type GalleryApplicationVersionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GalleryApplicationVersionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryApplicationVersionsDeleteResponse, error) { respType := GalleryApplicationVersionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2578,6 +2693,8 @@ type GalleryApplicationVersionsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GalleryApplicationVersionsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryApplicationVersionsUpdateResponse, error) { respType := GalleryApplicationVersionsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GalleryApplicationVersion) @@ -2628,6 +2745,8 @@ type GalleryApplicationsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GalleryApplicationsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryApplicationsCreateOrUpdateResponse, error) { respType := GalleryApplicationsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GalleryApplication) @@ -2678,6 +2797,8 @@ type GalleryApplicationsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GalleryApplicationsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryApplicationsDeleteResponse, error) { respType := GalleryApplicationsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2746,6 +2867,8 @@ type GalleryApplicationsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GalleryApplicationsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryApplicationsUpdateResponse, error) { respType := GalleryApplicationsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GalleryApplication) @@ -2796,6 +2919,8 @@ type GalleryImageVersionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GalleryImageVersionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryImageVersionsCreateOrUpdateResponse, error) { respType := GalleryImageVersionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GalleryImageVersion) @@ -2846,6 +2971,8 @@ type GalleryImageVersionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GalleryImageVersionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryImageVersionsDeleteResponse, error) { respType := GalleryImageVersionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2914,6 +3041,8 @@ type GalleryImageVersionsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GalleryImageVersionsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryImageVersionsUpdateResponse, error) { respType := GalleryImageVersionsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GalleryImageVersion) @@ -2964,6 +3093,8 @@ type GalleryImagesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GalleryImagesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryImagesCreateOrUpdateResponse, error) { respType := GalleryImagesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GalleryImage) @@ -3014,6 +3145,8 @@ type GalleryImagesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GalleryImagesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryImagesDeleteResponse, error) { respType := GalleryImagesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3082,6 +3215,8 @@ type GalleryImagesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GalleryImagesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GalleryImagesUpdateResponse, error) { respType := GalleryImagesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GalleryImage) @@ -3132,6 +3267,8 @@ type GallerySharingProfileUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GallerySharingProfileUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GallerySharingProfileUpdateResponse, error) { respType := GallerySharingProfileUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SharingUpdate) @@ -3182,6 +3319,8 @@ type ImagesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ImagesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ImagesCreateOrUpdateResponse, error) { respType := ImagesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Image) @@ -3232,6 +3371,8 @@ type ImagesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ImagesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ImagesDeleteResponse, error) { respType := ImagesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3312,6 +3453,8 @@ type ImagesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ImagesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ImagesUpdateResponse, error) { respType := ImagesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Image) @@ -3362,6 +3505,8 @@ type LogAnalyticsExportRequestRateByIntervalPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LogAnalyticsExportRequestRateByIntervalPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LogAnalyticsExportRequestRateByIntervalResponse, error) { respType := LogAnalyticsExportRequestRateByIntervalResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LogAnalyticsOperationResult) @@ -3412,6 +3557,8 @@ type LogAnalyticsExportThrottledRequestsPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LogAnalyticsExportThrottledRequestsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LogAnalyticsExportThrottledRequestsResponse, error) { respType := LogAnalyticsExportThrottledRequestsResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LogAnalyticsOperationResult) @@ -3564,6 +3711,8 @@ type RestorePointCollectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RestorePointCollectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RestorePointCollectionsDeleteResponse, error) { respType := RestorePointCollectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3656,6 +3805,8 @@ type RestorePointsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RestorePointsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RestorePointsCreateResponse, error) { respType := RestorePointsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RestorePoint) @@ -3706,6 +3857,8 @@ type RestorePointsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RestorePointsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RestorePointsDeleteResponse, error) { respType := RestorePointsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3912,6 +4065,8 @@ type SnapshotsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SnapshotsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SnapshotsCreateOrUpdateResponse, error) { respType := SnapshotsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Snapshot) @@ -3962,6 +4117,8 @@ type SnapshotsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SnapshotsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SnapshotsDeleteResponse, error) { respType := SnapshotsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4018,6 +4175,8 @@ type SnapshotsGrantAccessPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SnapshotsGrantAccessPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SnapshotsGrantAccessResponse, error) { respType := SnapshotsGrantAccessResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AccessURI) @@ -4092,6 +4251,8 @@ type SnapshotsRevokeAccessPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SnapshotsRevokeAccessPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SnapshotsRevokeAccessResponse, error) { respType := SnapshotsRevokeAccessResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4136,6 +4297,8 @@ type SnapshotsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SnapshotsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SnapshotsUpdateResponse, error) { respType := SnapshotsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Snapshot) @@ -4236,6 +4399,8 @@ type VirtualMachineExtensionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineExtensionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineExtensionsCreateOrUpdateResponse, error) { respType := VirtualMachineExtensionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineExtension) @@ -4286,6 +4451,8 @@ type VirtualMachineExtensionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineExtensionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineExtensionsDeleteResponse, error) { respType := VirtualMachineExtensionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4354,6 +4521,8 @@ type VirtualMachineExtensionsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineExtensionsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineExtensionsUpdateResponse, error) { respType := VirtualMachineExtensionsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineExtension) @@ -4532,6 +4701,8 @@ type VirtualMachineRunCommandsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineRunCommandsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineRunCommandsCreateOrUpdateResponse, error) { respType := VirtualMachineRunCommandsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineRunCommand) @@ -4582,6 +4753,8 @@ type VirtualMachineRunCommandsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineRunCommandsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineRunCommandsDeleteResponse, error) { respType := VirtualMachineRunCommandsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4674,6 +4847,8 @@ type VirtualMachineRunCommandsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineRunCommandsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineRunCommandsUpdateResponse, error) { respType := VirtualMachineRunCommandsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineRunCommand) @@ -4724,6 +4899,8 @@ type VirtualMachineScaleSetExtensionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetExtensionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetExtensionsCreateOrUpdateResponse, error) { respType := VirtualMachineScaleSetExtensionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineScaleSetExtension) @@ -4774,6 +4951,8 @@ type VirtualMachineScaleSetExtensionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetExtensionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetExtensionsDeleteResponse, error) { respType := VirtualMachineScaleSetExtensionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4842,6 +5021,8 @@ type VirtualMachineScaleSetExtensionsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetExtensionsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetExtensionsUpdateResponse, error) { respType := VirtualMachineScaleSetExtensionsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineScaleSetExtension) @@ -4892,6 +5073,8 @@ type VirtualMachineScaleSetRollingUpgradesCancelPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetRollingUpgradesCancelPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetRollingUpgradesCancelResponse, error) { respType := VirtualMachineScaleSetRollingUpgradesCancelResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4948,6 +5131,8 @@ type VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePollerResponse st } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeResponse, error) { respType := VirtualMachineScaleSetRollingUpgradesStartExtensionUpgradeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4992,6 +5177,8 @@ type VirtualMachineScaleSetRollingUpgradesStartOSUpgradePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetRollingUpgradesStartOSUpgradePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetRollingUpgradesStartOSUpgradeResponse, error) { respType := VirtualMachineScaleSetRollingUpgradesStartOSUpgradeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5036,6 +5223,8 @@ type VirtualMachineScaleSetVMExtensionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetVMExtensionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMExtensionsCreateOrUpdateResponse, error) { respType := VirtualMachineScaleSetVMExtensionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineScaleSetVMExtension) @@ -5086,6 +5275,8 @@ type VirtualMachineScaleSetVMExtensionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetVMExtensionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMExtensionsDeleteResponse, error) { respType := VirtualMachineScaleSetVMExtensionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5154,6 +5345,8 @@ type VirtualMachineScaleSetVMExtensionsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetVMExtensionsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMExtensionsUpdateResponse, error) { respType := VirtualMachineScaleSetVMExtensionsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineScaleSetVMExtension) @@ -5204,6 +5397,8 @@ type VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetVMRunCommandsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMRunCommandsCreateOrUpdateResponse, error) { respType := VirtualMachineScaleSetVMRunCommandsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineRunCommand) @@ -5254,6 +5449,8 @@ type VirtualMachineScaleSetVMRunCommandsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetVMRunCommandsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMRunCommandsDeleteResponse, error) { respType := VirtualMachineScaleSetVMRunCommandsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5322,6 +5519,8 @@ type VirtualMachineScaleSetVMRunCommandsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetVMRunCommandsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMRunCommandsUpdateResponse, error) { respType := VirtualMachineScaleSetVMRunCommandsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineRunCommand) @@ -5372,6 +5571,8 @@ type VirtualMachineScaleSetVMsDeallocatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetVMsDeallocatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsDeallocateResponse, error) { respType := VirtualMachineScaleSetVMsDeallocateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5416,6 +5617,8 @@ type VirtualMachineScaleSetVMsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetVMsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsDeleteResponse, error) { respType := VirtualMachineScaleSetVMsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5496,6 +5699,8 @@ type VirtualMachineScaleSetVMsPerformMaintenancePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetVMsPerformMaintenancePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsPerformMaintenanceResponse, error) { respType := VirtualMachineScaleSetVMsPerformMaintenanceResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5540,6 +5745,8 @@ type VirtualMachineScaleSetVMsPowerOffPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetVMsPowerOffPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsPowerOffResponse, error) { respType := VirtualMachineScaleSetVMsPowerOffResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5584,6 +5791,8 @@ type VirtualMachineScaleSetVMsRedeployPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetVMsRedeployPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsRedeployResponse, error) { respType := VirtualMachineScaleSetVMsRedeployResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5628,6 +5837,8 @@ type VirtualMachineScaleSetVMsReimageAllPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetVMsReimageAllPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsReimageAllResponse, error) { respType := VirtualMachineScaleSetVMsReimageAllResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5672,6 +5883,8 @@ type VirtualMachineScaleSetVMsReimagePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetVMsReimagePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsReimageResponse, error) { respType := VirtualMachineScaleSetVMsReimageResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5716,6 +5929,8 @@ type VirtualMachineScaleSetVMsRestartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetVMsRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsRestartResponse, error) { respType := VirtualMachineScaleSetVMsRestartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5772,6 +5987,8 @@ type VirtualMachineScaleSetVMsRunCommandPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetVMsRunCommandPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsRunCommandResponse, error) { respType := VirtualMachineScaleSetVMsRunCommandResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RunCommandResult) @@ -5828,6 +6045,8 @@ type VirtualMachineScaleSetVMsStartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetVMsStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsStartResponse, error) { respType := VirtualMachineScaleSetVMsStartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5872,6 +6091,8 @@ type VirtualMachineScaleSetVMsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetVMsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetVMsUpdateResponse, error) { respType := VirtualMachineScaleSetVMsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineScaleSetVM) @@ -5928,6 +6149,8 @@ type VirtualMachineScaleSetsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsCreateOrUpdateResponse, error) { respType := VirtualMachineScaleSetsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineScaleSet) @@ -5978,6 +6201,8 @@ type VirtualMachineScaleSetsDeallocatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetsDeallocatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsDeallocateResponse, error) { respType := VirtualMachineScaleSetsDeallocateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6022,6 +6247,8 @@ type VirtualMachineScaleSetsDeleteInstancesPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetsDeleteInstancesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsDeleteInstancesResponse, error) { respType := VirtualMachineScaleSetsDeleteInstancesResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6066,6 +6293,8 @@ type VirtualMachineScaleSetsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsDeleteResponse, error) { respType := VirtualMachineScaleSetsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6206,6 +6435,8 @@ type VirtualMachineScaleSetsPerformMaintenancePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetsPerformMaintenancePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsPerformMaintenanceResponse, error) { respType := VirtualMachineScaleSetsPerformMaintenanceResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6250,6 +6481,8 @@ type VirtualMachineScaleSetsPowerOffPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetsPowerOffPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsPowerOffResponse, error) { respType := VirtualMachineScaleSetsPowerOffResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6294,6 +6527,8 @@ type VirtualMachineScaleSetsRedeployPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetsRedeployPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsRedeployResponse, error) { respType := VirtualMachineScaleSetsRedeployResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6338,6 +6573,8 @@ type VirtualMachineScaleSetsReimageAllPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetsReimageAllPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsReimageAllResponse, error) { respType := VirtualMachineScaleSetsReimageAllResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6382,6 +6619,8 @@ type VirtualMachineScaleSetsReimagePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetsReimagePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsReimageResponse, error) { respType := VirtualMachineScaleSetsReimageResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6426,6 +6665,8 @@ type VirtualMachineScaleSetsRestartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetsRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsRestartResponse, error) { respType := VirtualMachineScaleSetsRestartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6470,6 +6711,8 @@ type VirtualMachineScaleSetsSetOrchestrationServiceStatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetsSetOrchestrationServiceStatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsSetOrchestrationServiceStateResponse, error) { respType := VirtualMachineScaleSetsSetOrchestrationServiceStateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6514,6 +6757,8 @@ type VirtualMachineScaleSetsStartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetsStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsStartResponse, error) { respType := VirtualMachineScaleSetsStartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6558,6 +6803,8 @@ type VirtualMachineScaleSetsUpdateInstancesPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetsUpdateInstancesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsUpdateInstancesResponse, error) { respType := VirtualMachineScaleSetsUpdateInstancesResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6602,6 +6849,8 @@ type VirtualMachineScaleSetsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachineScaleSetsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachineScaleSetsUpdateResponse, error) { respType := VirtualMachineScaleSetsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineScaleSet) @@ -6664,6 +6913,8 @@ type VirtualMachinesAssessPatchesPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachinesAssessPatchesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesAssessPatchesResponse, error) { respType := VirtualMachinesAssessPatchesResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineAssessPatchesResult) @@ -6714,6 +6965,8 @@ type VirtualMachinesCapturePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachinesCapturePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesCaptureResponse, error) { respType := VirtualMachinesCaptureResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineCaptureResult) @@ -6764,6 +7017,8 @@ type VirtualMachinesConvertToManagedDisksPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachinesConvertToManagedDisksPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesConvertToManagedDisksResponse, error) { respType := VirtualMachinesConvertToManagedDisksResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6808,6 +7063,8 @@ type VirtualMachinesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachinesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesCreateOrUpdateResponse, error) { respType := VirtualMachinesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachine) @@ -6858,6 +7115,8 @@ type VirtualMachinesDeallocatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachinesDeallocatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesDeallocateResponse, error) { respType := VirtualMachinesDeallocateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6902,6 +7161,8 @@ type VirtualMachinesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachinesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesDeleteResponse, error) { respType := VirtualMachinesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6964,6 +7225,8 @@ type VirtualMachinesInstallPatchesPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachinesInstallPatchesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesInstallPatchesResponse, error) { respType := VirtualMachinesInstallPatchesResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachineInstallPatchesResult) @@ -7074,6 +7337,8 @@ type VirtualMachinesPerformMaintenancePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachinesPerformMaintenancePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesPerformMaintenanceResponse, error) { respType := VirtualMachinesPerformMaintenanceResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7118,6 +7383,8 @@ type VirtualMachinesPowerOffPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachinesPowerOffPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesPowerOffResponse, error) { respType := VirtualMachinesPowerOffResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7162,6 +7429,8 @@ type VirtualMachinesReapplyPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachinesReapplyPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesReapplyResponse, error) { respType := VirtualMachinesReapplyResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7206,6 +7475,8 @@ type VirtualMachinesRedeployPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachinesRedeployPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesRedeployResponse, error) { respType := VirtualMachinesRedeployResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7250,6 +7521,8 @@ type VirtualMachinesReimagePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachinesReimagePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesReimageResponse, error) { respType := VirtualMachinesReimageResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7294,6 +7567,8 @@ type VirtualMachinesRestartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachinesRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesRestartResponse, error) { respType := VirtualMachinesRestartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7350,6 +7625,8 @@ type VirtualMachinesRunCommandPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachinesRunCommandPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesRunCommandResponse, error) { respType := VirtualMachinesRunCommandResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RunCommandResult) @@ -7406,6 +7683,8 @@ type VirtualMachinesStartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachinesStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesStartResponse, error) { respType := VirtualMachinesStartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7450,6 +7729,8 @@ type VirtualMachinesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualMachinesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualMachinesUpdateResponse, error) { respType := VirtualMachinesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualMachine) diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_restorepointcollections_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_restorepointcollections_client.go index 1b6194df7902..b9c6638924ea 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_restorepointcollections_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_restorepointcollections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RestorePointCollectionsClient contains the methods for the RestorePointCollections group. @@ -31,8 +31,15 @@ type RestorePointCollectionsClient struct { } // NewRestorePointCollectionsClient creates a new instance of RestorePointCollectionsClient with the specified values. -func NewRestorePointCollectionsClient(con *arm.Connection, subscriptionID string) *RestorePointCollectionsClient { - return &RestorePointCollectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRestorePointCollectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RestorePointCollectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RestorePointCollectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - The operation to create or update the restore point collection. Please refer to https://aka.ms/RestorePoints for more details. When @@ -83,7 +90,7 @@ func (client *RestorePointCollectionsClient) createOrUpdateCreateRequest(ctx con func (client *RestorePointCollectionsClient) createOrUpdateHandleResponse(resp *http.Response) (RestorePointCollectionsCreateOrUpdateResponse, error) { result := RestorePointCollectionsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorePointCollection); err != nil { - return RestorePointCollectionsCreateOrUpdateResponse{}, err + return RestorePointCollectionsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -227,7 +234,7 @@ func (client *RestorePointCollectionsClient) getCreateRequest(ctx context.Contex func (client *RestorePointCollectionsClient) getHandleResponse(resp *http.Response) (RestorePointCollectionsGetResponse, error) { result := RestorePointCollectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorePointCollection); err != nil { - return RestorePointCollectionsGetResponse{}, err + return RestorePointCollectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -285,7 +292,7 @@ func (client *RestorePointCollectionsClient) listCreateRequest(ctx context.Conte func (client *RestorePointCollectionsClient) listHandleResponse(resp *http.Response) (RestorePointCollectionsListResponse, error) { result := RestorePointCollectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorePointCollectionListResult); err != nil { - return RestorePointCollectionsListResponse{}, err + return RestorePointCollectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -341,7 +348,7 @@ func (client *RestorePointCollectionsClient) listAllCreateRequest(ctx context.Co func (client *RestorePointCollectionsClient) listAllHandleResponse(resp *http.Response) (RestorePointCollectionsListAllResponse, error) { result := RestorePointCollectionsListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorePointCollectionListResult); err != nil { - return RestorePointCollectionsListAllResponse{}, err + return RestorePointCollectionsListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -406,7 +413,7 @@ func (client *RestorePointCollectionsClient) updateCreateRequest(ctx context.Con func (client *RestorePointCollectionsClient) updateHandleResponse(resp *http.Response) (RestorePointCollectionsUpdateResponse, error) { result := RestorePointCollectionsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorePointCollection); err != nil { - return RestorePointCollectionsUpdateResponse{}, err + return RestorePointCollectionsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_restorepoints_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_restorepoints_client.go index b7cb39f4f94d..b1085a8e419d 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_restorepoints_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_restorepoints_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RestorePointsClient contains the methods for the RestorePoints group. @@ -31,8 +31,15 @@ type RestorePointsClient struct { } // NewRestorePointsClient creates a new instance of RestorePointsClient with the specified values. -func NewRestorePointsClient(con *arm.Connection, subscriptionID string) *RestorePointsClient { - return &RestorePointsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRestorePointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RestorePointsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RestorePointsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - The operation to create the restore point. Updating properties of an existing restore point is not allowed @@ -246,7 +253,7 @@ func (client *RestorePointsClient) getCreateRequest(ctx context.Context, resourc func (client *RestorePointsClient) getHandleResponse(resp *http.Response) (RestorePointsGetResponse, error) { result := RestorePointsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorePoint); err != nil { - return RestorePointsGetResponse{}, err + return RestorePointsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_sharedgalleries_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_sharedgalleries_client.go index f26c241ee61d..cbc3c13e5b09 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_sharedgalleries_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_sharedgalleries_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SharedGalleriesClient contains the methods for the SharedGalleries group. @@ -30,8 +31,15 @@ type SharedGalleriesClient struct { } // NewSharedGalleriesClient creates a new instance of SharedGalleriesClient with the specified values. -func NewSharedGalleriesClient(con *arm.Connection, subscriptionID string) *SharedGalleriesClient { - return &SharedGalleriesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSharedGalleriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SharedGalleriesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SharedGalleriesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get a shared gallery by subscription id or tenant id. @@ -81,7 +89,7 @@ func (client *SharedGalleriesClient) getCreateRequest(ctx context.Context, locat func (client *SharedGalleriesClient) getHandleResponse(resp *http.Response) (SharedGalleriesGetResponse, error) { result := SharedGalleriesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SharedGallery); err != nil { - return SharedGalleriesGetResponse{}, err + return SharedGalleriesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -142,7 +150,7 @@ func (client *SharedGalleriesClient) listCreateRequest(ctx context.Context, loca func (client *SharedGalleriesClient) listHandleResponse(resp *http.Response) (SharedGalleriesListResponse, error) { result := SharedGalleriesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SharedGalleryList); err != nil { - return SharedGalleriesListResponse{}, err + return SharedGalleriesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_sharedgalleryimages_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_sharedgalleryimages_client.go index 3b251dda8246..d300a503cfdc 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_sharedgalleryimages_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_sharedgalleryimages_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SharedGalleryImagesClient contains the methods for the SharedGalleryImages group. @@ -30,8 +31,15 @@ type SharedGalleryImagesClient struct { } // NewSharedGalleryImagesClient creates a new instance of SharedGalleryImagesClient with the specified values. -func NewSharedGalleryImagesClient(con *arm.Connection, subscriptionID string) *SharedGalleryImagesClient { - return &SharedGalleryImagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSharedGalleryImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SharedGalleryImagesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SharedGalleryImagesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get a shared gallery image by subscription id or tenant id. @@ -85,7 +93,7 @@ func (client *SharedGalleryImagesClient) getCreateRequest(ctx context.Context, l func (client *SharedGalleryImagesClient) getHandleResponse(resp *http.Response) (SharedGalleryImagesGetResponse, error) { result := SharedGalleryImagesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SharedGalleryImage); err != nil { - return SharedGalleryImagesGetResponse{}, err + return SharedGalleryImagesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -150,7 +158,7 @@ func (client *SharedGalleryImagesClient) listCreateRequest(ctx context.Context, func (client *SharedGalleryImagesClient) listHandleResponse(resp *http.Response) (SharedGalleryImagesListResponse, error) { result := SharedGalleryImagesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SharedGalleryImageList); err != nil { - return SharedGalleryImagesListResponse{}, err + return SharedGalleryImagesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_sharedgalleryimageversions_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_sharedgalleryimageversions_client.go index 7b6aef7276ea..6a46027c72b7 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_sharedgalleryimageversions_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_sharedgalleryimageversions_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SharedGalleryImageVersionsClient contains the methods for the SharedGalleryImageVersions group. @@ -30,8 +31,15 @@ type SharedGalleryImageVersionsClient struct { } // NewSharedGalleryImageVersionsClient creates a new instance of SharedGalleryImageVersionsClient with the specified values. -func NewSharedGalleryImageVersionsClient(con *arm.Connection, subscriptionID string) *SharedGalleryImageVersionsClient { - return &SharedGalleryImageVersionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSharedGalleryImageVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SharedGalleryImageVersionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SharedGalleryImageVersionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get a shared gallery image version by subscription id or tenant id. @@ -89,7 +97,7 @@ func (client *SharedGalleryImageVersionsClient) getCreateRequest(ctx context.Con func (client *SharedGalleryImageVersionsClient) getHandleResponse(resp *http.Response) (SharedGalleryImageVersionsGetResponse, error) { result := SharedGalleryImageVersionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SharedGalleryImageVersion); err != nil { - return SharedGalleryImageVersionsGetResponse{}, err + return SharedGalleryImageVersionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -158,7 +166,7 @@ func (client *SharedGalleryImageVersionsClient) listCreateRequest(ctx context.Co func (client *SharedGalleryImageVersionsClient) listHandleResponse(resp *http.Response) (SharedGalleryImageVersionsListResponse, error) { result := SharedGalleryImageVersionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SharedGalleryImageVersionList); err != nil { - return SharedGalleryImageVersionsListResponse{}, err + return SharedGalleryImageVersionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_snapshots_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_snapshots_client.go index 8ac9620e006e..171e83d2d44b 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_snapshots_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_snapshots_client.go @@ -11,14 +11,14 @@ package armcompute import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SnapshotsClient contains the methods for the Snapshots group. @@ -30,8 +30,15 @@ type SnapshotsClient struct { } // NewSnapshotsClient creates a new instance of SnapshotsClient with the specified values. -func NewSnapshotsClient(con *arm.Connection, subscriptionID string) *SnapshotsClient { - return &SnapshotsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSnapshotsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SnapshotsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SnapshotsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a snapshot. @@ -230,7 +237,7 @@ func (client *SnapshotsClient) getCreateRequest(ctx context.Context, resourceGro func (client *SnapshotsClient) getHandleResponse(resp *http.Response) (SnapshotsGetResponse, error) { result := SnapshotsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Snapshot); err != nil { - return SnapshotsGetResponse{}, err + return SnapshotsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -358,7 +365,7 @@ func (client *SnapshotsClient) listCreateRequest(ctx context.Context, options *S func (client *SnapshotsClient) listHandleResponse(resp *http.Response) (SnapshotsListResponse, error) { result := SnapshotsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotList); err != nil { - return SnapshotsListResponse{}, err + return SnapshotsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -415,7 +422,7 @@ func (client *SnapshotsClient) listByResourceGroupCreateRequest(ctx context.Cont func (client *SnapshotsClient) listByResourceGroupHandleResponse(resp *http.Response) (SnapshotsListByResourceGroupResponse, error) { result := SnapshotsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotList); err != nil { - return SnapshotsListByResourceGroupResponse{}, err + return SnapshotsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_sshpublickeys_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_sshpublickeys_client.go index 7e96de3eefac..93baf0f0673d 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_sshpublickeys_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_sshpublickeys_client.go @@ -11,13 +11,14 @@ package armcompute import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SSHPublicKeysClient contains the methods for the SSHPublicKeys group. @@ -29,8 +30,15 @@ type SSHPublicKeysClient struct { } // NewSSHPublicKeysClient creates a new instance of SSHPublicKeysClient with the specified values. -func NewSSHPublicKeysClient(con *arm.Connection, subscriptionID string) *SSHPublicKeysClient { - return &SSHPublicKeysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSSHPublicKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SSHPublicKeysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SSHPublicKeysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Creates a new SSH public key resource. @@ -80,7 +88,7 @@ func (client *SSHPublicKeysClient) createCreateRequest(ctx context.Context, reso func (client *SSHPublicKeysClient) createHandleResponse(resp *http.Response) (SSHPublicKeysCreateResponse, error) { result := SSHPublicKeysCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SSHPublicKeyResource); err != nil { - return SSHPublicKeysCreateResponse{}, err + return SSHPublicKeysCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -200,7 +208,7 @@ func (client *SSHPublicKeysClient) generateKeyPairCreateRequest(ctx context.Cont func (client *SSHPublicKeysClient) generateKeyPairHandleResponse(resp *http.Response) (SSHPublicKeysGenerateKeyPairResponse, error) { result := SSHPublicKeysGenerateKeyPairResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SSHPublicKeyGenerateKeyPairResult); err != nil { - return SSHPublicKeysGenerateKeyPairResponse{}, err + return SSHPublicKeysGenerateKeyPairResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -264,7 +272,7 @@ func (client *SSHPublicKeysClient) getCreateRequest(ctx context.Context, resourc func (client *SSHPublicKeysClient) getHandleResponse(resp *http.Response) (SSHPublicKeysGetResponse, error) { result := SSHPublicKeysGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SSHPublicKeyResource); err != nil { - return SSHPublicKeysGetResponse{}, err + return SSHPublicKeysGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -322,7 +330,7 @@ func (client *SSHPublicKeysClient) listByResourceGroupCreateRequest(ctx context. func (client *SSHPublicKeysClient) listByResourceGroupHandleResponse(resp *http.Response) (SSHPublicKeysListByResourceGroupResponse, error) { result := SSHPublicKeysListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SSHPublicKeysGroupListResult); err != nil { - return SSHPublicKeysListByResourceGroupResponse{}, err + return SSHPublicKeysListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -376,7 +384,7 @@ func (client *SSHPublicKeysClient) listBySubscriptionCreateRequest(ctx context.C func (client *SSHPublicKeysClient) listBySubscriptionHandleResponse(resp *http.Response) (SSHPublicKeysListBySubscriptionResponse, error) { result := SSHPublicKeysListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SSHPublicKeysGroupListResult); err != nil { - return SSHPublicKeysListBySubscriptionResponse{}, err + return SSHPublicKeysListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -440,7 +448,7 @@ func (client *SSHPublicKeysClient) updateCreateRequest(ctx context.Context, reso func (client *SSHPublicKeysClient) updateHandleResponse(resp *http.Response) (SSHPublicKeysUpdateResponse, error) { result := SSHPublicKeysUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SSHPublicKeyResource); err != nil { - return SSHPublicKeysUpdateResponse{}, err + return SSHPublicKeysUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_time_rfc3339.go b/sdk/resourcemanager/compute/armcompute/zz_generated_time_rfc3339.go index 07a2d81ca612..bee0d21a59a4 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armcompute import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_usage_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_usage_client.go index 62f7c4199e3e..e5dc6cc1efe7 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_usage_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_usage_client.go @@ -11,13 +11,14 @@ package armcompute import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // UsageClient contains the methods for the Usage group. @@ -29,8 +30,15 @@ type UsageClient struct { } // NewUsageClient creates a new instance of UsageClient with the specified values. -func NewUsageClient(con *arm.Connection, subscriptionID string) *UsageClient { - return &UsageClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewUsageClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UsageClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &UsageClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets, for the specified location, the current compute resource usage information as well as the limits for compute resources under the subscription. @@ -73,7 +81,7 @@ func (client *UsageClient) listCreateRequest(ctx context.Context, location strin func (client *UsageClient) listHandleResponse(resp *http.Response) (UsageListResponse, error) { result := UsageListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListUsagesResult); err != nil { - return UsageListResponse{}, err + return UsageListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineextensionimages_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineextensionimages_client.go index a14c59e23f2f..d5c5875826d3 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineextensionimages_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineextensionimages_client.go @@ -11,14 +11,15 @@ package armcompute import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // VirtualMachineExtensionImagesClient contains the methods for the VirtualMachineExtensionImages group. @@ -30,8 +31,15 @@ type VirtualMachineExtensionImagesClient struct { } // NewVirtualMachineExtensionImagesClient creates a new instance of VirtualMachineExtensionImagesClient with the specified values. -func NewVirtualMachineExtensionImagesClient(con *arm.Connection, subscriptionID string) *VirtualMachineExtensionImagesClient { - return &VirtualMachineExtensionImagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualMachineExtensionImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualMachineExtensionImagesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualMachineExtensionImagesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a virtual machine extension image. @@ -89,7 +97,7 @@ func (client *VirtualMachineExtensionImagesClient) getCreateRequest(ctx context. func (client *VirtualMachineExtensionImagesClient) getHandleResponse(resp *http.Response) (VirtualMachineExtensionImagesGetResponse, error) { result := VirtualMachineExtensionImagesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineExtensionImage); err != nil { - return VirtualMachineExtensionImagesGetResponse{}, err + return VirtualMachineExtensionImagesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -153,7 +161,7 @@ func (client *VirtualMachineExtensionImagesClient) listTypesCreateRequest(ctx co func (client *VirtualMachineExtensionImagesClient) listTypesHandleResponse(resp *http.Response) (VirtualMachineExtensionImagesListTypesResponse, error) { result := VirtualMachineExtensionImagesListTypesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineExtensionImageArray); err != nil { - return VirtualMachineExtensionImagesListTypesResponse{}, err + return VirtualMachineExtensionImagesListTypesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -230,7 +238,7 @@ func (client *VirtualMachineExtensionImagesClient) listVersionsCreateRequest(ctx func (client *VirtualMachineExtensionImagesClient) listVersionsHandleResponse(resp *http.Response) (VirtualMachineExtensionImagesListVersionsResponse, error) { result := VirtualMachineExtensionImagesListVersionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineExtensionImageArray); err != nil { - return VirtualMachineExtensionImagesListVersionsResponse{}, err + return VirtualMachineExtensionImagesListVersionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineextensions_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineextensions_client.go index 68d258920f08..c4a0403586a5 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineextensions_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineextensions_client.go @@ -11,14 +11,14 @@ package armcompute import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualMachineExtensionsClient contains the methods for the VirtualMachineExtensions group. @@ -30,8 +30,15 @@ type VirtualMachineExtensionsClient struct { } // NewVirtualMachineExtensionsClient creates a new instance of VirtualMachineExtensionsClient with the specified values. -func NewVirtualMachineExtensionsClient(con *arm.Connection, subscriptionID string) *VirtualMachineExtensionsClient { - return &VirtualMachineExtensionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualMachineExtensionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualMachineExtensionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualMachineExtensionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - The operation to create or update the extension. @@ -245,7 +252,7 @@ func (client *VirtualMachineExtensionsClient) getCreateRequest(ctx context.Conte func (client *VirtualMachineExtensionsClient) getHandleResponse(resp *http.Response) (VirtualMachineExtensionsGetResponse, error) { result := VirtualMachineExtensionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineExtension); err != nil { - return VirtualMachineExtensionsGetResponse{}, err + return VirtualMachineExtensionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -312,7 +319,7 @@ func (client *VirtualMachineExtensionsClient) listCreateRequest(ctx context.Cont func (client *VirtualMachineExtensionsClient) listHandleResponse(resp *http.Response) (VirtualMachineExtensionsListResponse, error) { result := VirtualMachineExtensionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineExtensionsListResult); err != nil { - return VirtualMachineExtensionsListResponse{}, err + return VirtualMachineExtensionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineimages_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineimages_client.go index adc40788c495..f4e955af6be9 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineimages_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineimages_client.go @@ -11,14 +11,15 @@ package armcompute import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // VirtualMachineImagesClient contains the methods for the VirtualMachineImages group. @@ -30,8 +31,15 @@ type VirtualMachineImagesClient struct { } // NewVirtualMachineImagesClient creates a new instance of VirtualMachineImagesClient with the specified values. -func NewVirtualMachineImagesClient(con *arm.Connection, subscriptionID string) *VirtualMachineImagesClient { - return &VirtualMachineImagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualMachineImagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualMachineImagesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualMachineImagesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a virtual machine image. @@ -93,7 +101,7 @@ func (client *VirtualMachineImagesClient) getCreateRequest(ctx context.Context, func (client *VirtualMachineImagesClient) getHandleResponse(resp *http.Response) (VirtualMachineImagesGetResponse, error) { result := VirtualMachineImagesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImage); err != nil { - return VirtualMachineImagesGetResponse{}, err + return VirtualMachineImagesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -174,7 +182,7 @@ func (client *VirtualMachineImagesClient) listCreateRequest(ctx context.Context, func (client *VirtualMachineImagesClient) listHandleResponse(resp *http.Response) (VirtualMachineImagesListResponse, error) { result := VirtualMachineImagesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { - return VirtualMachineImagesListResponse{}, err + return VirtualMachineImagesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -238,7 +246,7 @@ func (client *VirtualMachineImagesClient) listOffersCreateRequest(ctx context.Co func (client *VirtualMachineImagesClient) listOffersHandleResponse(resp *http.Response) (VirtualMachineImagesListOffersResponse, error) { result := VirtualMachineImagesListOffersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { - return VirtualMachineImagesListOffersResponse{}, err + return VirtualMachineImagesListOffersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +306,7 @@ func (client *VirtualMachineImagesClient) listPublishersCreateRequest(ctx contex func (client *VirtualMachineImagesClient) listPublishersHandleResponse(resp *http.Response) (VirtualMachineImagesListPublishersResponse, error) { result := VirtualMachineImagesListPublishersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { - return VirtualMachineImagesListPublishersResponse{}, err + return VirtualMachineImagesListPublishersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -366,7 +374,7 @@ func (client *VirtualMachineImagesClient) listSKUsCreateRequest(ctx context.Cont func (client *VirtualMachineImagesClient) listSKUsHandleResponse(resp *http.Response) (VirtualMachineImagesListSKUsResponse, error) { result := VirtualMachineImagesListSKUsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { - return VirtualMachineImagesListSKUsResponse{}, err + return VirtualMachineImagesListSKUsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineimagesedgezone_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineimagesedgezone_client.go index 4d7798ac7bf1..512a750f919e 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineimagesedgezone_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineimagesedgezone_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // VirtualMachineImagesEdgeZoneClient contains the methods for the VirtualMachineImagesEdgeZone group. @@ -31,8 +32,15 @@ type VirtualMachineImagesEdgeZoneClient struct { } // NewVirtualMachineImagesEdgeZoneClient creates a new instance of VirtualMachineImagesEdgeZoneClient with the specified values. -func NewVirtualMachineImagesEdgeZoneClient(con *arm.Connection, subscriptionID string) *VirtualMachineImagesEdgeZoneClient { - return &VirtualMachineImagesEdgeZoneClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualMachineImagesEdgeZoneClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualMachineImagesEdgeZoneClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualMachineImagesEdgeZoneClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a virtual machine image in an edge zone. @@ -98,7 +106,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) getCreateRequest(ctx context.C func (client *VirtualMachineImagesEdgeZoneClient) getHandleResponse(resp *http.Response) (VirtualMachineImagesEdgeZoneGetResponse, error) { result := VirtualMachineImagesEdgeZoneGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImage); err != nil { - return VirtualMachineImagesEdgeZoneGetResponse{}, err + return VirtualMachineImagesEdgeZoneGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -184,7 +192,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listCreateRequest(ctx context. func (client *VirtualMachineImagesEdgeZoneClient) listHandleResponse(resp *http.Response) (VirtualMachineImagesEdgeZoneListResponse, error) { result := VirtualMachineImagesEdgeZoneListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { - return VirtualMachineImagesEdgeZoneListResponse{}, err + return VirtualMachineImagesEdgeZoneListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -253,7 +261,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listOffersCreateRequest(ctx co func (client *VirtualMachineImagesEdgeZoneClient) listOffersHandleResponse(resp *http.Response) (VirtualMachineImagesEdgeZoneListOffersResponse, error) { result := VirtualMachineImagesEdgeZoneListOffersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { - return VirtualMachineImagesEdgeZoneListOffersResponse{}, err + return VirtualMachineImagesEdgeZoneListOffersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -318,7 +326,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listPublishersCreateRequest(ct func (client *VirtualMachineImagesEdgeZoneClient) listPublishersHandleResponse(resp *http.Response) (VirtualMachineImagesEdgeZoneListPublishersResponse, error) { result := VirtualMachineImagesEdgeZoneListPublishersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { - return VirtualMachineImagesEdgeZoneListPublishersResponse{}, err + return VirtualMachineImagesEdgeZoneListPublishersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -391,7 +399,7 @@ func (client *VirtualMachineImagesEdgeZoneClient) listSKUsCreateRequest(ctx cont func (client *VirtualMachineImagesEdgeZoneClient) listSKUsHandleResponse(resp *http.Response) (VirtualMachineImagesEdgeZoneListSKUsResponse, error) { result := VirtualMachineImagesEdgeZoneListSKUsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineImageResourceArray); err != nil { - return VirtualMachineImagesEdgeZoneListSKUsResponse{}, err + return VirtualMachineImagesEdgeZoneListSKUsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineruncommands_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineruncommands_client.go index f89264c70820..6b1c841df69d 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineruncommands_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachineruncommands_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualMachineRunCommandsClient contains the methods for the VirtualMachineRunCommands group. @@ -31,8 +31,15 @@ type VirtualMachineRunCommandsClient struct { } // NewVirtualMachineRunCommandsClient creates a new instance of VirtualMachineRunCommandsClient with the specified values. -func NewVirtualMachineRunCommandsClient(con *arm.Connection, subscriptionID string) *VirtualMachineRunCommandsClient { - return &VirtualMachineRunCommandsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualMachineRunCommandsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualMachineRunCommandsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualMachineRunCommandsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - The operation to create or update the run command. @@ -242,7 +249,7 @@ func (client *VirtualMachineRunCommandsClient) getCreateRequest(ctx context.Cont func (client *VirtualMachineRunCommandsClient) getHandleResponse(resp *http.Response) (VirtualMachineRunCommandsGetResponse, error) { result := VirtualMachineRunCommandsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RunCommandDocument); err != nil { - return VirtualMachineRunCommandsGetResponse{}, err + return VirtualMachineRunCommandsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -313,7 +320,7 @@ func (client *VirtualMachineRunCommandsClient) getByVirtualMachineCreateRequest( func (client *VirtualMachineRunCommandsClient) getByVirtualMachineHandleResponse(resp *http.Response) (VirtualMachineRunCommandsGetByVirtualMachineResponse, error) { result := VirtualMachineRunCommandsGetByVirtualMachineResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineRunCommand); err != nil { - return VirtualMachineRunCommandsGetByVirtualMachineResponse{}, err + return VirtualMachineRunCommandsGetByVirtualMachineResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -371,7 +378,7 @@ func (client *VirtualMachineRunCommandsClient) listCreateRequest(ctx context.Con func (client *VirtualMachineRunCommandsClient) listHandleResponse(resp *http.Response) (VirtualMachineRunCommandsListResponse, error) { result := VirtualMachineRunCommandsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RunCommandListResult); err != nil { - return VirtualMachineRunCommandsListResponse{}, err + return VirtualMachineRunCommandsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -435,7 +442,7 @@ func (client *VirtualMachineRunCommandsClient) listByVirtualMachineCreateRequest func (client *VirtualMachineRunCommandsClient) listByVirtualMachineHandleResponse(resp *http.Response) (VirtualMachineRunCommandsListByVirtualMachineResponse, error) { result := VirtualMachineRunCommandsListByVirtualMachineResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineRunCommandsListResult); err != nil { - return VirtualMachineRunCommandsListByVirtualMachineResponse{}, err + return VirtualMachineRunCommandsListByVirtualMachineResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachines_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachines_client.go index 34a6dd3be6a6..fa039bd371a6 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachines_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachines_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // VirtualMachinesClient contains the methods for the VirtualMachines group. @@ -32,8 +32,15 @@ type VirtualMachinesClient struct { } // NewVirtualMachinesClient creates a new instance of VirtualMachinesClient with the specified values. -func NewVirtualMachinesClient(con *arm.Connection, subscriptionID string) *VirtualMachinesClient { - return &VirtualMachinesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualMachinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualMachinesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualMachinesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginAssessPatches - Assess patches on the VM. @@ -602,7 +609,7 @@ func (client *VirtualMachinesClient) getCreateRequest(ctx context.Context, resou func (client *VirtualMachinesClient) getHandleResponse(resp *http.Response) (VirtualMachinesGetResponse, error) { result := VirtualMachinesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachine); err != nil { - return VirtualMachinesGetResponse{}, err + return VirtualMachinesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -742,7 +749,7 @@ func (client *VirtualMachinesClient) instanceViewCreateRequest(ctx context.Conte func (client *VirtualMachinesClient) instanceViewHandleResponse(resp *http.Response) (VirtualMachinesInstanceViewResponse, error) { result := VirtualMachinesInstanceViewResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineInstanceView); err != nil { - return VirtualMachinesInstanceViewResponse{}, err + return VirtualMachinesInstanceViewResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -799,7 +806,7 @@ func (client *VirtualMachinesClient) listCreateRequest(ctx context.Context, reso func (client *VirtualMachinesClient) listHandleResponse(resp *http.Response) (VirtualMachinesListResponse, error) { result := VirtualMachinesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineListResult); err != nil { - return VirtualMachinesListResponse{}, err + return VirtualMachinesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -856,7 +863,7 @@ func (client *VirtualMachinesClient) listAllCreateRequest(ctx context.Context, o func (client *VirtualMachinesClient) listAllHandleResponse(resp *http.Response) (VirtualMachinesListAllResponse, error) { result := VirtualMachinesListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineListResult); err != nil { - return VirtualMachinesListAllResponse{}, err + return VirtualMachinesListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -920,7 +927,7 @@ func (client *VirtualMachinesClient) listAvailableSizesCreateRequest(ctx context func (client *VirtualMachinesClient) listAvailableSizesHandleResponse(resp *http.Response) (VirtualMachinesListAvailableSizesResponse, error) { result := VirtualMachinesListAvailableSizesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineSizeListResult); err != nil { - return VirtualMachinesListAvailableSizesResponse{}, err + return VirtualMachinesListAvailableSizesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -977,7 +984,7 @@ func (client *VirtualMachinesClient) listByLocationCreateRequest(ctx context.Con func (client *VirtualMachinesClient) listByLocationHandleResponse(resp *http.Response) (VirtualMachinesListByLocationResponse, error) { result := VirtualMachinesListByLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineListResult); err != nil { - return VirtualMachinesListByLocationResponse{}, err + return VirtualMachinesListByLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1498,7 +1505,7 @@ func (client *VirtualMachinesClient) retrieveBootDiagnosticsDataCreateRequest(ct func (client *VirtualMachinesClient) retrieveBootDiagnosticsDataHandleResponse(resp *http.Response) (VirtualMachinesRetrieveBootDiagnosticsDataResponse, error) { result := VirtualMachinesRetrieveBootDiagnosticsDataResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RetrieveBootDiagnosticsDataResult); err != nil { - return VirtualMachinesRetrieveBootDiagnosticsDataResponse{}, err + return VirtualMachinesRetrieveBootDiagnosticsDataResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetextensions_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetextensions_client.go index a4f6b67bc6f5..baa6004a67a5 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetextensions_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetextensions_client.go @@ -11,14 +11,14 @@ package armcompute import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualMachineScaleSetExtensionsClient contains the methods for the VirtualMachineScaleSetExtensions group. @@ -30,8 +30,15 @@ type VirtualMachineScaleSetExtensionsClient struct { } // NewVirtualMachineScaleSetExtensionsClient creates a new instance of VirtualMachineScaleSetExtensionsClient with the specified values. -func NewVirtualMachineScaleSetExtensionsClient(con *arm.Connection, subscriptionID string) *VirtualMachineScaleSetExtensionsClient { - return &VirtualMachineScaleSetExtensionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualMachineScaleSetExtensionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualMachineScaleSetExtensionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualMachineScaleSetExtensionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - The operation to create or update an extension. @@ -245,7 +252,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) getCreateRequest(ctx conte func (client *VirtualMachineScaleSetExtensionsClient) getHandleResponse(resp *http.Response) (VirtualMachineScaleSetExtensionsGetResponse, error) { result := VirtualMachineScaleSetExtensionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetExtension); err != nil { - return VirtualMachineScaleSetExtensionsGetResponse{}, err + return VirtualMachineScaleSetExtensionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -306,7 +313,7 @@ func (client *VirtualMachineScaleSetExtensionsClient) listCreateRequest(ctx cont func (client *VirtualMachineScaleSetExtensionsClient) listHandleResponse(resp *http.Response) (VirtualMachineScaleSetExtensionsListResponse, error) { result := VirtualMachineScaleSetExtensionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetExtensionListResult); err != nil { - return VirtualMachineScaleSetExtensionsListResponse{}, err + return VirtualMachineScaleSetExtensionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetrollingupgrades_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetrollingupgrades_client.go index 69a8a8390d08..ac9e7afbfa36 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetrollingupgrades_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetrollingupgrades_client.go @@ -11,14 +11,14 @@ package armcompute import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualMachineScaleSetRollingUpgradesClient contains the methods for the VirtualMachineScaleSetRollingUpgrades group. @@ -30,8 +30,15 @@ type VirtualMachineScaleSetRollingUpgradesClient struct { } // NewVirtualMachineScaleSetRollingUpgradesClient creates a new instance of VirtualMachineScaleSetRollingUpgradesClient with the specified values. -func NewVirtualMachineScaleSetRollingUpgradesClient(con *arm.Connection, subscriptionID string) *VirtualMachineScaleSetRollingUpgradesClient { - return &VirtualMachineScaleSetRollingUpgradesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualMachineScaleSetRollingUpgradesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualMachineScaleSetRollingUpgradesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualMachineScaleSetRollingUpgradesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCancel - Cancels the current virtual machine scale set rolling upgrade. @@ -155,7 +162,7 @@ func (client *VirtualMachineScaleSetRollingUpgradesClient) getLatestCreateReques func (client *VirtualMachineScaleSetRollingUpgradesClient) getLatestHandleResponse(resp *http.Response) (VirtualMachineScaleSetRollingUpgradesGetLatestResponse, error) { result := VirtualMachineScaleSetRollingUpgradesGetLatestResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RollingUpgradeStatusInfo); err != nil { - return VirtualMachineScaleSetRollingUpgradesGetLatestResponse{}, err + return VirtualMachineScaleSetRollingUpgradesGetLatestResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesets_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesets_client.go index fda4ba770dd9..79adbca0aa1e 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesets_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesets_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // VirtualMachineScaleSetsClient contains the methods for the VirtualMachineScaleSets group. @@ -32,8 +32,15 @@ type VirtualMachineScaleSetsClient struct { } // NewVirtualMachineScaleSetsClient creates a new instance of VirtualMachineScaleSetsClient with the specified values. -func NewVirtualMachineScaleSetsClient(con *arm.Connection, subscriptionID string) *VirtualMachineScaleSetsClient { - return &VirtualMachineScaleSetsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualMachineScaleSetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualMachineScaleSetsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualMachineScaleSetsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ConvertToSinglePlacementGroup - Converts SinglePlacementGroup property to false for a existing virtual machine scale set. @@ -449,7 +456,7 @@ func (client *VirtualMachineScaleSetsClient) forceRecoveryServiceFabricPlatformU func (client *VirtualMachineScaleSetsClient) forceRecoveryServiceFabricPlatformUpdateDomainWalkHandleResponse(resp *http.Response) (VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse, error) { result := VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecoveryWalkResponse); err != nil { - return VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse{}, err + return VirtualMachineScaleSetsForceRecoveryServiceFabricPlatformUpdateDomainWalkResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -516,7 +523,7 @@ func (client *VirtualMachineScaleSetsClient) getCreateRequest(ctx context.Contex func (client *VirtualMachineScaleSetsClient) getHandleResponse(resp *http.Response) (VirtualMachineScaleSetsGetResponse, error) { result := VirtualMachineScaleSetsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSet); err != nil { - return VirtualMachineScaleSetsGetResponse{}, err + return VirtualMachineScaleSetsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -580,7 +587,7 @@ func (client *VirtualMachineScaleSetsClient) getInstanceViewCreateRequest(ctx co func (client *VirtualMachineScaleSetsClient) getInstanceViewHandleResponse(resp *http.Response) (VirtualMachineScaleSetsGetInstanceViewResponse, error) { result := VirtualMachineScaleSetsGetInstanceViewResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetInstanceView); err != nil { - return VirtualMachineScaleSetsGetInstanceViewResponse{}, err + return VirtualMachineScaleSetsGetInstanceViewResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -641,7 +648,7 @@ func (client *VirtualMachineScaleSetsClient) getOSUpgradeHistoryCreateRequest(ct func (client *VirtualMachineScaleSetsClient) getOSUpgradeHistoryHandleResponse(resp *http.Response) (VirtualMachineScaleSetsGetOSUpgradeHistoryResponse, error) { result := VirtualMachineScaleSetsGetOSUpgradeHistoryResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetListOSUpgradeHistory); err != nil { - return VirtualMachineScaleSetsGetOSUpgradeHistoryResponse{}, err + return VirtualMachineScaleSetsGetOSUpgradeHistoryResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -698,7 +705,7 @@ func (client *VirtualMachineScaleSetsClient) listCreateRequest(ctx context.Conte func (client *VirtualMachineScaleSetsClient) listHandleResponse(resp *http.Response) (VirtualMachineScaleSetsListResponse, error) { result := VirtualMachineScaleSetsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetListResult); err != nil { - return VirtualMachineScaleSetsListResponse{}, err + return VirtualMachineScaleSetsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -753,7 +760,7 @@ func (client *VirtualMachineScaleSetsClient) listAllCreateRequest(ctx context.Co func (client *VirtualMachineScaleSetsClient) listAllHandleResponse(resp *http.Response) (VirtualMachineScaleSetsListAllResponse, error) { result := VirtualMachineScaleSetsListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetListWithLinkResult); err != nil { - return VirtualMachineScaleSetsListAllResponse{}, err + return VirtualMachineScaleSetsListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -810,7 +817,7 @@ func (client *VirtualMachineScaleSetsClient) listByLocationCreateRequest(ctx con func (client *VirtualMachineScaleSetsClient) listByLocationHandleResponse(resp *http.Response) (VirtualMachineScaleSetsListByLocationResponse, error) { result := VirtualMachineScaleSetsListByLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetListResult); err != nil { - return VirtualMachineScaleSetsListByLocationResponse{}, err + return VirtualMachineScaleSetsListByLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -872,7 +879,7 @@ func (client *VirtualMachineScaleSetsClient) listSKUsCreateRequest(ctx context.C func (client *VirtualMachineScaleSetsClient) listSKUsHandleResponse(resp *http.Response) (VirtualMachineScaleSetsListSKUsResponse, error) { result := VirtualMachineScaleSetsListSKUsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetListSKUsResult); err != nil { - return VirtualMachineScaleSetsListSKUsResponse{}, err + return VirtualMachineScaleSetsListSKUsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetvmextensions_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetvmextensions_client.go index a38b0aeed786..ec38190e41d4 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetvmextensions_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetvmextensions_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualMachineScaleSetVMExtensionsClient contains the methods for the VirtualMachineScaleSetVMExtensions group. @@ -31,8 +31,15 @@ type VirtualMachineScaleSetVMExtensionsClient struct { } // NewVirtualMachineScaleSetVMExtensionsClient creates a new instance of VirtualMachineScaleSetVMExtensionsClient with the specified values. -func NewVirtualMachineScaleSetVMExtensionsClient(con *arm.Connection, subscriptionID string) *VirtualMachineScaleSetVMExtensionsClient { - return &VirtualMachineScaleSetVMExtensionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualMachineScaleSetVMExtensionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualMachineScaleSetVMExtensionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualMachineScaleSetVMExtensionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - The operation to create or update the VMSS VM extension. @@ -261,7 +268,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) getCreateRequest(ctx con func (client *VirtualMachineScaleSetVMExtensionsClient) getHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMExtensionsGetResponse, error) { result := VirtualMachineScaleSetVMExtensionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetVMExtension); err != nil { - return VirtualMachineScaleSetVMExtensionsGetResponse{}, err + return VirtualMachineScaleSetVMExtensionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -333,7 +340,7 @@ func (client *VirtualMachineScaleSetVMExtensionsClient) listCreateRequest(ctx co func (client *VirtualMachineScaleSetVMExtensionsClient) listHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMExtensionsListResponse, error) { result := VirtualMachineScaleSetVMExtensionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetVMExtensionsListResult); err != nil { - return VirtualMachineScaleSetVMExtensionsListResponse{}, err + return VirtualMachineScaleSetVMExtensionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetvmruncommands_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetvmruncommands_client.go index 40a65690bdae..98704224d870 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetvmruncommands_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetvmruncommands_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualMachineScaleSetVMRunCommandsClient contains the methods for the VirtualMachineScaleSetVMRunCommands group. @@ -31,8 +31,15 @@ type VirtualMachineScaleSetVMRunCommandsClient struct { } // NewVirtualMachineScaleSetVMRunCommandsClient creates a new instance of VirtualMachineScaleSetVMRunCommandsClient with the specified values. -func NewVirtualMachineScaleSetVMRunCommandsClient(con *arm.Connection, subscriptionID string) *VirtualMachineScaleSetVMRunCommandsClient { - return &VirtualMachineScaleSetVMRunCommandsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualMachineScaleSetVMRunCommandsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualMachineScaleSetVMRunCommandsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualMachineScaleSetVMRunCommandsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - The operation to create or update the VMSS VM run command. @@ -261,7 +268,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) getCreateRequest(ctx co func (client *VirtualMachineScaleSetVMRunCommandsClient) getHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMRunCommandsGetResponse, error) { result := VirtualMachineScaleSetVMRunCommandsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineRunCommand); err != nil { - return VirtualMachineScaleSetVMRunCommandsGetResponse{}, err + return VirtualMachineScaleSetVMRunCommandsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -330,7 +337,7 @@ func (client *VirtualMachineScaleSetVMRunCommandsClient) listCreateRequest(ctx c func (client *VirtualMachineScaleSetVMRunCommandsClient) listHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMRunCommandsListResponse, error) { result := VirtualMachineScaleSetVMRunCommandsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineRunCommandsListResult); err != nil { - return VirtualMachineScaleSetVMRunCommandsListResponse{}, err + return VirtualMachineScaleSetVMRunCommandsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetvms_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetvms_client.go index 9c43b9241f22..e9b975c93b2e 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetvms_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinescalesetvms_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // VirtualMachineScaleSetVMsClient contains the methods for the VirtualMachineScaleSetVMs group. @@ -32,8 +32,15 @@ type VirtualMachineScaleSetVMsClient struct { } // NewVirtualMachineScaleSetVMsClient creates a new instance of VirtualMachineScaleSetVMsClient with the specified values. -func NewVirtualMachineScaleSetVMsClient(con *arm.Connection, subscriptionID string) *VirtualMachineScaleSetVMsClient { - return &VirtualMachineScaleSetVMsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualMachineScaleSetVMsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualMachineScaleSetVMsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualMachineScaleSetVMsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginDeallocate - Deallocates a specific virtual machine in a VM scale set. Shuts down the virtual machine and releases the compute resources it uses. @@ -253,7 +260,7 @@ func (client *VirtualMachineScaleSetVMsClient) getCreateRequest(ctx context.Cont func (client *VirtualMachineScaleSetVMsClient) getHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMsGetResponse, error) { result := VirtualMachineScaleSetVMsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetVM); err != nil { - return VirtualMachineScaleSetVMsGetResponse{}, err + return VirtualMachineScaleSetVMsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -321,7 +328,7 @@ func (client *VirtualMachineScaleSetVMsClient) getInstanceViewCreateRequest(ctx func (client *VirtualMachineScaleSetVMsClient) getInstanceViewHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMsGetInstanceViewResponse, error) { result := VirtualMachineScaleSetVMsGetInstanceViewResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetVMInstanceView); err != nil { - return VirtualMachineScaleSetVMsGetInstanceViewResponse{}, err + return VirtualMachineScaleSetVMsGetInstanceViewResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -391,7 +398,7 @@ func (client *VirtualMachineScaleSetVMsClient) listCreateRequest(ctx context.Con func (client *VirtualMachineScaleSetVMsClient) listHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMsListResponse, error) { result := VirtualMachineScaleSetVMsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineScaleSetVMListResult); err != nil { - return VirtualMachineScaleSetVMsListResponse{}, err + return VirtualMachineScaleSetVMsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -942,7 +949,7 @@ func (client *VirtualMachineScaleSetVMsClient) retrieveBootDiagnosticsDataCreate func (client *VirtualMachineScaleSetVMsClient) retrieveBootDiagnosticsDataHandleResponse(resp *http.Response) (VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataResponse, error) { result := VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RetrieveBootDiagnosticsDataResult); err != nil { - return VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataResponse{}, err + return VirtualMachineScaleSetVMsRetrieveBootDiagnosticsDataResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinesizes_client.go b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinesizes_client.go index 6e1ded2d8b15..a52e43e50b80 100644 --- a/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinesizes_client.go +++ b/sdk/resourcemanager/compute/armcompute/zz_generated_virtualmachinesizes_client.go @@ -11,13 +11,14 @@ package armcompute import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualMachineSizesClient contains the methods for the VirtualMachineSizes group. @@ -29,8 +30,15 @@ type VirtualMachineSizesClient struct { } // NewVirtualMachineSizesClient creates a new instance of VirtualMachineSizesClient with the specified values. -func NewVirtualMachineSizesClient(con *arm.Connection, subscriptionID string) *VirtualMachineSizesClient { - return &VirtualMachineSizesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualMachineSizesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualMachineSizesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualMachineSizesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - This API is deprecated. Use Resources Skus [https://docs.microsoft.com/rest/api/compute/resourceskus/list] @@ -76,7 +84,7 @@ func (client *VirtualMachineSizesClient) listCreateRequest(ctx context.Context, func (client *VirtualMachineSizesClient) listHandleResponse(resp *http.Response) (VirtualMachineSizesListResponse, error) { result := VirtualMachineSizesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualMachineSizeListResult); err != nil { - return VirtualMachineSizesListResponse{}, err + return VirtualMachineSizesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/consumption/armconsumption/CHANGELOG.md b/sdk/resourcemanager/consumption/armconsumption/CHANGELOG.md index 1f7250ae5937..626bf7231e27 100644 --- a/sdk/resourcemanager/consumption/armconsumption/CHANGELOG.md +++ b/sdk/resourcemanager/consumption/armconsumption/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-10-20) - Initial preview release. diff --git a/sdk/resourcemanager/consumption/armconsumption/README.md b/sdk/resourcemanager/consumption/armconsumption/README.md index e6683d9e14a1..e9efd3579ceb 100644 --- a/sdk/resourcemanager/consumption/armconsumption/README.md +++ b/sdk/resourcemanager/consumption/armconsumption/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Consumption +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Consumption modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armconsumption.NewPriceSheetClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Consumption modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armconsumption.NewPriceSheetClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armconsumption.NewPriceSheetClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/consumption/armconsumption/autorest.md b/sdk/resourcemanager/consumption/armconsumption/autorest.md index 26112f484b8f..bdc84a84593c 100644 --- a/sdk/resourcemanager/consumption/armconsumption/autorest.md +++ b/sdk/resourcemanager/consumption/armconsumption/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/009e56c61035aab068711e519a9df73ae40654b2/specification/consumption/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/009e56c61035aab068711e519a9df73ae40654b2/specification/consumption/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/consumption/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/consumption/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/consumption/armconsumption/go.mod b/sdk/resourcemanager/consumption/armconsumption/go.mod index d019611b3ca2..31dea06e9606 100644 --- a/sdk/resourcemanager/consumption/armconsumption/go.mod +++ b/sdk/resourcemanager/consumption/armconsumption/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/consumption/armcons go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.2.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/consumption/armconsumption/go.sum b/sdk/resourcemanager/consumption/armconsumption/go.sum index c8ff7a2143ad..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/consumption/armconsumption/go.sum +++ b/sdk/resourcemanager/consumption/armconsumption/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible h1:iCb2tuoEm3N7ZpUDOvu1Yxl1B3iOVDmaD6weaRuIPzs= -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_aggregatedcost_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_aggregatedcost_client.go index ff59a12ee212..a871478dad52 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_aggregatedcost_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_aggregatedcost_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AggregatedCostClient contains the methods for the AggregatedCost group. @@ -29,8 +30,15 @@ type AggregatedCostClient struct { } // NewAggregatedCostClient creates a new instance of AggregatedCostClient with the specified values. -func NewAggregatedCostClient(con *arm.Connection) *AggregatedCostClient { - return &AggregatedCostClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewAggregatedCostClient(credential azcore.TokenCredential, options *arm.ClientOptions) *AggregatedCostClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AggregatedCostClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetByManagementGroup - Provides the aggregate cost of a management group and all child management groups by current billing period. @@ -75,7 +83,7 @@ func (client *AggregatedCostClient) getByManagementGroupCreateRequest(ctx contex func (client *AggregatedCostClient) getByManagementGroupHandleResponse(resp *http.Response) (AggregatedCostGetByManagementGroupResponse, error) { result := AggregatedCostGetByManagementGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagementGroupAggregatedCostResult); err != nil { - return AggregatedCostGetByManagementGroupResponse{}, err + return AggregatedCostGetByManagementGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -136,7 +144,7 @@ func (client *AggregatedCostClient) getForBillingPeriodByManagementGroupCreateRe func (client *AggregatedCostClient) getForBillingPeriodByManagementGroupHandleResponse(resp *http.Response) (AggregatedCostGetForBillingPeriodByManagementGroupResponse, error) { result := AggregatedCostGetForBillingPeriodByManagementGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagementGroupAggregatedCostResult); err != nil { - return AggregatedCostGetForBillingPeriodByManagementGroupResponse{}, err + return AggregatedCostGetForBillingPeriodByManagementGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_balances_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_balances_client.go index c7f61b649de5..bc949ffd4612 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_balances_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_balances_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // BalancesClient contains the methods for the Balances group. @@ -29,8 +30,15 @@ type BalancesClient struct { } // NewBalancesClient creates a new instance of BalancesClient with the specified values. -func NewBalancesClient(con *arm.Connection) *BalancesClient { - return &BalancesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewBalancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *BalancesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &BalancesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetByBillingAccount - Gets the balances for a scope by billingAccountId. Balances are available via this API only for May 1, 2014 or later. @@ -72,7 +80,7 @@ func (client *BalancesClient) getByBillingAccountCreateRequest(ctx context.Conte func (client *BalancesClient) getByBillingAccountHandleResponse(resp *http.Response) (BalancesGetByBillingAccountResponse, error) { result := BalancesGetByBillingAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Balance); err != nil { - return BalancesGetByBillingAccountResponse{}, err + return BalancesGetByBillingAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -134,7 +142,7 @@ func (client *BalancesClient) getForBillingPeriodByBillingAccountCreateRequest(c func (client *BalancesClient) getForBillingPeriodByBillingAccountHandleResponse(resp *http.Response) (BalancesGetForBillingPeriodByBillingAccountResponse, error) { result := BalancesGetForBillingPeriodByBillingAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Balance); err != nil { - return BalancesGetForBillingPeriodByBillingAccountResponse{}, err + return BalancesGetForBillingPeriodByBillingAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_budgets_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_budgets_client.go index 4b8af2fb4595..d4b9c07fe16b 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_budgets_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_budgets_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // BudgetsClient contains the methods for the Budgets group. @@ -29,8 +30,15 @@ type BudgetsClient struct { } // NewBudgetsClient creates a new instance of BudgetsClient with the specified values. -func NewBudgetsClient(con *arm.Connection) *BudgetsClient { - return &BudgetsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewBudgetsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *BudgetsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &BudgetsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - The operation to create or update a budget. You can optionally provide an eTag if desired as a form of concurrency control. To obtain @@ -55,9 +63,6 @@ func (client *BudgetsClient) CreateOrUpdate(ctx context.Context, scope string, b // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *BudgetsClient) createOrUpdateCreateRequest(ctx context.Context, scope string, budgetName string, parameters Budget, options *BudgetsCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if budgetName == "" { return nil, errors.New("parameter budgetName cannot be empty") @@ -78,7 +83,7 @@ func (client *BudgetsClient) createOrUpdateCreateRequest(ctx context.Context, sc func (client *BudgetsClient) createOrUpdateHandleResponse(resp *http.Response) (BudgetsCreateOrUpdateResponse, error) { result := BudgetsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Budget); err != nil { - return BudgetsCreateOrUpdateResponse{}, err + return BudgetsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -116,9 +121,6 @@ func (client *BudgetsClient) Delete(ctx context.Context, scope string, budgetNam // deleteCreateRequest creates the Delete request. func (client *BudgetsClient) deleteCreateRequest(ctx context.Context, scope string, budgetName string, options *BudgetsDeleteOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if budgetName == "" { return nil, errors.New("parameter budgetName cannot be empty") @@ -168,9 +170,6 @@ func (client *BudgetsClient) Get(ctx context.Context, scope string, budgetName s // getCreateRequest creates the Get request. func (client *BudgetsClient) getCreateRequest(ctx context.Context, scope string, budgetName string, options *BudgetsGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Consumption/budgets/{budgetName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if budgetName == "" { return nil, errors.New("parameter budgetName cannot be empty") @@ -191,7 +190,7 @@ func (client *BudgetsClient) getCreateRequest(ctx context.Context, scope string, func (client *BudgetsClient) getHandleResponse(resp *http.Response) (BudgetsGetResponse, error) { result := BudgetsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Budget); err != nil { - return BudgetsGetResponse{}, err + return BudgetsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -226,9 +225,6 @@ func (client *BudgetsClient) List(scope string, options *BudgetsListOptions) *Bu // listCreateRequest creates the List request. func (client *BudgetsClient) listCreateRequest(ctx context.Context, scope string, options *BudgetsListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Consumption/budgets" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -245,7 +241,7 @@ func (client *BudgetsClient) listCreateRequest(ctx context.Context, scope string func (client *BudgetsClient) listHandleResponse(resp *http.Response) (BudgetsListResponse, error) { result := BudgetsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BudgetsListResult); err != nil { - return BudgetsListResponse{}, err + return BudgetsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_charges_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_charges_client.go index fcc88716f9b7..dafce66eb73c 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_charges_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_charges_client.go @@ -10,14 +10,14 @@ package armconsumption import ( "context" - "errors" "fmt" - "net/http" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" ) // ChargesClient contains the methods for the Charges group. @@ -28,8 +28,15 @@ type ChargesClient struct { } // NewChargesClient creates a new instance of ChargesClient with the specified values. -func NewChargesClient(con *arm.Connection) *ChargesClient { - return &ChargesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewChargesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ChargesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ChargesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists the charges based for the defined scope. @@ -52,9 +59,6 @@ func (client *ChargesClient) List(ctx context.Context, scope string, options *Ch // listCreateRequest creates the List request. func (client *ChargesClient) listCreateRequest(ctx context.Context, scope string, options *ChargesListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Consumption/charges" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -83,7 +87,7 @@ func (client *ChargesClient) listCreateRequest(ctx context.Context, scope string func (client *ChargesClient) listHandleResponse(resp *http.Response) (ChargesListResponse, error) { result := ChargesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ChargesListResult); err != nil { - return ChargesListResponse{}, err + return ChargesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_constants.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_constants.go index 252b29963e68..3ce306005aad 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_constants.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_constants.go @@ -10,7 +10,7 @@ package armconsumption const ( module = "armconsumption" - version = "v0.1.0" + version = "v0.2.0" ) // BillingFrequency - The billing frequency. diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_credits_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_credits_client.go index 57540f4cb20f..4f1b40193dbf 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_credits_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_credits_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CreditsClient contains the methods for the Credits group. @@ -29,8 +30,15 @@ type CreditsClient struct { } // NewCreditsClient creates a new instance of CreditsClient with the specified values. -func NewCreditsClient(con *arm.Connection) *CreditsClient { - return &CreditsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewCreditsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *CreditsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CreditsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - The credit summary by billingAccountId and billingProfileId. @@ -76,7 +84,7 @@ func (client *CreditsClient) getCreateRequest(ctx context.Context, billingAccoun func (client *CreditsClient) getHandleResponse(resp *http.Response) (CreditsGetResponse, error) { result := CreditsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CreditSummary); err != nil { - return CreditsGetResponse{}, err + return CreditsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_events_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_events_client.go index 502de8e7cf7f..80af048ae74c 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_events_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_events_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // EventsClient contains the methods for the Events group. @@ -29,8 +30,15 @@ type EventsClient struct { } // NewEventsClient creates a new instance of EventsClient with the specified values. -func NewEventsClient(con *arm.Connection) *EventsClient { - return &EventsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewEventsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *EventsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &EventsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByBillingAccount - Lists the events that decrements Azure credits or Microsoft Azure consumption commitment for a billing account or a billing profile @@ -73,7 +81,7 @@ func (client *EventsClient) listByBillingAccountCreateRequest(ctx context.Contex func (client *EventsClient) listByBillingAccountHandleResponse(resp *http.Response) (EventsListByBillingAccountResponse, error) { result := EventsListByBillingAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Events); err != nil { - return EventsListByBillingAccountResponse{}, err + return EventsListByBillingAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -134,7 +142,7 @@ func (client *EventsClient) listByBillingProfileCreateRequest(ctx context.Contex func (client *EventsClient) listByBillingProfileHandleResponse(resp *http.Response) (EventsListByBillingProfileResponse, error) { result := EventsListByBillingProfileResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Events); err != nil { - return EventsListByBillingProfileResponse{}, err + return EventsListByBillingProfileResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_lots_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_lots_client.go index 3c07af4431d1..29cf1b2fa973 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_lots_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_lots_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LotsClient contains the methods for the Lots group. @@ -29,8 +30,15 @@ type LotsClient struct { } // NewLotsClient creates a new instance of LotsClient with the specified values. -func NewLotsClient(con *arm.Connection) *LotsClient { - return &LotsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewLotsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *LotsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LotsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByBillingAccount - Lists all Azure credits and Microsoft Azure consumption commitments for a billing account or a billing profile. Microsoft Azure @@ -74,7 +82,7 @@ func (client *LotsClient) listByBillingAccountCreateRequest(ctx context.Context, func (client *LotsClient) listByBillingAccountHandleResponse(resp *http.Response) (LotsListByBillingAccountResponse, error) { result := LotsListByBillingAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Lots); err != nil { - return LotsListByBillingAccountResponse{}, err + return LotsListByBillingAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -134,7 +142,7 @@ func (client *LotsClient) listByBillingProfileCreateRequest(ctx context.Context, func (client *LotsClient) listByBillingProfileHandleResponse(resp *http.Response) (LotsListByBillingProfileResponse, error) { result := LotsListByBillingProfileResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Lots); err != nil { - return LotsListByBillingProfileResponse{}, err + return LotsListByBillingProfileResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_marketplaces_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_marketplaces_client.go index 395e9b79d53a..de87f6d056fd 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_marketplaces_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_marketplaces_client.go @@ -10,15 +10,15 @@ package armconsumption import ( "context" - "errors" "fmt" - "net/http" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strconv" + "strings" ) // MarketplacesClient contains the methods for the Marketplaces group. @@ -29,8 +29,15 @@ type MarketplacesClient struct { } // NewMarketplacesClient creates a new instance of MarketplacesClient with the specified values. -func NewMarketplacesClient(con *arm.Connection) *MarketplacesClient { - return &MarketplacesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewMarketplacesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *MarketplacesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MarketplacesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists the marketplaces for a scope at the defined scope. Marketplaces are available via this API only for May 1, 2014 or later. @@ -50,9 +57,6 @@ func (client *MarketplacesClient) List(scope string, options *MarketplacesListOp // listCreateRequest creates the List request. func (client *MarketplacesClient) listCreateRequest(ctx context.Context, scope string, options *MarketplacesListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Consumption/marketplaces" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -78,7 +82,7 @@ func (client *MarketplacesClient) listCreateRequest(ctx context.Context, scope s func (client *MarketplacesClient) listHandleResponse(resp *http.Response) (MarketplacesListResponse, error) { result := MarketplacesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MarketplacesListResult); err != nil { - return MarketplacesListResponse{}, err + return MarketplacesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_models.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_models.go index e159c1a08fd7..a632b9db9f36 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_models.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_models.go @@ -10,10 +10,9 @@ package armconsumption import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // AggregatedCostGetByManagementGroupOptions contains the optional parameters for the AggregatedCost.GetByManagementGroup method. @@ -300,8 +299,8 @@ type BudgetTimePeriod struct { // MarshalJSON implements the json.Marshaller interface for type BudgetTimePeriod. func (b BudgetTimePeriod) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "endDate", (*timeRFC3339)(b.EndDate)) - populate(objectMap, "startDate", (*timeRFC3339)(b.StartDate)) + populateTimeRFC3339(objectMap, "endDate", b.EndDate) + populateTimeRFC3339(objectMap, "startDate", b.StartDate) return json.Marshal(objectMap) } @@ -315,14 +314,10 @@ func (b *BudgetTimePeriod) UnmarshalJSON(data []byte) error { var err error switch key { case "endDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - b.EndDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &b.EndDate) delete(rawMsg, key) case "startDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - b.StartDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &b.StartDate) delete(rawMsg, key) } if err != nil { @@ -694,7 +689,7 @@ func (e EventProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "newCredit", e.NewCredit) populate(objectMap, "newCreditInBillingCurrency", e.NewCreditInBillingCurrency) populate(objectMap, "reseller", e.Reseller) - populate(objectMap, "transactionDate", (*timeRFC3339)(e.TransactionDate)) + populateTimeRFC3339(objectMap, "transactionDate", e.TransactionDate) return json.Marshal(objectMap) } @@ -774,9 +769,7 @@ func (e *EventProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.Reseller) delete(rawMsg, key) case "transactionDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.TransactionDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.TransactionDate) delete(rawMsg, key) } if err != nil { @@ -1043,7 +1036,7 @@ type LegacyReservationRecommendationProperties struct { func (l LegacyReservationRecommendationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "costWithNoReservedInstances", l.CostWithNoReservedInstances) - populate(objectMap, "firstUsageDate", (*timeRFC3339)(l.FirstUsageDate)) + populateTimeRFC3339(objectMap, "firstUsageDate", l.FirstUsageDate) populate(objectMap, "instanceFlexibilityGroup", l.InstanceFlexibilityGroup) populate(objectMap, "instanceFlexibilityRatio", l.InstanceFlexibilityRatio) populate(objectMap, "lookBackPeriod", l.LookBackPeriod) @@ -1073,9 +1066,7 @@ func (l *LegacyReservationRecommendationProperties) UnmarshalJSON(data []byte) e err = unpopulate(val, &l.CostWithNoReservedInstances) delete(rawMsg, key) case "firstUsageDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.FirstUsageDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.FirstUsageDate) delete(rawMsg, key) case "instanceFlexibilityGroup": err = unpopulate(val, &l.InstanceFlexibilityGroup) @@ -1207,7 +1198,7 @@ func (l LegacyReservationTransactionProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "currentEnrollment", l.CurrentEnrollment) populate(objectMap, "departmentName", l.DepartmentName) populate(objectMap, "description", l.Description) - populate(objectMap, "eventDate", (*timeRFC3339)(l.EventDate)) + populateTimeRFC3339(objectMap, "eventDate", l.EventDate) populate(objectMap, "eventType", l.EventType) populate(objectMap, "purchasingEnrollment", l.PurchasingEnrollment) populate(objectMap, "purchasingSubscriptionGuid", l.PurchasingSubscriptionGUID) @@ -1260,9 +1251,7 @@ func (l *LegacyReservationTransactionProperties) UnmarshalJSON(data []byte) erro err = unpopulate(val, &l.Description) delete(rawMsg, key) case "eventDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.EventDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.EventDate) delete(rawMsg, key) case "eventType": err = unpopulate(val, &l.EventType) @@ -1488,15 +1477,15 @@ func (l LegacyUsageDetailProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "billingAccountId", l.BillingAccountID) populate(objectMap, "billingAccountName", l.BillingAccountName) populate(objectMap, "billingCurrency", l.BillingCurrency) - populate(objectMap, "billingPeriodEndDate", (*timeRFC3339)(l.BillingPeriodEndDate)) - populate(objectMap, "billingPeriodStartDate", (*timeRFC3339)(l.BillingPeriodStartDate)) + populateTimeRFC3339(objectMap, "billingPeriodEndDate", l.BillingPeriodEndDate) + populateTimeRFC3339(objectMap, "billingPeriodStartDate", l.BillingPeriodStartDate) populate(objectMap, "billingProfileId", l.BillingProfileID) populate(objectMap, "billingProfileName", l.BillingProfileName) populate(objectMap, "chargeType", l.ChargeType) populate(objectMap, "consumedService", l.ConsumedService) populate(objectMap, "cost", l.Cost) populate(objectMap, "costCenter", l.CostCenter) - populate(objectMap, "date", (*timeRFC3339)(l.Date)) + populateTimeRFC3339(objectMap, "date", l.Date) populate(objectMap, "effectivePrice", l.EffectivePrice) populate(objectMap, "frequency", l.Frequency) populate(objectMap, "invoiceSection", l.InvoiceSection) @@ -1557,14 +1546,10 @@ func (l *LegacyUsageDetailProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &l.BillingCurrency) delete(rawMsg, key) case "billingPeriodEndDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.BillingPeriodEndDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.BillingPeriodEndDate) delete(rawMsg, key) case "billingPeriodStartDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.BillingPeriodStartDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.BillingPeriodStartDate) delete(rawMsg, key) case "billingProfileId": err = unpopulate(val, &l.BillingProfileID) @@ -1585,9 +1570,7 @@ func (l *LegacyUsageDetailProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &l.CostCenter) delete(rawMsg, key) case "date": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.Date = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.Date) delete(rawMsg, key) case "effectivePrice": err = unpopulate(val, &l.EffectivePrice) @@ -1737,14 +1720,14 @@ func (l LotProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "closedBalanceInBillingCurrency", l.ClosedBalanceInBillingCurrency) populate(objectMap, "creditCurrency", l.CreditCurrency) populate(objectMap, "eTag", l.ETag) - populate(objectMap, "expirationDate", (*timeRFC3339)(l.ExpirationDate)) + populateTimeRFC3339(objectMap, "expirationDate", l.ExpirationDate) populate(objectMap, "originalAmount", l.OriginalAmount) populate(objectMap, "originalAmountInBillingCurrency", l.OriginalAmountInBillingCurrency) populate(objectMap, "poNumber", l.PoNumber) - populate(objectMap, "purchasedDate", (*timeRFC3339)(l.PurchasedDate)) + populateTimeRFC3339(objectMap, "purchasedDate", l.PurchasedDate) populate(objectMap, "reseller", l.Reseller) populate(objectMap, "source", l.Source) - populate(objectMap, "startDate", (*timeRFC3339)(l.StartDate)) + populateTimeRFC3339(objectMap, "startDate", l.StartDate) populate(objectMap, "status", l.Status) return json.Marshal(objectMap) } @@ -1774,9 +1757,7 @@ func (l *LotProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &l.ETag) delete(rawMsg, key) case "expirationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.ExpirationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.ExpirationDate) delete(rawMsg, key) case "originalAmount": err = unpopulate(val, &l.OriginalAmount) @@ -1788,9 +1769,7 @@ func (l *LotProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &l.PoNumber) delete(rawMsg, key) case "purchasedDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.PurchasedDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.PurchasedDate) delete(rawMsg, key) case "reseller": err = unpopulate(val, &l.Reseller) @@ -1799,9 +1778,7 @@ func (l *LotProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &l.Source) delete(rawMsg, key) case "startDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.StartDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.StartDate) delete(rawMsg, key) case "status": err = unpopulate(val, &l.Status) @@ -1925,8 +1902,8 @@ func (m ManagementGroupAggregatedCostProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "excludedSubscriptions", m.ExcludedSubscriptions) populate(objectMap, "includedSubscriptions", m.IncludedSubscriptions) populate(objectMap, "marketplaceCharges", m.MarketplaceCharges) - populate(objectMap, "usageEnd", (*timeRFC3339)(m.UsageEnd)) - populate(objectMap, "usageStart", (*timeRFC3339)(m.UsageStart)) + populateTimeRFC3339(objectMap, "usageEnd", m.UsageEnd) + populateTimeRFC3339(objectMap, "usageStart", m.UsageStart) return json.Marshal(objectMap) } @@ -1964,14 +1941,10 @@ func (m *ManagementGroupAggregatedCostProperties) UnmarshalJSON(data []byte) err err = unpopulate(val, &m.MarketplaceCharges) delete(rawMsg, key) case "usageEnd": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.UsageEnd = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.UsageEnd) delete(rawMsg, key) case "usageStart": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.UsageStart = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.UsageStart) delete(rawMsg, key) } if err != nil { @@ -2165,8 +2138,8 @@ func (m MarketplaceProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "subscriptionGuid", m.SubscriptionGUID) populate(objectMap, "subscriptionName", m.SubscriptionName) populate(objectMap, "unitOfMeasure", m.UnitOfMeasure) - populate(objectMap, "usageEnd", (*timeRFC3339)(m.UsageEnd)) - populate(objectMap, "usageStart", (*timeRFC3339)(m.UsageStart)) + populateTimeRFC3339(objectMap, "usageEnd", m.UsageEnd) + populateTimeRFC3339(objectMap, "usageStart", m.UsageStart) return json.Marshal(objectMap) } @@ -2252,14 +2225,10 @@ func (m *MarketplaceProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.UnitOfMeasure) delete(rawMsg, key) case "usageEnd": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.UsageEnd = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.UsageEnd) delete(rawMsg, key) case "usageStart": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.UsageStart = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.UsageStart) delete(rawMsg, key) } if err != nil { @@ -2513,7 +2482,7 @@ type ModernReservationRecommendationProperties struct { func (m ModernReservationRecommendationProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "costWithNoReservedInstances", m.CostWithNoReservedInstances) - populate(objectMap, "firstUsageDate", (*timeRFC3339)(m.FirstUsageDate)) + populateTimeRFC3339(objectMap, "firstUsageDate", m.FirstUsageDate) populate(objectMap, "instanceFlexibilityGroup", m.InstanceFlexibilityGroup) populate(objectMap, "instanceFlexibilityRatio", m.InstanceFlexibilityRatio) populate(objectMap, "location", m.Location) @@ -2544,9 +2513,7 @@ func (m *ModernReservationRecommendationProperties) UnmarshalJSON(data []byte) e err = unpopulate(val, &m.CostWithNoReservedInstances) delete(rawMsg, key) case "firstUsageDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.FirstUsageDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.FirstUsageDate) delete(rawMsg, key) case "instanceFlexibilityGroup": err = unpopulate(val, &m.InstanceFlexibilityGroup) @@ -2688,7 +2655,7 @@ func (m ModernReservationTransactionProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "billingProfileName", m.BillingProfileName) populate(objectMap, "currency", m.Currency) populate(objectMap, "description", m.Description) - populate(objectMap, "eventDate", (*timeRFC3339)(m.EventDate)) + populateTimeRFC3339(objectMap, "eventDate", m.EventDate) populate(objectMap, "eventType", m.EventType) populate(objectMap, "invoice", m.Invoice) populate(objectMap, "invoiceId", m.InvoiceID) @@ -2735,9 +2702,7 @@ func (m *ModernReservationTransactionProperties) UnmarshalJSON(data []byte) erro err = unpopulate(val, &m.Description) delete(rawMsg, key) case "eventDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.EventDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.EventDate) delete(rawMsg, key) case "eventType": err = unpopulate(val, &m.EventType) @@ -3081,8 +3046,8 @@ func (m ModernUsageDetailProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "billingAccountId", m.BillingAccountID) populate(objectMap, "billingAccountName", m.BillingAccountName) populate(objectMap, "billingCurrencyCode", m.BillingCurrencyCode) - populate(objectMap, "billingPeriodEndDate", (*timeRFC3339)(m.BillingPeriodEndDate)) - populate(objectMap, "billingPeriodStartDate", (*timeRFC3339)(m.BillingPeriodStartDate)) + populateTimeRFC3339(objectMap, "billingPeriodEndDate", m.BillingPeriodEndDate) + populateTimeRFC3339(objectMap, "billingPeriodStartDate", m.BillingPeriodStartDate) populate(objectMap, "billingProfileId", m.BillingProfileID) populate(objectMap, "billingProfileName", m.BillingProfileName) populate(objectMap, "chargeType", m.ChargeType) @@ -3094,10 +3059,10 @@ func (m ModernUsageDetailProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "costInUSD", m.CostInUSD) populate(objectMap, "customerName", m.CustomerName) populate(objectMap, "customerTenantId", m.CustomerTenantID) - populate(objectMap, "date", (*timeRFC3339)(m.Date)) + populateTimeRFC3339(objectMap, "date", m.Date) populate(objectMap, "effectivePrice", m.EffectivePrice) populate(objectMap, "exchangeRate", m.ExchangeRate) - populate(objectMap, "exchangeRateDate", (*timeRFC3339)(m.ExchangeRateDate)) + populateTimeRFC3339(objectMap, "exchangeRateDate", m.ExchangeRateDate) populate(objectMap, "exchangeRatePricingToBilling", m.ExchangeRatePricingToBilling) populate(objectMap, "frequency", m.Frequency) populate(objectMap, "instanceName", m.InstanceName) @@ -3140,8 +3105,8 @@ func (m ModernUsageDetailProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "serviceFamily", m.ServiceFamily) populate(objectMap, "serviceInfo1", m.ServiceInfo1) populate(objectMap, "serviceInfo2", m.ServiceInfo2) - populate(objectMap, "servicePeriodEndDate", (*timeRFC3339)(m.ServicePeriodEndDate)) - populate(objectMap, "servicePeriodStartDate", (*timeRFC3339)(m.ServicePeriodStartDate)) + populateTimeRFC3339(objectMap, "servicePeriodEndDate", m.ServicePeriodEndDate) + populateTimeRFC3339(objectMap, "servicePeriodStartDate", m.ServicePeriodStartDate) populate(objectMap, "subscriptionGuid", m.SubscriptionGUID) populate(objectMap, "subscriptionName", m.SubscriptionName) populate(objectMap, "term", m.Term) @@ -3178,14 +3143,10 @@ func (m *ModernUsageDetailProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.BillingCurrencyCode) delete(rawMsg, key) case "billingPeriodEndDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.BillingPeriodEndDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.BillingPeriodEndDate) delete(rawMsg, key) case "billingPeriodStartDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.BillingPeriodStartDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.BillingPeriodStartDate) delete(rawMsg, key) case "billingProfileId": err = unpopulate(val, &m.BillingProfileID) @@ -3221,9 +3182,7 @@ func (m *ModernUsageDetailProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.CustomerTenantID) delete(rawMsg, key) case "date": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.Date = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.Date) delete(rawMsg, key) case "effectivePrice": err = unpopulate(val, &m.EffectivePrice) @@ -3232,9 +3191,7 @@ func (m *ModernUsageDetailProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.ExchangeRate) delete(rawMsg, key) case "exchangeRateDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.ExchangeRateDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.ExchangeRateDate) delete(rawMsg, key) case "exchangeRatePricingToBilling": err = unpopulate(val, &m.ExchangeRatePricingToBilling) @@ -3363,14 +3320,10 @@ func (m *ModernUsageDetailProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.ServiceInfo2) delete(rawMsg, key) case "servicePeriodEndDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.ServicePeriodEndDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.ServicePeriodEndDate) delete(rawMsg, key) case "servicePeriodStartDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.ServicePeriodStartDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.ServicePeriodStartDate) delete(rawMsg, key) case "subscriptionGuid": err = unpopulate(val, &m.SubscriptionGUID) @@ -3711,7 +3664,7 @@ func (r ReservationDetailProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "reservedHours", r.ReservedHours) populate(objectMap, "skuName", r.SKUName) populate(objectMap, "totalReservedQuantity", r.TotalReservedQuantity) - populate(objectMap, "usageDate", (*timeRFC3339)(r.UsageDate)) + populateTimeRFC3339(objectMap, "usageDate", r.UsageDate) populate(objectMap, "usedHours", r.UsedHours) return json.Marshal(objectMap) } @@ -3753,9 +3706,7 @@ func (r *ReservationDetailProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.TotalReservedQuantity) delete(rawMsg, key) case "usageDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.UsageDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.UsageDate) delete(rawMsg, key) case "usedHours": err = unpopulate(val, &r.UsedHours) @@ -4223,7 +4174,7 @@ func (r ReservationSummaryProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "reservedHours", r.ReservedHours) populate(objectMap, "skuName", r.SKUName) populate(objectMap, "totalReservedQuantity", r.TotalReservedQuantity) - populate(objectMap, "usageDate", (*timeRFC3339)(r.UsageDate)) + populateTimeRFC3339(objectMap, "usageDate", r.UsageDate) populate(objectMap, "usedHours", r.UsedHours) populate(objectMap, "usedQuantity", r.UsedQuantity) populate(objectMap, "utilizedPercentage", r.UtilizedPercentage) @@ -4273,9 +4224,7 @@ func (r *ReservationSummaryProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.TotalReservedQuantity) delete(rawMsg, key) case "usageDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.UsageDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.UsageDate) delete(rawMsg, key) case "usedHours": err = unpopulate(val, &r.UsedHours) diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_operations_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_operations_client.go index 187b989403da..49cb5b89e384 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_operations_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armconsumption import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available consumption REST API operations. @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_pagers.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_pagers.go index b8715bd18435..da703e628745 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_pagers.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armconsumption import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // BudgetsListPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_polymorphic_helpers.go index 77c6da93690a..e1b2497fc1ec 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_polymorphic_helpers.go @@ -49,6 +49,25 @@ func unmarshalChargeSummaryClassificationArray(rawMsg json.RawMessage) ([]Charge return fArray, nil } +func unmarshalChargeSummaryClassificationMap(rawMsg json.RawMessage) (map[string]ChargeSummaryClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ChargeSummaryClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalChargeSummaryClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalReservationRecommendationClassification(rawMsg json.RawMessage) (ReservationRecommendationClassification, error) { if rawMsg == nil { return nil, nil @@ -88,6 +107,25 @@ func unmarshalReservationRecommendationClassificationArray(rawMsg json.RawMessag return fArray, nil } +func unmarshalReservationRecommendationClassificationMap(rawMsg json.RawMessage) (map[string]ReservationRecommendationClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ReservationRecommendationClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalReservationRecommendationClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalUsageDetailClassification(rawMsg json.RawMessage) (UsageDetailClassification, error) { if rawMsg == nil { return nil, nil @@ -126,3 +164,22 @@ func unmarshalUsageDetailClassificationArray(rawMsg json.RawMessage) ([]UsageDet } return fArray, nil } + +func unmarshalUsageDetailClassificationMap(rawMsg json.RawMessage) (map[string]UsageDetailClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]UsageDetailClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalUsageDetailClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_pricesheet_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_pricesheet_client.go index 380fa5168069..dc47eb1bafec 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_pricesheet_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_pricesheet_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // PriceSheetClient contains the methods for the PriceSheet group. @@ -31,8 +32,15 @@ type PriceSheetClient struct { } // NewPriceSheetClient creates a new instance of PriceSheetClient with the specified values. -func NewPriceSheetClient(con *arm.Connection, subscriptionID string) *PriceSheetClient { - return &PriceSheetClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPriceSheetClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PriceSheetClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PriceSheetClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the price sheet for a subscription. Price sheet is available via this API only for May 1, 2014 or later. @@ -83,7 +91,7 @@ func (client *PriceSheetClient) getCreateRequest(ctx context.Context, options *P func (client *PriceSheetClient) getHandleResponse(resp *http.Response) (PriceSheetGetResponse, error) { result := PriceSheetGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PriceSheetResult); err != nil { - return PriceSheetGetResponse{}, err + return PriceSheetGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -154,7 +162,7 @@ func (client *PriceSheetClient) getByBillingPeriodCreateRequest(ctx context.Cont func (client *PriceSheetClient) getByBillingPeriodHandleResponse(resp *http.Response) (PriceSheetGetByBillingPeriodResponse, error) { result := PriceSheetGetByBillingPeriodResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PriceSheetResult); err != nil { - return PriceSheetGetByBillingPeriodResponse{}, err + return PriceSheetGetByBillingPeriodResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationrecommendationdetails_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationrecommendationdetails_client.go index dd543218df7a..d2009a804d84 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationrecommendationdetails_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationrecommendationdetails_client.go @@ -10,14 +10,14 @@ package armconsumption import ( "context" - "errors" "fmt" - "net/http" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" ) // ReservationRecommendationDetailsClient contains the methods for the ReservationRecommendationDetails group. @@ -28,8 +28,15 @@ type ReservationRecommendationDetailsClient struct { } // NewReservationRecommendationDetailsClient creates a new instance of ReservationRecommendationDetailsClient with the specified values. -func NewReservationRecommendationDetailsClient(con *arm.Connection) *ReservationRecommendationDetailsClient { - return &ReservationRecommendationDetailsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewReservationRecommendationDetailsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ReservationRecommendationDetailsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ReservationRecommendationDetailsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Details of a reservation recommendation for what-if analysis of reserved instances. @@ -52,9 +59,6 @@ func (client *ReservationRecommendationDetailsClient) Get(ctx context.Context, s // getCreateRequest creates the Get request. func (client *ReservationRecommendationDetailsClient) getCreateRequest(ctx context.Context, scope string, region string, term Term, lookBackPeriod LookBackPeriod, product string, options *ReservationRecommendationDetailsGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Consumption/reservationRecommendationDetails" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -75,7 +79,7 @@ func (client *ReservationRecommendationDetailsClient) getCreateRequest(ctx conte func (client *ReservationRecommendationDetailsClient) getHandleResponse(resp *http.Response) (ReservationRecommendationDetailsGetResponse, error) { result := ReservationRecommendationDetailsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReservationRecommendationDetailsModel); err != nil { - return ReservationRecommendationDetailsGetResponse{}, err + return ReservationRecommendationDetailsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationrecommendations_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationrecommendations_client.go index bf9cf70ee88c..de2c71a76c51 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationrecommendations_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationrecommendations_client.go @@ -10,14 +10,14 @@ package armconsumption import ( "context" - "errors" "fmt" - "net/http" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" ) // ReservationRecommendationsClient contains the methods for the ReservationRecommendations group. @@ -28,8 +28,15 @@ type ReservationRecommendationsClient struct { } // NewReservationRecommendationsClient creates a new instance of ReservationRecommendationsClient with the specified values. -func NewReservationRecommendationsClient(con *arm.Connection) *ReservationRecommendationsClient { - return &ReservationRecommendationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewReservationRecommendationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ReservationRecommendationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ReservationRecommendationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - List of recommendations for purchasing reserved instances. @@ -49,9 +56,6 @@ func (client *ReservationRecommendationsClient) List(scope string, options *Rese // listCreateRequest creates the List request. func (client *ReservationRecommendationsClient) listCreateRequest(ctx context.Context, scope string, options *ReservationRecommendationsListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Consumption/reservationRecommendations" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -71,7 +75,7 @@ func (client *ReservationRecommendationsClient) listCreateRequest(ctx context.Co func (client *ReservationRecommendationsClient) listHandleResponse(resp *http.Response) (ReservationRecommendationsListResponse, error) { result := ReservationRecommendationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReservationRecommendationsListResult); err != nil { - return ReservationRecommendationsListResponse{}, err + return ReservationRecommendationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationsdetails_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationsdetails_client.go index fcfb638deb0e..e9418378e398 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationsdetails_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationsdetails_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ReservationsDetailsClient contains the methods for the ReservationsDetails group. @@ -29,8 +30,15 @@ type ReservationsDetailsClient struct { } // NewReservationsDetailsClient creates a new instance of ReservationsDetailsClient with the specified values. -func NewReservationsDetailsClient(con *arm.Connection) *ReservationsDetailsClient { - return &ReservationsDetailsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewReservationsDetailsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ReservationsDetailsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ReservationsDetailsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists the reservations details for the defined scope and provided date range. @@ -50,9 +58,6 @@ func (client *ReservationsDetailsClient) List(scope string, options *Reservation // listCreateRequest creates the List request. func (client *ReservationsDetailsClient) listCreateRequest(ctx context.Context, scope string, options *ReservationsDetailsListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Consumption/reservationDetails" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -84,7 +89,7 @@ func (client *ReservationsDetailsClient) listCreateRequest(ctx context.Context, func (client *ReservationsDetailsClient) listHandleResponse(resp *http.Response) (ReservationsDetailsListResponse, error) { result := ReservationsDetailsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReservationDetailsListResult); err != nil { - return ReservationsDetailsListResponse{}, err + return ReservationsDetailsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -139,7 +144,7 @@ func (client *ReservationsDetailsClient) listByReservationOrderCreateRequest(ctx func (client *ReservationsDetailsClient) listByReservationOrderHandleResponse(resp *http.Response) (ReservationsDetailsListByReservationOrderResponse, error) { result := ReservationsDetailsListByReservationOrderResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReservationDetailsListResult); err != nil { - return ReservationsDetailsListByReservationOrderResponse{}, err + return ReservationsDetailsListByReservationOrderResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -198,7 +203,7 @@ func (client *ReservationsDetailsClient) listByReservationOrderAndReservationCre func (client *ReservationsDetailsClient) listByReservationOrderAndReservationHandleResponse(resp *http.Response) (ReservationsDetailsListByReservationOrderAndReservationResponse, error) { result := ReservationsDetailsListByReservationOrderAndReservationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReservationDetailsListResult); err != nil { - return ReservationsDetailsListByReservationOrderAndReservationResponse{}, err + return ReservationsDetailsListByReservationOrderAndReservationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationssummaries_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationssummaries_client.go index 5c4e1d2b271a..7e5415315167 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationssummaries_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationssummaries_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ReservationsSummariesClient contains the methods for the ReservationsSummaries group. @@ -29,8 +30,15 @@ type ReservationsSummariesClient struct { } // NewReservationsSummariesClient creates a new instance of ReservationsSummariesClient with the specified values. -func NewReservationsSummariesClient(con *arm.Connection) *ReservationsSummariesClient { - return &ReservationsSummariesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewReservationsSummariesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ReservationsSummariesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ReservationsSummariesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists the reservations summaries for the defined scope daily or monthly grain. @@ -50,9 +58,6 @@ func (client *ReservationsSummariesClient) List(scope string, grain Datagrain, o // listCreateRequest creates the List request. func (client *ReservationsSummariesClient) listCreateRequest(ctx context.Context, scope string, grain Datagrain, options *ReservationsSummariesListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Consumption/reservationSummaries" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -85,7 +90,7 @@ func (client *ReservationsSummariesClient) listCreateRequest(ctx context.Context func (client *ReservationsSummariesClient) listHandleResponse(resp *http.Response) (ReservationsSummariesListResponse, error) { result := ReservationsSummariesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReservationSummariesListResult); err != nil { - return ReservationsSummariesListResponse{}, err + return ReservationsSummariesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -143,7 +148,7 @@ func (client *ReservationsSummariesClient) listByReservationOrderCreateRequest(c func (client *ReservationsSummariesClient) listByReservationOrderHandleResponse(resp *http.Response) (ReservationsSummariesListByReservationOrderResponse, error) { result := ReservationsSummariesListByReservationOrderResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReservationSummariesListResult); err != nil { - return ReservationsSummariesListByReservationOrderResponse{}, err + return ReservationsSummariesListByReservationOrderResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -205,7 +210,7 @@ func (client *ReservationsSummariesClient) listByReservationOrderAndReservationC func (client *ReservationsSummariesClient) listByReservationOrderAndReservationHandleResponse(resp *http.Response) (ReservationsSummariesListByReservationOrderAndReservationResponse, error) { result := ReservationsSummariesListByReservationOrderAndReservationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReservationSummariesListResult); err != nil { - return ReservationsSummariesListByReservationOrderAndReservationResponse{}, err + return ReservationsSummariesListByReservationOrderAndReservationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationtransactions_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationtransactions_client.go index fae7a11ecc9d..a0164ba143c1 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationtransactions_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_reservationtransactions_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ReservationTransactionsClient contains the methods for the ReservationTransactions group. @@ -29,8 +30,15 @@ type ReservationTransactionsClient struct { } // NewReservationTransactionsClient creates a new instance of ReservationTransactionsClient with the specified values. -func NewReservationTransactionsClient(con *arm.Connection) *ReservationTransactionsClient { - return &ReservationTransactionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewReservationTransactionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ReservationTransactionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ReservationTransactionsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - List of transactions for reserved instances on billing account scope @@ -72,7 +80,7 @@ func (client *ReservationTransactionsClient) listCreateRequest(ctx context.Conte func (client *ReservationTransactionsClient) listHandleResponse(resp *http.Response) (ReservationTransactionsListResponse, error) { result := ReservationTransactionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReservationTransactionsListResult); err != nil { - return ReservationTransactionsListResponse{}, err + return ReservationTransactionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -133,7 +141,7 @@ func (client *ReservationTransactionsClient) listByBillingProfileCreateRequest(c func (client *ReservationTransactionsClient) listByBillingProfileHandleResponse(resp *http.Response) (ReservationTransactionsListByBillingProfileResponse, error) { result := ReservationTransactionsListByBillingProfileResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ModernReservationTransactionsListResult); err != nil { - return ReservationTransactionsListByBillingProfileResponse{}, err + return ReservationTransactionsListByBillingProfileResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_tags_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_tags_client.go index b931397dac2d..47dd7cf4d61a 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_tags_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_tags_client.go @@ -10,14 +10,14 @@ package armconsumption import ( "context" - "errors" "fmt" - "net/http" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" ) // TagsClient contains the methods for the Tags group. @@ -28,8 +28,15 @@ type TagsClient struct { } // NewTagsClient creates a new instance of TagsClient with the specified values. -func NewTagsClient(con *arm.Connection) *TagsClient { - return &TagsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewTagsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *TagsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TagsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get all available tag keys for the defined scope @@ -52,9 +59,6 @@ func (client *TagsClient) Get(ctx context.Context, scope string, options *TagsGe // getCreateRequest creates the Get request. func (client *TagsClient) getCreateRequest(ctx context.Context, scope string, options *TagsGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Consumption/tags" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -71,7 +75,7 @@ func (client *TagsClient) getCreateRequest(ctx context.Context, scope string, op func (client *TagsClient) getHandleResponse(resp *http.Response) (TagsGetResponse, error) { result := TagsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TagsResult); err != nil { - return TagsGetResponse{}, err + return TagsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_time_rfc3339.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_time_rfc3339.go index 305b305ad14b..2ece7fd3f589 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armconsumption import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/consumption/armconsumption/zz_generated_usagedetails_client.go b/sdk/resourcemanager/consumption/armconsumption/zz_generated_usagedetails_client.go index d5257ec84dab..d787c2f3b8d9 100644 --- a/sdk/resourcemanager/consumption/armconsumption/zz_generated_usagedetails_client.go +++ b/sdk/resourcemanager/consumption/armconsumption/zz_generated_usagedetails_client.go @@ -10,15 +10,15 @@ package armconsumption import ( "context" - "errors" "fmt" - "net/http" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strconv" + "strings" ) // UsageDetailsClient contains the methods for the UsageDetails group. @@ -29,8 +29,15 @@ type UsageDetailsClient struct { } // NewUsageDetailsClient creates a new instance of UsageDetailsClient with the specified values. -func NewUsageDetailsClient(con *arm.Connection) *UsageDetailsClient { - return &UsageDetailsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewUsageDetailsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *UsageDetailsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &UsageDetailsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists the usage details for the defined scope. Usage details are available via this API only for May 1, 2014 or later. @@ -50,9 +57,6 @@ func (client *UsageDetailsClient) List(scope string, options *UsageDetailsListOp // listCreateRequest creates the List request. func (client *UsageDetailsClient) listCreateRequest(ctx context.Context, scope string, options *UsageDetailsListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Consumption/usageDetails" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -84,7 +88,7 @@ func (client *UsageDetailsClient) listCreateRequest(ctx context.Context, scope s func (client *UsageDetailsClient) listHandleResponse(resp *http.Response) (UsageDetailsListResponse, error) { result := UsageDetailsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UsageDetailsListResult); err != nil { - return UsageDetailsListResponse{}, err + return UsageDetailsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md b/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md index d2196211cec4..9b695cbc25ec 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-10-08) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/armcontainerregistry". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/containerregistry/armcontainerregistry") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/README.md b/sdk/resourcemanager/containerregistry/armcontainerregistry/README.md index 0b246bc146df..0375f941b0b7 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/README.md +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Container Registry +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Container Registry modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armcontainerregistry.NewImportPipelinesClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Container Registry modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armcontainerregistry.NewImportPipelinesClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armcontainerregistry.NewImportPipelinesClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md b/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md index 13414b99d67e..a7d81df4a62e 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/containerregistry/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/containerregistry/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/containerregistry/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/containerregistry/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod index 6036b1f566f7..e508529fd6ec 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerregistry/a go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.sum b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.sum index 4f0fb709cf31..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/go.sum +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible h1:Cw16jiP4dI+CK761aq44ol4RV5dUiIIXky1+EKpoiVM= -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_agentpools_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_agentpools_client.go index 879de348fd38..7b802084573a 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_agentpools_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_agentpools_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AgentPoolsClient contains the methods for the AgentPools group. @@ -31,8 +31,15 @@ type AgentPoolsClient struct { } // NewAgentPoolsClient creates a new instance of AgentPoolsClient with the specified values. -func NewAgentPoolsClient(con *arm.Connection, subscriptionID string) *AgentPoolsClient { - return &AgentPoolsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAgentPoolsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AgentPoolsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AgentPoolsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates an agent pool for a container registry with the specified parameters. @@ -246,7 +253,7 @@ func (client *AgentPoolsClient) getCreateRequest(ctx context.Context, resourceGr func (client *AgentPoolsClient) getHandleResponse(resp *http.Response) (AgentPoolsGetResponse, error) { result := AgentPoolsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AgentPool); err != nil { - return AgentPoolsGetResponse{}, err + return AgentPoolsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -315,7 +322,7 @@ func (client *AgentPoolsClient) getQueueStatusCreateRequest(ctx context.Context, func (client *AgentPoolsClient) getQueueStatusHandleResponse(resp *http.Response) (AgentPoolsGetQueueStatusResponse, error) { result := AgentPoolsGetQueueStatusResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AgentPoolQueueStatus); err != nil { - return AgentPoolsGetQueueStatusResponse{}, err + return AgentPoolsGetQueueStatusResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -377,7 +384,7 @@ func (client *AgentPoolsClient) listCreateRequest(ctx context.Context, resourceG func (client *AgentPoolsClient) listHandleResponse(resp *http.Response) (AgentPoolsListResponse, error) { result := AgentPoolsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AgentPoolListResult); err != nil { - return AgentPoolsListResponse{}, err + return AgentPoolsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_connectedregistries_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_connectedregistries_client.go index c1d8888706fd..181c983c6a32 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_connectedregistries_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_connectedregistries_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ConnectedRegistriesClient contains the methods for the ConnectedRegistries group. @@ -31,8 +31,15 @@ type ConnectedRegistriesClient struct { } // NewConnectedRegistriesClient creates a new instance of ConnectedRegistriesClient with the specified values. -func NewConnectedRegistriesClient(con *arm.Connection, subscriptionID string) *ConnectedRegistriesClient { - return &ConnectedRegistriesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewConnectedRegistriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ConnectedRegistriesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ConnectedRegistriesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a connected registry for a container registry with the specified parameters. @@ -96,7 +103,7 @@ func (client *ConnectedRegistriesClient) createCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, connectedRegistryCreateParameters) @@ -176,7 +183,7 @@ func (client *ConnectedRegistriesClient) deactivateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -256,7 +263,7 @@ func (client *ConnectedRegistriesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -316,7 +323,7 @@ func (client *ConnectedRegistriesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -326,7 +333,7 @@ func (client *ConnectedRegistriesClient) getCreateRequest(ctx context.Context, r func (client *ConnectedRegistriesClient) getHandleResponse(resp *http.Response) (ConnectedRegistriesGetResponse, error) { result := ConnectedRegistriesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedRegistry); err != nil { - return ConnectedRegistriesGetResponse{}, err + return ConnectedRegistriesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -378,7 +385,7 @@ func (client *ConnectedRegistriesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -391,7 +398,7 @@ func (client *ConnectedRegistriesClient) listCreateRequest(ctx context.Context, func (client *ConnectedRegistriesClient) listHandleResponse(resp *http.Response) (ConnectedRegistriesListResponse, error) { result := ConnectedRegistriesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConnectedRegistryListResult); err != nil { - return ConnectedRegistriesListResponse{}, err + return ConnectedRegistriesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -470,7 +477,7 @@ func (client *ConnectedRegistriesClient) updateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, connectedRegistryUpdateParameters) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_constants.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_constants.go index e38969deb5b2..846a888d673b 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_constants.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_constants.go @@ -10,7 +10,7 @@ package armcontainerregistry const ( module = "armcontainerregistry" - version = "v0.1.0" + version = "v0.2.0" ) // Action - The action of virtual network rule. @@ -187,14 +187,18 @@ func (c CertificateType) ToPtr() *CertificateType { type ConnectedRegistryMode string const ( - ConnectedRegistryModeMirror ConnectedRegistryMode = "Mirror" - ConnectedRegistryModeRegistry ConnectedRegistryMode = "Registry" + ConnectedRegistryModeMirror ConnectedRegistryMode = "Mirror" + ConnectedRegistryModeReadOnly ConnectedRegistryMode = "ReadOnly" + ConnectedRegistryModeReadWrite ConnectedRegistryMode = "ReadWrite" + ConnectedRegistryModeRegistry ConnectedRegistryMode = "Registry" ) // PossibleConnectedRegistryModeValues returns the possible values for the ConnectedRegistryMode const type. func PossibleConnectedRegistryModeValues() []ConnectedRegistryMode { return []ConnectedRegistryMode{ ConnectedRegistryModeMirror, + ConnectedRegistryModeReadOnly, + ConnectedRegistryModeReadWrite, ConnectedRegistryModeRegistry, } } diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_exportpipelines_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_exportpipelines_client.go index ab80b2ce6f20..702eda7b2329 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_exportpipelines_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_exportpipelines_client.go @@ -11,14 +11,14 @@ package armcontainerregistry import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ExportPipelinesClient contains the methods for the ExportPipelines group. @@ -30,8 +30,15 @@ type ExportPipelinesClient struct { } // NewExportPipelinesClient creates a new instance of ExportPipelinesClient with the specified values. -func NewExportPipelinesClient(con *arm.Connection, subscriptionID string) *ExportPipelinesClient { - return &ExportPipelinesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewExportPipelinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExportPipelinesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ExportPipelinesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates an export pipeline for a container registry with the specified parameters. @@ -95,7 +102,7 @@ func (client *ExportPipelinesClient) createCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, exportPipelineCreateParameters) @@ -174,7 +181,7 @@ func (client *ExportPipelinesClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -232,7 +239,7 @@ func (client *ExportPipelinesClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -242,7 +249,7 @@ func (client *ExportPipelinesClient) getCreateRequest(ctx context.Context, resou func (client *ExportPipelinesClient) getHandleResponse(resp *http.Response) (ExportPipelinesGetResponse, error) { result := ExportPipelinesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExportPipeline); err != nil { - return ExportPipelinesGetResponse{}, err + return ExportPipelinesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -293,7 +300,7 @@ func (client *ExportPipelinesClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -303,7 +310,7 @@ func (client *ExportPipelinesClient) listCreateRequest(ctx context.Context, reso func (client *ExportPipelinesClient) listHandleResponse(resp *http.Response) (ExportPipelinesListResponse, error) { result := ExportPipelinesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExportPipelineListResult); err != nil { - return ExportPipelinesListResponse{}, err + return ExportPipelinesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_importpipelines_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_importpipelines_client.go index fa632bf4a61b..b10d9979643a 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_importpipelines_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_importpipelines_client.go @@ -11,14 +11,14 @@ package armcontainerregistry import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ImportPipelinesClient contains the methods for the ImportPipelines group. @@ -30,8 +30,15 @@ type ImportPipelinesClient struct { } // NewImportPipelinesClient creates a new instance of ImportPipelinesClient with the specified values. -func NewImportPipelinesClient(con *arm.Connection, subscriptionID string) *ImportPipelinesClient { - return &ImportPipelinesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewImportPipelinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ImportPipelinesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ImportPipelinesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates an import pipeline for a container registry with the specified parameters. @@ -95,7 +102,7 @@ func (client *ImportPipelinesClient) createCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, importPipelineCreateParameters) @@ -174,7 +181,7 @@ func (client *ImportPipelinesClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -232,7 +239,7 @@ func (client *ImportPipelinesClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -242,7 +249,7 @@ func (client *ImportPipelinesClient) getCreateRequest(ctx context.Context, resou func (client *ImportPipelinesClient) getHandleResponse(resp *http.Response) (ImportPipelinesGetResponse, error) { result := ImportPipelinesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ImportPipeline); err != nil { - return ImportPipelinesGetResponse{}, err + return ImportPipelinesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -293,7 +300,7 @@ func (client *ImportPipelinesClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -303,7 +310,7 @@ func (client *ImportPipelinesClient) listCreateRequest(ctx context.Context, reso func (client *ImportPipelinesClient) listHandleResponse(resp *http.Response) (ImportPipelinesListResponse, error) { result := ImportPipelinesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ImportPipelineListResult); err != nil { - return ImportPipelinesListResponse{}, err + return ImportPipelinesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_models.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_models.go index 0cc4467a8588..91e58514542d 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_models.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_models.go @@ -10,10 +10,9 @@ package armcontainerregistry import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // ActivationProperties - The activation properties of the connected registry. @@ -343,6 +342,9 @@ type ConnectedRegistryProperties struct { // The login server properties of the connected registry. LoginServer *LoginServerProperties `json:"loginServer,omitempty"` + // The list of notifications subscription information for the connected registry. + NotificationsList []*string `json:"notificationsList,omitempty"` + // READ-ONLY; The activation properties of the connected registry. Activation *ActivationProperties `json:"activation,omitempty" azure:"ro"` @@ -368,10 +370,11 @@ func (c ConnectedRegistryProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "activation", c.Activation) populate(objectMap, "clientTokenIds", c.ClientTokenIDs) populate(objectMap, "connectionState", c.ConnectionState) - populate(objectMap, "lastActivityTime", (*timeRFC3339)(c.LastActivityTime)) + populateTimeRFC3339(objectMap, "lastActivityTime", c.LastActivityTime) populate(objectMap, "logging", c.Logging) populate(objectMap, "loginServer", c.LoginServer) populate(objectMap, "mode", c.Mode) + populate(objectMap, "notificationsList", c.NotificationsList) populate(objectMap, "parent", c.Parent) populate(objectMap, "provisioningState", c.ProvisioningState) populate(objectMap, "statusDetails", c.StatusDetails) @@ -398,9 +401,7 @@ func (c *ConnectedRegistryProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.ConnectionState) delete(rawMsg, key) case "lastActivityTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.LastActivityTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.LastActivityTime) delete(rawMsg, key) case "logging": err = unpopulate(val, &c.Logging) @@ -411,6 +412,9 @@ func (c *ConnectedRegistryProperties) UnmarshalJSON(data []byte) error { case "mode": err = unpopulate(val, &c.Mode) delete(rawMsg, key) + case "notificationsList": + err = unpopulate(val, &c.NotificationsList) + delete(rawMsg, key) case "parent": err = unpopulate(val, &c.Parent) delete(rawMsg, key) @@ -452,6 +456,9 @@ type ConnectedRegistryUpdateProperties struct { // The logging properties of the connected registry. Logging *LoggingProperties `json:"logging,omitempty"` + // The list of notifications subscription information for the connected registry. + NotificationsList []*string `json:"notificationsList,omitempty"` + // The sync properties of the connected registry with its parent. SyncProperties *SyncUpdateProperties `json:"syncProperties,omitempty"` } @@ -461,6 +468,7 @@ func (c ConnectedRegistryUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "clientTokenIds", c.ClientTokenIDs) populate(objectMap, "logging", c.Logging) + populate(objectMap, "notificationsList", c.NotificationsList) populate(objectMap, "syncProperties", c.SyncProperties) return json.Marshal(objectMap) } @@ -1027,7 +1035,7 @@ func (e EventContent) MarshalJSON() ([]byte, error) { populate(objectMap, "request", e.Request) populate(objectMap, "source", e.Source) populate(objectMap, "target", e.Target) - populate(objectMap, "timestamp", (*timeRFC3339)(e.Timestamp)) + populateTimeRFC3339(objectMap, "timestamp", e.Timestamp) return json.Marshal(objectMap) } @@ -1059,9 +1067,7 @@ func (e *EventContent) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.Target) delete(rawMsg, key) case "timestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.Timestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.Timestamp) delete(rawMsg, key) } if err != nil { @@ -1449,7 +1455,7 @@ type GenerateCredentialsParameters struct { // MarshalJSON implements the json.Marshaller interface for type GenerateCredentialsParameters. func (g GenerateCredentialsParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "expiry", (*timeRFC3339)(g.Expiry)) + populateTimeRFC3339(objectMap, "expiry", g.Expiry) populate(objectMap, "name", g.Name) populate(objectMap, "tokenId", g.TokenID) return json.Marshal(objectMap) @@ -1465,9 +1471,7 @@ func (g *GenerateCredentialsParameters) UnmarshalJSON(data []byte) error { var err error switch key { case "expiry": - var aux timeRFC3339 - err = unpopulate(val, &aux) - g.Expiry = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &g.Expiry) delete(rawMsg, key) case "name": err = unpopulate(val, &g.Name) @@ -1567,7 +1571,7 @@ func (i ImageUpdateTrigger) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "id", i.ID) populate(objectMap, "images", i.Images) - populate(objectMap, "timestamp", (*timeRFC3339)(i.Timestamp)) + populateTimeRFC3339(objectMap, "timestamp", i.Timestamp) return json.Marshal(objectMap) } @@ -1587,9 +1591,7 @@ func (i *ImageUpdateTrigger) UnmarshalJSON(data []byte) error { err = unpopulate(val, &i.Images) delete(rawMsg, key) case "timestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.Timestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.Timestamp) delete(rawMsg, key) } if err != nil { @@ -1770,7 +1772,7 @@ func (k KeyVaultProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "identity", k.Identity) populate(objectMap, "keyIdentifier", k.KeyIdentifier) populate(objectMap, "keyRotationEnabled", k.KeyRotationEnabled) - populate(objectMap, "lastKeyRotationTimestamp", (*timeRFC3339)(k.LastKeyRotationTimestamp)) + populateTimeRFC3339(objectMap, "lastKeyRotationTimestamp", k.LastKeyRotationTimestamp) populate(objectMap, "versionedKeyIdentifier", k.VersionedKeyIdentifier) return json.Marshal(objectMap) } @@ -1794,9 +1796,7 @@ func (k *KeyVaultProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &k.KeyRotationEnabled) delete(rawMsg, key) case "lastKeyRotationTimestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - k.LastKeyRotationTimestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &k.LastKeyRotationTimestamp) delete(rawMsg, key) case "versionedKeyIdentifier": err = unpopulate(val, &k.VersionedKeyIdentifier) @@ -2107,12 +2107,12 @@ type PipelineRunResponse struct { func (p PipelineRunResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "catalogDigest", p.CatalogDigest) - populate(objectMap, "finishTime", (*timeRFC3339)(p.FinishTime)) + populateTimeRFC3339(objectMap, "finishTime", p.FinishTime) populate(objectMap, "importedArtifacts", p.ImportedArtifacts) populate(objectMap, "pipelineRunErrorMessage", p.PipelineRunErrorMessage) populate(objectMap, "progress", p.Progress) populate(objectMap, "source", p.Source) - populate(objectMap, "startTime", (*timeRFC3339)(p.StartTime)) + populateTimeRFC3339(objectMap, "startTime", p.StartTime) populate(objectMap, "status", p.Status) populate(objectMap, "target", p.Target) populate(objectMap, "trigger", p.Trigger) @@ -2132,9 +2132,7 @@ func (p *PipelineRunResponse) UnmarshalJSON(data []byte) error { err = unpopulate(val, &p.CatalogDigest) delete(rawMsg, key) case "finishTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - p.FinishTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &p.FinishTime) delete(rawMsg, key) case "importedArtifacts": err = unpopulate(val, &p.ImportedArtifacts) @@ -2149,9 +2147,7 @@ func (p *PipelineRunResponse) UnmarshalJSON(data []byte) error { err = unpopulate(val, &p.Source) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - p.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &p.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &p.Status) @@ -2214,7 +2210,7 @@ type PipelineSourceTriggerDescriptor struct { // MarshalJSON implements the json.Marshaller interface for type PipelineSourceTriggerDescriptor. func (p PipelineSourceTriggerDescriptor) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "timestamp", (*timeRFC3339)(p.Timestamp)) + populateTimeRFC3339(objectMap, "timestamp", p.Timestamp) return json.Marshal(objectMap) } @@ -2228,9 +2224,7 @@ func (p *PipelineSourceTriggerDescriptor) UnmarshalJSON(data []byte) error { var err error switch key { case "timestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - p.Timestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &p.Timestamp) delete(rawMsg, key) } if err != nil { @@ -2669,7 +2663,7 @@ func (r RegistryProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "adminUserEnabled", r.AdminUserEnabled) populate(objectMap, "anonymousPullEnabled", r.AnonymousPullEnabled) - populate(objectMap, "creationDate", (*timeRFC3339)(r.CreationDate)) + populateTimeRFC3339(objectMap, "creationDate", r.CreationDate) populate(objectMap, "dataEndpointEnabled", r.DataEndpointEnabled) populate(objectMap, "dataEndpointHostNames", r.DataEndpointHostNames) populate(objectMap, "encryption", r.Encryption) @@ -2701,9 +2695,7 @@ func (r *RegistryProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.AnonymousPullEnabled) delete(rawMsg, key) case "creationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.CreationDate) delete(rawMsg, key) case "dataEndpointEnabled": err = unpopulate(val, &r.DataEndpointEnabled) @@ -2998,7 +2990,7 @@ type RetentionPolicy struct { func (r RetentionPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "days", r.Days) - populate(objectMap, "lastUpdatedTime", (*timeRFC3339)(r.LastUpdatedTime)) + populateTimeRFC3339(objectMap, "lastUpdatedTime", r.LastUpdatedTime) populate(objectMap, "status", r.Status) return json.Marshal(objectMap) } @@ -3016,9 +3008,7 @@ func (r *RetentionPolicy) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.Days) delete(rawMsg, key) case "lastUpdatedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.LastUpdatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.LastUpdatedTime) delete(rawMsg, key) case "status": err = unpopulate(val, &r.Status) @@ -3072,8 +3062,8 @@ type RunFilter struct { func (r RunFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "agentPoolName", r.AgentPoolName) - populate(objectMap, "createTime", (*timeRFC3339)(r.CreateTime)) - populate(objectMap, "finishTime", (*timeRFC3339)(r.FinishTime)) + populateTimeRFC3339(objectMap, "createTime", r.CreateTime) + populateTimeRFC3339(objectMap, "finishTime", r.FinishTime) populate(objectMap, "isArchiveEnabled", r.IsArchiveEnabled) populate(objectMap, "outputImageManifests", r.OutputImageManifests) populate(objectMap, "runId", r.RunID) @@ -3096,14 +3086,10 @@ func (r *RunFilter) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.AgentPoolName) delete(rawMsg, key) case "createTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.CreateTime) delete(rawMsg, key) case "finishTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.FinishTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.FinishTime) delete(rawMsg, key) case "isArchiveEnabled": err = unpopulate(val, &r.IsArchiveEnabled) @@ -3231,12 +3217,12 @@ func (r RunProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "agentConfiguration", r.AgentConfiguration) populate(objectMap, "agentPoolName", r.AgentPoolName) - populate(objectMap, "createTime", (*timeRFC3339)(r.CreateTime)) + populateTimeRFC3339(objectMap, "createTime", r.CreateTime) populate(objectMap, "customRegistries", r.CustomRegistries) - populate(objectMap, "finishTime", (*timeRFC3339)(r.FinishTime)) + populateTimeRFC3339(objectMap, "finishTime", r.FinishTime) populate(objectMap, "imageUpdateTrigger", r.ImageUpdateTrigger) populate(objectMap, "isArchiveEnabled", r.IsArchiveEnabled) - populate(objectMap, "lastUpdatedTime", (*timeRFC3339)(r.LastUpdatedTime)) + populateTimeRFC3339(objectMap, "lastUpdatedTime", r.LastUpdatedTime) populate(objectMap, "logArtifact", r.LogArtifact) populate(objectMap, "outputImages", r.OutputImages) populate(objectMap, "platform", r.Platform) @@ -3246,7 +3232,7 @@ func (r RunProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "runType", r.RunType) populate(objectMap, "sourceRegistryAuth", r.SourceRegistryAuth) populate(objectMap, "sourceTrigger", r.SourceTrigger) - populate(objectMap, "startTime", (*timeRFC3339)(r.StartTime)) + populateTimeRFC3339(objectMap, "startTime", r.StartTime) populate(objectMap, "status", r.Status) populate(objectMap, "task", r.Task) populate(objectMap, "timerTrigger", r.TimerTrigger) @@ -3270,17 +3256,13 @@ func (r *RunProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.AgentPoolName) delete(rawMsg, key) case "createTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.CreateTime) delete(rawMsg, key) case "customRegistries": err = unpopulate(val, &r.CustomRegistries) delete(rawMsg, key) case "finishTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.FinishTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.FinishTime) delete(rawMsg, key) case "imageUpdateTrigger": err = unpopulate(val, &r.ImageUpdateTrigger) @@ -3289,9 +3271,7 @@ func (r *RunProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.IsArchiveEnabled) delete(rawMsg, key) case "lastUpdatedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.LastUpdatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.LastUpdatedTime) delete(rawMsg, key) case "logArtifact": err = unpopulate(val, &r.LogArtifact) @@ -3321,9 +3301,7 @@ func (r *RunProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.SourceTrigger) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &r.Status) @@ -3510,7 +3488,7 @@ type ScopeMapProperties struct { func (s ScopeMapProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "actions", s.Actions) - populate(objectMap, "creationDate", (*timeRFC3339)(s.CreationDate)) + populateTimeRFC3339(objectMap, "creationDate", s.CreationDate) populate(objectMap, "description", s.Description) populate(objectMap, "provisioningState", s.ProvisioningState) populate(objectMap, "type", s.Type) @@ -3530,9 +3508,7 @@ func (s *ScopeMapProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Actions) delete(rawMsg, key) case "creationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreationDate) delete(rawMsg, key) case "description": err = unpopulate(val, &s.Description) @@ -3776,7 +3752,7 @@ func (s Status) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "displayStatus", s.DisplayStatus) populate(objectMap, "message", s.Message) - populate(objectMap, "timestamp", (*timeRFC3339)(s.Timestamp)) + populateTimeRFC3339(objectMap, "timestamp", s.Timestamp) return json.Marshal(objectMap) } @@ -3796,9 +3772,7 @@ func (s *Status) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Message) delete(rawMsg, key) case "timestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.Timestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.Timestamp) delete(rawMsg, key) } if err != nil { @@ -3832,7 +3806,7 @@ func (s StatusDetailProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "code", s.Code) populate(objectMap, "correlationId", s.CorrelationID) populate(objectMap, "description", s.Description) - populate(objectMap, "timestamp", (*timeRFC3339)(s.Timestamp)) + populateTimeRFC3339(objectMap, "timestamp", s.Timestamp) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) } @@ -3856,9 +3830,7 @@ func (s *StatusDetailProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Description) delete(rawMsg, key) case "timestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.Timestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.Timestamp) delete(rawMsg, key) case "type": err = unpopulate(val, &s.Type) @@ -3897,7 +3869,7 @@ type SyncProperties struct { func (s SyncProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "gatewayEndpoint", s.GatewayEndpoint) - populate(objectMap, "lastSyncTime", (*timeRFC3339)(s.LastSyncTime)) + populateTimeRFC3339(objectMap, "lastSyncTime", s.LastSyncTime) populate(objectMap, "messageTtl", s.MessageTTL) populate(objectMap, "schedule", s.Schedule) populate(objectMap, "syncWindow", s.SyncWindow) @@ -3918,9 +3890,7 @@ func (s *SyncProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.GatewayEndpoint) delete(rawMsg, key) case "lastSyncTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastSyncTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastSyncTime) delete(rawMsg, key) case "messageTtl": err = unpopulate(val, &s.MessageTTL) @@ -3979,10 +3949,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -3998,9 +3968,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -4009,9 +3977,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) @@ -4155,7 +4121,7 @@ func (t TaskProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "agentConfiguration", t.AgentConfiguration) populate(objectMap, "agentPoolName", t.AgentPoolName) - populate(objectMap, "creationDate", (*timeRFC3339)(t.CreationDate)) + populateTimeRFC3339(objectMap, "creationDate", t.CreationDate) populate(objectMap, "credentials", t.Credentials) populate(objectMap, "isSystemTask", t.IsSystemTask) populate(objectMap, "logTemplate", t.LogTemplate) @@ -4184,9 +4150,7 @@ func (t *TaskProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &t.AgentPoolName) delete(rawMsg, key) case "creationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.CreationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.CreationDate) delete(rawMsg, key) case "credentials": err = unpopulate(val, &t.Credentials) @@ -4772,7 +4736,7 @@ type TokenCertificate struct { func (t TokenCertificate) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "encodedPemCertificate", t.EncodedPemCertificate) - populate(objectMap, "expiry", (*timeRFC3339)(t.Expiry)) + populateTimeRFC3339(objectMap, "expiry", t.Expiry) populate(objectMap, "name", t.Name) populate(objectMap, "thumbprint", t.Thumbprint) return json.Marshal(objectMap) @@ -4791,9 +4755,7 @@ func (t *TokenCertificate) UnmarshalJSON(data []byte) error { err = unpopulate(val, &t.EncodedPemCertificate) delete(rawMsg, key) case "expiry": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.Expiry = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.Expiry) delete(rawMsg, key) case "name": err = unpopulate(val, &t.Name) @@ -4858,8 +4820,8 @@ type TokenPassword struct { // MarshalJSON implements the json.Marshaller interface for type TokenPassword. func (t TokenPassword) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(t.CreationTime)) - populate(objectMap, "expiry", (*timeRFC3339)(t.Expiry)) + populateTimeRFC3339(objectMap, "creationTime", t.CreationTime) + populateTimeRFC3339(objectMap, "expiry", t.Expiry) populate(objectMap, "name", t.Name) populate(objectMap, "value", t.Value) return json.Marshal(objectMap) @@ -4875,14 +4837,10 @@ func (t *TokenPassword) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.CreationTime) delete(rawMsg, key) case "expiry": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.Expiry = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.Expiry) delete(rawMsg, key) case "name": err = unpopulate(val, &t.Name) @@ -4919,7 +4877,7 @@ type TokenProperties struct { // MarshalJSON implements the json.Marshaller interface for type TokenProperties. func (t TokenProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationDate", (*timeRFC3339)(t.CreationDate)) + populateTimeRFC3339(objectMap, "creationDate", t.CreationDate) populate(objectMap, "credentials", t.Credentials) populate(objectMap, "provisioningState", t.ProvisioningState) populate(objectMap, "scopeMapId", t.ScopeMapID) @@ -4937,9 +4895,7 @@ func (t *TokenProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.CreationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.CreationDate) delete(rawMsg, key) case "credentials": err = unpopulate(val, &t.Credentials) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_operations_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_operations_client.go index eee0bc2c85f8..349a9639ca9e 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_operations_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armcontainerregistry import ( "context" "errors" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available Azure Container Registry REST API operations. @@ -52,7 +60,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_pagers.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_pagers.go index 478ce57a32b0..9d0231f1ac8b 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_pagers.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armcontainerregistry import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // AgentPoolsListPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_pipelineruns_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_pipelineruns_client.go index 50b4969ad999..cdec1dab8b6f 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_pipelineruns_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_pipelineruns_client.go @@ -11,14 +11,14 @@ package armcontainerregistry import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PipelineRunsClient contains the methods for the PipelineRuns group. @@ -30,8 +30,15 @@ type PipelineRunsClient struct { } // NewPipelineRunsClient creates a new instance of PipelineRunsClient with the specified values. -func NewPipelineRunsClient(con *arm.Connection, subscriptionID string) *PipelineRunsClient { - return &PipelineRunsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPipelineRunsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PipelineRunsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PipelineRunsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a pipeline run for a container registry with the specified parameters @@ -95,7 +102,7 @@ func (client *PipelineRunsClient) createCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, pipelineRunCreateParameters) @@ -174,7 +181,7 @@ func (client *PipelineRunsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -232,7 +239,7 @@ func (client *PipelineRunsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -242,7 +249,7 @@ func (client *PipelineRunsClient) getCreateRequest(ctx context.Context, resource func (client *PipelineRunsClient) getHandleResponse(resp *http.Response) (PipelineRunsGetResponse, error) { result := PipelineRunsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PipelineRun); err != nil { - return PipelineRunsGetResponse{}, err + return PipelineRunsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -293,7 +300,7 @@ func (client *PipelineRunsClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -303,7 +310,7 @@ func (client *PipelineRunsClient) listCreateRequest(ctx context.Context, resourc func (client *PipelineRunsClient) listHandleResponse(resp *http.Response) (PipelineRunsListResponse, error) { result := PipelineRunsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PipelineRunListResult); err != nil { - return PipelineRunsListResponse{}, err + return PipelineRunsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_pollers.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_pollers.go index 89f833d8d785..1a7e1edb9e0a 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_pollers.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armcontainerregistry import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // AgentPoolsCreatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_polymorphic_helpers.go index fdf24d664037..14aa60e36835 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_polymorphic_helpers.go @@ -53,6 +53,25 @@ func unmarshalRunRequestClassificationArray(rawMsg json.RawMessage) ([]RunReques return fArray, nil } +func unmarshalRunRequestClassificationMap(rawMsg json.RawMessage) (map[string]RunRequestClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]RunRequestClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalRunRequestClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalTaskStepPropertiesClassification(rawMsg json.RawMessage) (TaskStepPropertiesClassification, error) { if rawMsg == nil { return nil, nil @@ -94,6 +113,25 @@ func unmarshalTaskStepPropertiesClassificationArray(rawMsg json.RawMessage) ([]T return fArray, nil } +func unmarshalTaskStepPropertiesClassificationMap(rawMsg json.RawMessage) (map[string]TaskStepPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]TaskStepPropertiesClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalTaskStepPropertiesClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalTaskStepUpdateParametersClassification(rawMsg json.RawMessage) (TaskStepUpdateParametersClassification, error) { if rawMsg == nil { return nil, nil @@ -134,3 +172,22 @@ func unmarshalTaskStepUpdateParametersClassificationArray(rawMsg json.RawMessage } return fArray, nil } + +func unmarshalTaskStepUpdateParametersClassificationMap(rawMsg json.RawMessage) (map[string]TaskStepUpdateParametersClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]TaskStepUpdateParametersClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalTaskStepUpdateParametersClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_privateendpointconnections_client.go index e0665e33959a..59d0e09cb82a 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_privateendpointconnections_client.go @@ -11,14 +11,14 @@ package armcontainerregistry import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. @@ -30,8 +30,15 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { - return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Update the state of specified private endpoint connection associated with the container registry. @@ -95,7 +102,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, privateEndpointConnection) @@ -174,7 +181,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -232,7 +239,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -242,7 +249,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsGetResponse{}, err + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -293,7 +300,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -303,7 +310,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListResponse, error) { result := PrivateEndpointConnectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionsListResponse{}, err + return PrivateEndpointConnectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_registries_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_registries_client.go index ec2ab57a7b5b..4019521a3b48 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_registries_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_registries_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RegistriesClient contains the methods for the Registries group. @@ -31,8 +31,15 @@ type RegistriesClient struct { } // NewRegistriesClient creates a new instance of RegistriesClient with the specified values. -func NewRegistriesClient(con *arm.Connection, subscriptionID string) *RegistriesClient { - return &RegistriesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRegistriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RegistriesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RegistriesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNameAvailability - Checks whether the container registry name is available for use. The name must contain only alphanumeric characters, be globally @@ -65,7 +72,7 @@ func (client *RegistriesClient) checkNameAvailabilityCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, registryNameCheckRequest) @@ -75,7 +82,7 @@ func (client *RegistriesClient) checkNameAvailabilityCreateRequest(ctx context.C func (client *RegistriesClient) checkNameAvailabilityHandleResponse(resp *http.Response) (RegistriesCheckNameAvailabilityResponse, error) { result := RegistriesCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RegistryNameStatus); err != nil { - return RegistriesCheckNameAvailabilityResponse{}, err + return RegistriesCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -149,7 +156,7 @@ func (client *RegistriesClient) createCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, registry) @@ -224,7 +231,7 @@ func (client *RegistriesClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -298,7 +305,7 @@ func (client *RegistriesClient) generateCredentialsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, generateCredentialsParameters) @@ -353,7 +360,7 @@ func (client *RegistriesClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -363,7 +370,7 @@ func (client *RegistriesClient) getCreateRequest(ctx context.Context, resourceGr func (client *RegistriesClient) getHandleResponse(resp *http.Response) (RegistriesGetResponse, error) { result := RegistriesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Registry); err != nil { - return RegistriesGetResponse{}, err + return RegistriesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -427,7 +434,7 @@ func (client *RegistriesClient) getBuildSourceUploadURLCreateRequest(ctx context func (client *RegistriesClient) getBuildSourceUploadURLHandleResponse(resp *http.Response) (RegistriesGetBuildSourceUploadURLResponse, error) { result := RegistriesGetBuildSourceUploadURLResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SourceUploadDefinition); err != nil { - return RegistriesGetBuildSourceUploadURLResponse{}, err + return RegistriesGetBuildSourceUploadURLResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -502,7 +509,7 @@ func (client *RegistriesClient) importImageCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, runtime.MarshalAsJSON(req, parameters) } @@ -545,7 +552,7 @@ func (client *RegistriesClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -555,7 +562,7 @@ func (client *RegistriesClient) listCreateRequest(ctx context.Context, options * func (client *RegistriesClient) listHandleResponse(resp *http.Response) (RegistriesListResponse, error) { result := RegistriesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RegistryListResult); err != nil { - return RegistriesListResponse{}, err + return RegistriesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -602,7 +609,7 @@ func (client *RegistriesClient) listByResourceGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -612,7 +619,7 @@ func (client *RegistriesClient) listByResourceGroupCreateRequest(ctx context.Con func (client *RegistriesClient) listByResourceGroupHandleResponse(resp *http.Response) (RegistriesListByResourceGroupResponse, error) { result := RegistriesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RegistryListResult); err != nil { - return RegistriesListByResourceGroupResponse{}, err + return RegistriesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -666,7 +673,7 @@ func (client *RegistriesClient) listCredentialsCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -676,7 +683,7 @@ func (client *RegistriesClient) listCredentialsCreateRequest(ctx context.Context func (client *RegistriesClient) listCredentialsHandleResponse(resp *http.Response) (RegistriesListCredentialsResponse, error) { result := RegistriesListCredentialsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RegistryListCredentialsResult); err != nil { - return RegistriesListCredentialsResponse{}, err + return RegistriesListCredentialsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -727,7 +734,7 @@ func (client *RegistriesClient) listPrivateLinkResourcesCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -737,7 +744,7 @@ func (client *RegistriesClient) listPrivateLinkResourcesCreateRequest(ctx contex func (client *RegistriesClient) listPrivateLinkResourcesHandleResponse(resp *http.Response) (RegistriesListPrivateLinkResourcesResponse, error) { result := RegistriesListPrivateLinkResourcesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { - return RegistriesListPrivateLinkResourcesResponse{}, err + return RegistriesListPrivateLinkResourcesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -791,7 +798,7 @@ func (client *RegistriesClient) listUsagesCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -801,7 +808,7 @@ func (client *RegistriesClient) listUsagesCreateRequest(ctx context.Context, res func (client *RegistriesClient) listUsagesHandleResponse(resp *http.Response) (RegistriesListUsagesResponse, error) { result := RegistriesListUsagesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RegistryUsageListResult); err != nil { - return RegistriesListUsagesResponse{}, err + return RegistriesListUsagesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -855,7 +862,7 @@ func (client *RegistriesClient) regenerateCredentialCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, regenerateCredentialParameters) @@ -865,7 +872,7 @@ func (client *RegistriesClient) regenerateCredentialCreateRequest(ctx context.Co func (client *RegistriesClient) regenerateCredentialHandleResponse(resp *http.Response) (RegistriesRegenerateCredentialResponse, error) { result := RegistriesRegenerateCredentialResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RegistryListCredentialsResult); err != nil { - return RegistriesRegenerateCredentialResponse{}, err + return RegistriesRegenerateCredentialResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1015,7 +1022,7 @@ func (client *RegistriesClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, registryUpdateParameters) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_replications_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_replications_client.go index bc2b96712439..dfc715d6e4f2 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_replications_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_replications_client.go @@ -11,14 +11,14 @@ package armcontainerregistry import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ReplicationsClient contains the methods for the Replications group. @@ -30,8 +30,15 @@ type ReplicationsClient struct { } // NewReplicationsClient creates a new instance of ReplicationsClient with the specified values. -func NewReplicationsClient(con *arm.Connection, subscriptionID string) *ReplicationsClient { - return &ReplicationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewReplicationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ReplicationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ReplicationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a replication for a container registry with the specified parameters. @@ -95,7 +102,7 @@ func (client *ReplicationsClient) createCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, replication) @@ -174,7 +181,7 @@ func (client *ReplicationsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -232,7 +239,7 @@ func (client *ReplicationsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -242,7 +249,7 @@ func (client *ReplicationsClient) getCreateRequest(ctx context.Context, resource func (client *ReplicationsClient) getHandleResponse(resp *http.Response) (ReplicationsGetResponse, error) { result := ReplicationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Replication); err != nil { - return ReplicationsGetResponse{}, err + return ReplicationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -293,7 +300,7 @@ func (client *ReplicationsClient) listCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -303,7 +310,7 @@ func (client *ReplicationsClient) listCreateRequest(ctx context.Context, resourc func (client *ReplicationsClient) listHandleResponse(resp *http.Response) (ReplicationsListResponse, error) { result := ReplicationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReplicationListResult); err != nil { - return ReplicationsListResponse{}, err + return ReplicationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -381,7 +388,7 @@ func (client *ReplicationsClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, replicationUpdateParameters) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_response_types.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_response_types.go index 065ea370dfd8..d3a44ea5633e 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_response_types.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armcontainerregistry import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // AgentPoolsCreatePollerResponse contains the response from method AgentPools.Create. @@ -26,6 +25,8 @@ type AgentPoolsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AgentPoolsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AgentPoolsCreateResponse, error) { respType := AgentPoolsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AgentPool) @@ -76,6 +77,8 @@ type AgentPoolsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AgentPoolsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AgentPoolsDeleteResponse, error) { respType := AgentPoolsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -156,6 +159,8 @@ type AgentPoolsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AgentPoolsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AgentPoolsUpdateResponse, error) { respType := AgentPoolsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AgentPool) @@ -206,6 +211,8 @@ type ConnectedRegistriesCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ConnectedRegistriesCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ConnectedRegistriesCreateResponse, error) { respType := ConnectedRegistriesCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ConnectedRegistry) @@ -256,6 +263,8 @@ type ConnectedRegistriesDeactivatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ConnectedRegistriesDeactivatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ConnectedRegistriesDeactivateResponse, error) { respType := ConnectedRegistriesDeactivateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -300,6 +309,8 @@ type ConnectedRegistriesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ConnectedRegistriesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ConnectedRegistriesDeleteResponse, error) { respType := ConnectedRegistriesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -368,6 +379,8 @@ type ConnectedRegistriesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ConnectedRegistriesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ConnectedRegistriesUpdateResponse, error) { respType := ConnectedRegistriesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ConnectedRegistry) @@ -418,6 +431,8 @@ type ExportPipelinesCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExportPipelinesCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExportPipelinesCreateResponse, error) { respType := ExportPipelinesCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ExportPipeline) @@ -468,6 +483,8 @@ type ExportPipelinesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExportPipelinesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExportPipelinesDeleteResponse, error) { respType := ExportPipelinesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -536,6 +553,8 @@ type ImportPipelinesCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ImportPipelinesCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ImportPipelinesCreateResponse, error) { respType := ImportPipelinesCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ImportPipeline) @@ -586,6 +605,8 @@ type ImportPipelinesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ImportPipelinesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ImportPipelinesDeleteResponse, error) { respType := ImportPipelinesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -666,6 +687,8 @@ type PipelineRunsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PipelineRunsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PipelineRunsCreateResponse, error) { respType := PipelineRunsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PipelineRun) @@ -716,6 +739,8 @@ type PipelineRunsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PipelineRunsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PipelineRunsDeleteResponse, error) { respType := PipelineRunsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -784,6 +809,8 @@ type PrivateEndpointConnectionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsCreateOrUpdateResponse, error) { respType := PrivateEndpointConnectionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) @@ -834,6 +861,8 @@ type PrivateEndpointConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsDeleteResponse, error) { respType := PrivateEndpointConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -914,6 +943,8 @@ type RegistriesCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RegistriesCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RegistriesCreateResponse, error) { respType := RegistriesCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Registry) @@ -964,6 +995,8 @@ type RegistriesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RegistriesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RegistriesDeleteResponse, error) { respType := RegistriesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1008,6 +1041,8 @@ type RegistriesGenerateCredentialsPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RegistriesGenerateCredentialsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RegistriesGenerateCredentialsResponse, error) { respType := RegistriesGenerateCredentialsResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GenerateCredentialsResult) @@ -1082,6 +1117,8 @@ type RegistriesImportImagePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RegistriesImportImagePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RegistriesImportImageResponse, error) { respType := RegistriesImportImageResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1198,6 +1235,8 @@ type RegistriesScheduleRunPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RegistriesScheduleRunPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RegistriesScheduleRunResponse, error) { respType := RegistriesScheduleRunResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Run) @@ -1248,6 +1287,8 @@ type RegistriesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RegistriesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RegistriesUpdateResponse, error) { respType := RegistriesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Registry) @@ -1298,6 +1339,8 @@ type ReplicationsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ReplicationsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ReplicationsCreateResponse, error) { respType := ReplicationsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Replication) @@ -1348,6 +1391,8 @@ type ReplicationsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ReplicationsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ReplicationsDeleteResponse, error) { respType := ReplicationsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1416,6 +1461,8 @@ type ReplicationsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ReplicationsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ReplicationsUpdateResponse, error) { respType := ReplicationsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Replication) @@ -1466,6 +1513,8 @@ type RunsCancelPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RunsCancelPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RunsCancelResponse, error) { respType := RunsCancelResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1546,6 +1595,8 @@ type RunsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RunsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RunsUpdateResponse, error) { respType := RunsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Run) @@ -1596,6 +1647,8 @@ type ScopeMapsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ScopeMapsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ScopeMapsCreateResponse, error) { respType := ScopeMapsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ScopeMap) @@ -1646,6 +1699,8 @@ type ScopeMapsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ScopeMapsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ScopeMapsDeleteResponse, error) { respType := ScopeMapsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1714,6 +1769,8 @@ type ScopeMapsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ScopeMapsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ScopeMapsUpdateResponse, error) { respType := ScopeMapsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ScopeMap) @@ -1764,6 +1821,8 @@ type TaskRunsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TaskRunsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TaskRunsCreateResponse, error) { respType := TaskRunsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.TaskRun) @@ -1814,6 +1873,8 @@ type TaskRunsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TaskRunsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TaskRunsDeleteResponse, error) { respType := TaskRunsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1894,6 +1955,8 @@ type TaskRunsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TaskRunsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TaskRunsUpdateResponse, error) { respType := TaskRunsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.TaskRun) @@ -1944,6 +2007,8 @@ type TasksCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TasksCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TasksCreateResponse, error) { respType := TasksCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Task) @@ -1994,6 +2059,8 @@ type TasksDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TasksDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TasksDeleteResponse, error) { respType := TasksDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2074,6 +2141,8 @@ type TasksUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TasksUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TasksUpdateResponse, error) { respType := TasksUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Task) @@ -2124,6 +2193,8 @@ type TokensCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TokensCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TokensCreateResponse, error) { respType := TokensCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Token) @@ -2174,6 +2245,8 @@ type TokensDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TokensDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TokensDeleteResponse, error) { respType := TokensDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2242,6 +2315,8 @@ type TokensUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TokensUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TokensUpdateResponse, error) { respType := TokensUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Token) @@ -2292,6 +2367,8 @@ type WebhooksCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebhooksCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebhooksCreateResponse, error) { respType := WebhooksCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Webhook) @@ -2342,6 +2419,8 @@ type WebhooksDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebhooksDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebhooksDeleteResponse, error) { respType := WebhooksDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2446,6 +2525,8 @@ type WebhooksUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebhooksUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebhooksUpdateResponse, error) { respType := WebhooksUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Webhook) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_runs_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_runs_client.go index 493760b3278c..0d42c9d964f9 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_runs_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_runs_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // RunsClient contains the methods for the Runs group. @@ -32,8 +32,15 @@ type RunsClient struct { } // NewRunsClient creates a new instance of RunsClient with the specified values. -func NewRunsClient(con *arm.Connection, subscriptionID string) *RunsClient { - return &RunsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRunsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RunsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RunsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCancel - Cancel an existing run. @@ -167,7 +174,7 @@ func (client *RunsClient) getCreateRequest(ctx context.Context, resourceGroupNam func (client *RunsClient) getHandleResponse(resp *http.Response) (RunsGetResponse, error) { result := RunsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Run); err != nil { - return RunsGetResponse{}, err + return RunsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -236,7 +243,7 @@ func (client *RunsClient) getLogSasURLCreateRequest(ctx context.Context, resourc func (client *RunsClient) getLogSasURLHandleResponse(resp *http.Response) (RunsGetLogSasURLResponse, error) { result := RunsGetLogSasURLResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RunGetLogResult); err != nil { - return RunsGetLogSasURLResponse{}, err + return RunsGetLogSasURLResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -304,7 +311,7 @@ func (client *RunsClient) listCreateRequest(ctx context.Context, resourceGroupNa func (client *RunsClient) listHandleResponse(resp *http.Response) (RunsListResponse, error) { result := RunsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RunListResult); err != nil { - return RunsListResponse{}, err + return RunsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_scopemaps_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_scopemaps_client.go index a8d20109b684..21702e50fc4c 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_scopemaps_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_scopemaps_client.go @@ -11,14 +11,14 @@ package armcontainerregistry import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ScopeMapsClient contains the methods for the ScopeMaps group. @@ -30,8 +30,15 @@ type ScopeMapsClient struct { } // NewScopeMapsClient creates a new instance of ScopeMapsClient with the specified values. -func NewScopeMapsClient(con *arm.Connection, subscriptionID string) *ScopeMapsClient { - return &ScopeMapsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewScopeMapsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ScopeMapsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ScopeMapsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a scope map for a container registry with the specified parameters. @@ -95,7 +102,7 @@ func (client *ScopeMapsClient) createCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, scopeMapCreateParameters) @@ -174,7 +181,7 @@ func (client *ScopeMapsClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -232,7 +239,7 @@ func (client *ScopeMapsClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -242,7 +249,7 @@ func (client *ScopeMapsClient) getCreateRequest(ctx context.Context, resourceGro func (client *ScopeMapsClient) getHandleResponse(resp *http.Response) (ScopeMapsGetResponse, error) { result := ScopeMapsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ScopeMap); err != nil { - return ScopeMapsGetResponse{}, err + return ScopeMapsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -293,7 +300,7 @@ func (client *ScopeMapsClient) listCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -303,7 +310,7 @@ func (client *ScopeMapsClient) listCreateRequest(ctx context.Context, resourceGr func (client *ScopeMapsClient) listHandleResponse(resp *http.Response) (ScopeMapsListResponse, error) { result := ScopeMapsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ScopeMapListResult); err != nil { - return ScopeMapsListResponse{}, err + return ScopeMapsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -381,7 +388,7 @@ func (client *ScopeMapsClient) updateCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, scopeMapUpdateParameters) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_taskruns_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_taskruns_client.go index e61390fe7d16..7c42e1786218 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_taskruns_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_taskruns_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TaskRunsClient contains the methods for the TaskRuns group. @@ -31,8 +31,15 @@ type TaskRunsClient struct { } // NewTaskRunsClient creates a new instance of TaskRunsClient with the specified values. -func NewTaskRunsClient(con *arm.Connection, subscriptionID string) *TaskRunsClient { - return &TaskRunsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTaskRunsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TaskRunsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TaskRunsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a task run for a container registry with the specified parameters. @@ -246,7 +253,7 @@ func (client *TaskRunsClient) getCreateRequest(ctx context.Context, resourceGrou func (client *TaskRunsClient) getHandleResponse(resp *http.Response) (TaskRunsGetResponse, error) { result := TaskRunsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TaskRun); err != nil { - return TaskRunsGetResponse{}, err + return TaskRunsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -315,7 +322,7 @@ func (client *TaskRunsClient) getDetailsCreateRequest(ctx context.Context, resou func (client *TaskRunsClient) getDetailsHandleResponse(resp *http.Response) (TaskRunsGetDetailsResponse, error) { result := TaskRunsGetDetailsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TaskRun); err != nil { - return TaskRunsGetDetailsResponse{}, err + return TaskRunsGetDetailsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -377,7 +384,7 @@ func (client *TaskRunsClient) listCreateRequest(ctx context.Context, resourceGro func (client *TaskRunsClient) listHandleResponse(resp *http.Response) (TaskRunsListResponse, error) { result := TaskRunsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TaskRunListResult); err != nil { - return TaskRunsListResponse{}, err + return TaskRunsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_tasks_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_tasks_client.go index 5047add20db4..2600534d1285 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_tasks_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_tasks_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TasksClient contains the methods for the Tasks group. @@ -31,8 +31,15 @@ type TasksClient struct { } // NewTasksClient creates a new instance of TasksClient with the specified values. -func NewTasksClient(con *arm.Connection, subscriptionID string) *TasksClient { - return &TasksClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTasksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TasksClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TasksClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a task for a container registry with the specified parameters. @@ -246,7 +253,7 @@ func (client *TasksClient) getCreateRequest(ctx context.Context, resourceGroupNa func (client *TasksClient) getHandleResponse(resp *http.Response) (TasksGetResponse, error) { result := TasksGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Task); err != nil { - return TasksGetResponse{}, err + return TasksGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -315,7 +322,7 @@ func (client *TasksClient) getDetailsCreateRequest(ctx context.Context, resource func (client *TasksClient) getDetailsHandleResponse(resp *http.Response) (TasksGetDetailsResponse, error) { result := TasksGetDetailsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Task); err != nil { - return TasksGetDetailsResponse{}, err + return TasksGetDetailsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -377,7 +384,7 @@ func (client *TasksClient) listCreateRequest(ctx context.Context, resourceGroupN func (client *TasksClient) listHandleResponse(resp *http.Response) (TasksListResponse, error) { result := TasksListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TaskListResult); err != nil { - return TasksListResponse{}, err + return TasksListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_time_rfc3339.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_time_rfc3339.go index a143d5e6a2cf..28d1aee3cf1d 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armcontainerregistry import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_tokens_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_tokens_client.go index 6a20c261d2ce..249ae16092f8 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_tokens_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_tokens_client.go @@ -11,14 +11,14 @@ package armcontainerregistry import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TokensClient contains the methods for the Tokens group. @@ -30,8 +30,15 @@ type TokensClient struct { } // NewTokensClient creates a new instance of TokensClient with the specified values. -func NewTokensClient(con *arm.Connection, subscriptionID string) *TokensClient { - return &TokensClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTokensClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TokensClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TokensClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a token for a container registry with the specified parameters. @@ -95,7 +102,7 @@ func (client *TokensClient) createCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, tokenCreateParameters) @@ -174,7 +181,7 @@ func (client *TokensClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -232,7 +239,7 @@ func (client *TokensClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -242,7 +249,7 @@ func (client *TokensClient) getCreateRequest(ctx context.Context, resourceGroupN func (client *TokensClient) getHandleResponse(resp *http.Response) (TokensGetResponse, error) { result := TokensGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Token); err != nil { - return TokensGetResponse{}, err + return TokensGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -293,7 +300,7 @@ func (client *TokensClient) listCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -303,7 +310,7 @@ func (client *TokensClient) listCreateRequest(ctx context.Context, resourceGroup func (client *TokensClient) listHandleResponse(resp *http.Response) (TokensListResponse, error) { result := TokensListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TokenListResult); err != nil { - return TokensListResponse{}, err + return TokensListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -381,7 +388,7 @@ func (client *TokensClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, tokenUpdateParameters) diff --git a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_webhooks_client.go b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_webhooks_client.go index ef695349cf98..438b98312b35 100644 --- a/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_webhooks_client.go +++ b/sdk/resourcemanager/containerregistry/armcontainerregistry/zz_generated_webhooks_client.go @@ -11,14 +11,14 @@ package armcontainerregistry import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // WebhooksClient contains the methods for the Webhooks group. @@ -30,8 +30,15 @@ type WebhooksClient struct { } // NewWebhooksClient creates a new instance of WebhooksClient with the specified values. -func NewWebhooksClient(con *arm.Connection, subscriptionID string) *WebhooksClient { - return &WebhooksClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWebhooksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WebhooksClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WebhooksClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a webhook for a container registry with the specified parameters. @@ -95,7 +102,7 @@ func (client *WebhooksClient) createCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, webhookCreateParameters) @@ -174,7 +181,7 @@ func (client *WebhooksClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -232,7 +239,7 @@ func (client *WebhooksClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -242,7 +249,7 @@ func (client *WebhooksClient) getCreateRequest(ctx context.Context, resourceGrou func (client *WebhooksClient) getHandleResponse(resp *http.Response) (WebhooksGetResponse, error) { result := WebhooksGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Webhook); err != nil { - return WebhooksGetResponse{}, err + return WebhooksGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -300,7 +307,7 @@ func (client *WebhooksClient) getCallbackConfigCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -310,7 +317,7 @@ func (client *WebhooksClient) getCallbackConfigCreateRequest(ctx context.Context func (client *WebhooksClient) getCallbackConfigHandleResponse(resp *http.Response) (WebhooksGetCallbackConfigResponse, error) { result := WebhooksGetCallbackConfigResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CallbackConfig); err != nil { - return WebhooksGetCallbackConfigResponse{}, err + return WebhooksGetCallbackConfigResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -361,7 +368,7 @@ func (client *WebhooksClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -371,7 +378,7 @@ func (client *WebhooksClient) listCreateRequest(ctx context.Context, resourceGro func (client *WebhooksClient) listHandleResponse(resp *http.Response) (WebhooksListResponse, error) { result := WebhooksListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebhookListResult); err != nil { - return WebhooksListResponse{}, err + return WebhooksListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -426,7 +433,7 @@ func (client *WebhooksClient) listEventsCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -436,7 +443,7 @@ func (client *WebhooksClient) listEventsCreateRequest(ctx context.Context, resou func (client *WebhooksClient) listEventsHandleResponse(resp *http.Response) (WebhooksListEventsResponse, error) { result := WebhooksListEventsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventListResult); err != nil { - return WebhooksListEventsResponse{}, err + return WebhooksListEventsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -494,7 +501,7 @@ func (client *WebhooksClient) pingCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -504,7 +511,7 @@ func (client *WebhooksClient) pingCreateRequest(ctx context.Context, resourceGro func (client *WebhooksClient) pingHandleResponse(resp *http.Response) (WebhooksPingResponse, error) { result := WebhooksPingResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventInfo); err != nil { - return WebhooksPingResponse{}, err + return WebhooksPingResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -582,7 +589,7 @@ func (client *WebhooksClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-08-01-preview") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, webhookUpdateParameters) diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/CHANGELOG.md b/sdk/resourcemanager/containerservice/armcontainerservice/CHANGELOG.md index 5f20478cec1c..4c7c49e89df5 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/CHANGELOG.md +++ b/sdk/resourcemanager/containerservice/armcontainerservice/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-10-08) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/armcontainerservice". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/containerservice/armcontainerservice") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/README.md b/sdk/resourcemanager/containerservice/armcontainerservice/README.md index 8e818facfe50..4fe97990832c 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/README.md +++ b/sdk/resourcemanager/containerservice/armcontainerservice/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Container Service +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Container Service modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armcontainerservice.NewSnapshotsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Container Service modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armcontainerservice.NewSnapshotsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armcontainerservice.NewSnapshotsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/autorest.md b/sdk/resourcemanager/containerservice/armcontainerservice/autorest.md index 5b335dc0a03a..2ef8c094a74e 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/autorest.md +++ b/sdk/resourcemanager/containerservice/armcontainerservice/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/containerservice/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/containerservice/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/containerservice/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/containerservice/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/go.mod b/sdk/resourcemanager/containerservice/armcontainerservice/go.mod index b9764b2edf7e..84ca3371b1ef 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/go.mod +++ b/sdk/resourcemanager/containerservice/armcontainerservice/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/containerservice/ar go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/go.sum b/sdk/resourcemanager/containerservice/armcontainerservice/go.sum index 4f0fb709cf31..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/go.sum +++ b/sdk/resourcemanager/containerservice/armcontainerservice/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible h1:Cw16jiP4dI+CK761aq44ol4RV5dUiIIXky1+EKpoiVM= -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_agentpools_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_agentpools_client.go index 93ae3b0f49a1..d698ad3e122d 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_agentpools_client.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_agentpools_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AgentPoolsClient contains the methods for the AgentPools group. @@ -31,8 +31,15 @@ type AgentPoolsClient struct { } // NewAgentPoolsClient creates a new instance of AgentPoolsClient with the specified values. -func NewAgentPoolsClient(con *arm.Connection, subscriptionID string) *AgentPoolsClient { - return &AgentPoolsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAgentPoolsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AgentPoolsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AgentPoolsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates an agent pool in the specified managed cluster. @@ -96,7 +103,7 @@ func (client *AgentPoolsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -176,7 +183,7 @@ func (client *AgentPoolsClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *AgentPoolsClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *AgentPoolsClient) getCreateRequest(ctx context.Context, resourceGr func (client *AgentPoolsClient) getHandleResponse(resp *http.Response) (AgentPoolsGetResponse, error) { result := AgentPoolsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AgentPool); err != nil { - return AgentPoolsGetResponse{}, err + return AgentPoolsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -302,7 +309,7 @@ func (client *AgentPoolsClient) getAvailableAgentPoolVersionsCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -312,7 +319,7 @@ func (client *AgentPoolsClient) getAvailableAgentPoolVersionsCreateRequest(ctx c func (client *AgentPoolsClient) getAvailableAgentPoolVersionsHandleResponse(resp *http.Response) (AgentPoolsGetAvailableAgentPoolVersionsResponse, error) { result := AgentPoolsGetAvailableAgentPoolVersionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AgentPoolAvailableVersions); err != nil { - return AgentPoolsGetAvailableAgentPoolVersionsResponse{}, err + return AgentPoolsGetAvailableAgentPoolVersionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -370,7 +377,7 @@ func (client *AgentPoolsClient) getUpgradeProfileCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -380,7 +387,7 @@ func (client *AgentPoolsClient) getUpgradeProfileCreateRequest(ctx context.Conte func (client *AgentPoolsClient) getUpgradeProfileHandleResponse(resp *http.Response) (AgentPoolsGetUpgradeProfileResponse, error) { result := AgentPoolsGetUpgradeProfileResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AgentPoolUpgradeProfile); err != nil { - return AgentPoolsGetUpgradeProfileResponse{}, err + return AgentPoolsGetUpgradeProfileResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -432,7 +439,7 @@ func (client *AgentPoolsClient) listCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -442,7 +449,7 @@ func (client *AgentPoolsClient) listCreateRequest(ctx context.Context, resourceG func (client *AgentPoolsClient) listHandleResponse(resp *http.Response) (AgentPoolsListResponse, error) { result := AgentPoolsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AgentPoolListResult); err != nil { - return AgentPoolsListResponse{}, err + return AgentPoolsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -525,7 +532,7 @@ func (client *AgentPoolsClient) upgradeNodeImageVersionCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_constants.go b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_constants.go index 46eb781c7612..294e29476763 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_constants.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_constants.go @@ -10,7 +10,7 @@ package armcontainerservice const ( module = "armcontainerservice" - version = "v0.1.0" + version = "v0.2.0" ) // AgentPoolMode - A cluster must have at least one 'System' Agent Pool at all times. For additional information on agent pool restrictions and best practices, diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_maintenanceconfigurations_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_maintenanceconfigurations_client.go index b71322a74955..395db6cf6628 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_maintenanceconfigurations_client.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_maintenanceconfigurations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // MaintenanceConfigurationsClient contains the methods for the MaintenanceConfigurations group. @@ -30,8 +31,15 @@ type MaintenanceConfigurationsClient struct { } // NewMaintenanceConfigurationsClient creates a new instance of MaintenanceConfigurationsClient with the specified values. -func NewMaintenanceConfigurationsClient(con *arm.Connection, subscriptionID string) *MaintenanceConfigurationsClient { - return &MaintenanceConfigurationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewMaintenanceConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *MaintenanceConfigurationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MaintenanceConfigurationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a maintenance configuration in the specified managed cluster. @@ -75,7 +83,7 @@ func (client *MaintenanceConfigurationsClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -85,7 +93,7 @@ func (client *MaintenanceConfigurationsClient) createOrUpdateCreateRequest(ctx c func (client *MaintenanceConfigurationsClient) createOrUpdateHandleResponse(resp *http.Response) (MaintenanceConfigurationsCreateOrUpdateResponse, error) { result := MaintenanceConfigurationsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MaintenanceConfiguration); err != nil { - return MaintenanceConfigurationsCreateOrUpdateResponse{}, err + return MaintenanceConfigurationsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -144,7 +152,7 @@ func (client *MaintenanceConfigurationsClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -204,7 +212,7 @@ func (client *MaintenanceConfigurationsClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -214,7 +222,7 @@ func (client *MaintenanceConfigurationsClient) getCreateRequest(ctx context.Cont func (client *MaintenanceConfigurationsClient) getHandleResponse(resp *http.Response) (MaintenanceConfigurationsGetResponse, error) { result := MaintenanceConfigurationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MaintenanceConfiguration); err != nil { - return MaintenanceConfigurationsGetResponse{}, err + return MaintenanceConfigurationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -266,7 +274,7 @@ func (client *MaintenanceConfigurationsClient) listByManagedClusterCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -276,7 +284,7 @@ func (client *MaintenanceConfigurationsClient) listByManagedClusterCreateRequest func (client *MaintenanceConfigurationsClient) listByManagedClusterHandleResponse(resp *http.Response) (MaintenanceConfigurationsListByManagedClusterResponse, error) { result := MaintenanceConfigurationsListByManagedClusterResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MaintenanceConfigurationListResult); err != nil { - return MaintenanceConfigurationsListByManagedClusterResponse{}, err + return MaintenanceConfigurationsListByManagedClusterResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_managedclusters_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_managedclusters_client.go index 8f63f91fb0d9..0895c55c5bb2 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_managedclusters_client.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_managedclusters_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedClustersClient contains the methods for the ManagedClusters group. @@ -31,8 +31,15 @@ type ManagedClustersClient struct { } // NewManagedClustersClient creates a new instance of ManagedClustersClient with the specified values. -func NewManagedClustersClient(con *arm.Connection, subscriptionID string) *ManagedClustersClient { - return &ManagedClustersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedClustersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedClustersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a managed cluster. @@ -92,7 +99,7 @@ func (client *ManagedClustersClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *ManagedClustersClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *ManagedClustersClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +241,7 @@ func (client *ManagedClustersClient) getCreateRequest(ctx context.Context, resou func (client *ManagedClustersClient) getHandleResponse(resp *http.Response) (ManagedClustersGetResponse, error) { result := ManagedClustersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedCluster); err != nil { - return ManagedClustersGetResponse{}, err + return ManagedClustersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -295,7 +302,7 @@ func (client *ManagedClustersClient) getAccessProfileCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -305,7 +312,7 @@ func (client *ManagedClustersClient) getAccessProfileCreateRequest(ctx context.C func (client *ManagedClustersClient) getAccessProfileHandleResponse(resp *http.Response) (ManagedClustersGetAccessProfileResponse, error) { result := ManagedClustersGetAccessProfileResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedClusterAccessProfile); err != nil { - return ManagedClustersGetAccessProfileResponse{}, err + return ManagedClustersGetAccessProfileResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -364,7 +371,7 @@ func (client *ManagedClustersClient) getCommandResultCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -374,7 +381,7 @@ func (client *ManagedClustersClient) getCommandResultCreateRequest(ctx context.C func (client *ManagedClustersClient) getCommandResultHandleResponse(resp *http.Response) (ManagedClustersGetCommandResultResponse, error) { result := ManagedClustersGetCommandResultResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RunCommandResult); err != nil { - return ManagedClustersGetCommandResultResponse{}, err + return ManagedClustersGetCommandResultResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -425,7 +432,7 @@ func (client *ManagedClustersClient) getOSOptionsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") if options != nil && options.ResourceType != nil { reqQP.Set("resource-type", *options.ResourceType) } @@ -438,7 +445,7 @@ func (client *ManagedClustersClient) getOSOptionsCreateRequest(ctx context.Conte func (client *ManagedClustersClient) getOSOptionsHandleResponse(resp *http.Response) (ManagedClustersGetOSOptionsResponse, error) { result := ManagedClustersGetOSOptionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OSOptionProfile); err != nil { - return ManagedClustersGetOSOptionsResponse{}, err + return ManagedClustersGetOSOptionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -493,7 +500,7 @@ func (client *ManagedClustersClient) getUpgradeProfileCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -503,7 +510,7 @@ func (client *ManagedClustersClient) getUpgradeProfileCreateRequest(ctx context. func (client *ManagedClustersClient) getUpgradeProfileHandleResponse(resp *http.Response) (ManagedClustersGetUpgradeProfileResponse, error) { result := ManagedClustersGetUpgradeProfileResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedClusterUpgradeProfile); err != nil { - return ManagedClustersGetUpgradeProfileResponse{}, err + return ManagedClustersGetUpgradeProfileResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -547,7 +554,7 @@ func (client *ManagedClustersClient) listCreateRequest(ctx context.Context, opti return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -557,7 +564,7 @@ func (client *ManagedClustersClient) listCreateRequest(ctx context.Context, opti func (client *ManagedClustersClient) listHandleResponse(resp *http.Response) (ManagedClustersListResponse, error) { result := ManagedClustersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedClusterListResult); err != nil { - return ManagedClustersListResponse{}, err + return ManagedClustersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -605,7 +612,7 @@ func (client *ManagedClustersClient) listByResourceGroupCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -615,7 +622,7 @@ func (client *ManagedClustersClient) listByResourceGroupCreateRequest(ctx contex func (client *ManagedClustersClient) listByResourceGroupHandleResponse(resp *http.Response) (ManagedClustersListByResourceGroupResponse, error) { result := ManagedClustersListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedClusterListResult); err != nil { - return ManagedClustersListByResourceGroupResponse{}, err + return ManagedClustersListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -670,7 +677,7 @@ func (client *ManagedClustersClient) listClusterAdminCredentialsCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") if options != nil && options.ServerFqdn != nil { reqQP.Set("server-fqdn", *options.ServerFqdn) } @@ -683,7 +690,7 @@ func (client *ManagedClustersClient) listClusterAdminCredentialsCreateRequest(ct func (client *ManagedClustersClient) listClusterAdminCredentialsHandleResponse(resp *http.Response) (ManagedClustersListClusterAdminCredentialsResponse, error) { result := ManagedClustersListClusterAdminCredentialsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CredentialResults); err != nil { - return ManagedClustersListClusterAdminCredentialsResponse{}, err + return ManagedClustersListClusterAdminCredentialsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -738,7 +745,7 @@ func (client *ManagedClustersClient) listClusterMonitoringUserCredentialsCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") if options != nil && options.ServerFqdn != nil { reqQP.Set("server-fqdn", *options.ServerFqdn) } @@ -751,7 +758,7 @@ func (client *ManagedClustersClient) listClusterMonitoringUserCredentialsCreateR func (client *ManagedClustersClient) listClusterMonitoringUserCredentialsHandleResponse(resp *http.Response) (ManagedClustersListClusterMonitoringUserCredentialsResponse, error) { result := ManagedClustersListClusterMonitoringUserCredentialsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CredentialResults); err != nil { - return ManagedClustersListClusterMonitoringUserCredentialsResponse{}, err + return ManagedClustersListClusterMonitoringUserCredentialsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -806,7 +813,7 @@ func (client *ManagedClustersClient) listClusterUserCredentialsCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") if options != nil && options.ServerFqdn != nil { reqQP.Set("server-fqdn", *options.ServerFqdn) } @@ -819,7 +826,7 @@ func (client *ManagedClustersClient) listClusterUserCredentialsCreateRequest(ctx func (client *ManagedClustersClient) listClusterUserCredentialsHandleResponse(resp *http.Response) (ManagedClustersListClusterUserCredentialsResponse, error) { result := ManagedClustersListClusterUserCredentialsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CredentialResults); err != nil { - return ManagedClustersListClusterUserCredentialsResponse{}, err + return ManagedClustersListClusterUserCredentialsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -872,7 +879,7 @@ func (client *ManagedClustersClient) listOutboundNetworkDependenciesEndpointsCre return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -882,7 +889,7 @@ func (client *ManagedClustersClient) listOutboundNetworkDependenciesEndpointsCre func (client *ManagedClustersClient) listOutboundNetworkDependenciesEndpointsHandleResponse(resp *http.Response) (ManagedClustersListOutboundNetworkDependenciesEndpointsResponse, error) { result := ManagedClustersListOutboundNetworkDependenciesEndpointsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OutboundEnvironmentEndpointCollection); err != nil { - return ManagedClustersListOutboundNetworkDependenciesEndpointsResponse{}, err + return ManagedClustersListOutboundNetworkDependenciesEndpointsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -957,7 +964,7 @@ func (client *ManagedClustersClient) resetAADProfileCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -1033,7 +1040,7 @@ func (client *ManagedClustersClient) resetServicePrincipalProfileCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -1111,7 +1118,7 @@ func (client *ManagedClustersClient) rotateClusterCertificatesCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1189,7 +1196,7 @@ func (client *ManagedClustersClient) runCommandCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, requestPayload) @@ -1265,7 +1272,7 @@ func (client *ManagedClustersClient) startCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1347,7 +1354,7 @@ func (client *ManagedClustersClient) stopCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1423,7 +1430,7 @@ func (client *ManagedClustersClient) updateTagsCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_models.go b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_models.go index a5791913563d..c1bbb43855f5 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_models.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_models.go @@ -10,11 +10,10 @@ package armcontainerservice import ( "encoding/json" - "reflect" - "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "reflect" + "time" ) // AccessProfile - Profile for enabling a user to access a managed cluster. @@ -269,11 +268,11 @@ type CommandResultProperties struct { func (c CommandResultProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "exitCode", c.ExitCode) - populate(objectMap, "finishedAt", (*timeRFC3339)(c.FinishedAt)) + populateTimeRFC3339(objectMap, "finishedAt", c.FinishedAt) populate(objectMap, "logs", c.Logs) populate(objectMap, "provisioningState", c.ProvisioningState) populate(objectMap, "reason", c.Reason) - populate(objectMap, "startedAt", (*timeRFC3339)(c.StartedAt)) + populateTimeRFC3339(objectMap, "startedAt", c.StartedAt) return json.Marshal(objectMap) } @@ -290,9 +289,7 @@ func (c *CommandResultProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.ExitCode) delete(rawMsg, key) case "finishedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.FinishedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.FinishedAt) delete(rawMsg, key) case "logs": err = unpopulate(val, &c.Logs) @@ -304,9 +301,7 @@ func (c *CommandResultProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.Reason) delete(rawMsg, key) case "startedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.StartedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.StartedAt) delete(rawMsg, key) } if err != nil { @@ -822,9 +817,9 @@ type ManagedClusterAgentPoolProfileProperties struct { // The list of Availability zones to use for nodes. This can only be specified if the AgentPoolType property is 'VirtualMachineScaleSets'. AvailabilityZones []*string `json:"availabilityZones,omitempty"` - // Desired Number of agents (VMs) specified to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in - // the range of 1 to 1000 (inclusive) for system - // pools. The default value is 1. + // Number of agents (VMs) to host docker containers. Allowed values must be in the range of 0 to 1000 (inclusive) for user pools and in the range of 1 to + // 1000 (inclusive) for system pools. The default + // value is 1. Count *int32 `json:"count,omitempty"` // CreationData to be used to specify the source Snapshot ID if the node pool will be created/upgraded using a snapshot. @@ -907,6 +902,11 @@ type ManagedClusterAgentPoolProfileProperties struct { // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualNetworks/{virtualNetworkName}/subnets/{subnetName} PodSubnetID *string `json:"podSubnetID,omitempty"` + // When an Agent Pool is first created it is initially Running. The Agent Pool can be stopped by setting this field to Stopped. A stopped Agent Pool stops + // all of its VMs and does not accrue billing + // charges. An Agent Pool can only be stopped if it is Running and provisioning state is Succeeded + PowerState *PowerState `json:"powerState,omitempty"` + // The ID for Proximity Placement Group. ProximityPlacementGroupID *string `json:"proximityPlacementGroupID,omitempty"` @@ -949,9 +949,6 @@ type ManagedClusterAgentPoolProfileProperties struct { // READ-ONLY; The version of node image NodeImageVersion *string `json:"nodeImageVersion,omitempty" azure:"ro"` - // READ-ONLY; Describes whether the Agent Pool is Running or Stopped - PowerState *PowerState `json:"powerState,omitempty" azure:"ro"` - // READ-ONLY; The current deployment or provisioning state. ProvisioningState *string `json:"provisioningState,omitempty" azure:"ro"` } @@ -1602,6 +1599,9 @@ type ManagedClusterWindowsProfile struct { // For more details on CSI proxy, see the CSI proxy GitHub repo [https://github.com/kubernetes-csi/csi-proxy]. EnableCSIProxy *bool `json:"enableCSIProxy,omitempty"` + // The Windows gMSA Profile in the Managed Cluster. + GmsaProfile *WindowsGmsaProfile `json:"gmsaProfile,omitempty"` + // The license type to use for Windows VMs. See Azure Hybrid User Benefits [https://azure.microsoft.com/pricing/hybrid-benefit/faq/] for more details. LicenseType *LicenseType `json:"licenseType,omitempty"` } @@ -2076,6 +2076,24 @@ type SnapshotProperties struct { // The type of a snapshot. The default is NodePool. SnapshotType *SnapshotType `json:"snapshotType,omitempty"` + + // READ-ONLY; Whether to use a FIPS-enabled OS. + EnableFIPS *bool `json:"enableFIPS,omitempty" azure:"ro"` + + // READ-ONLY; The version of Kubernetes. + KubernetesVersion *string `json:"kubernetesVersion,omitempty" azure:"ro"` + + // READ-ONLY; The version of node image. + NodeImageVersion *string `json:"nodeImageVersion,omitempty" azure:"ro"` + + // READ-ONLY; Specifies an OS SKU. This value must not be specified if OSType is Windows. + OSSKU *OSSKU `json:"osSku,omitempty" azure:"ro"` + + // READ-ONLY; The operating system type. The default is Linux. + OSType *OSType `json:"osType,omitempty" azure:"ro"` + + // READ-ONLY; The size of the VM. + VMSize *string `json:"vmSize,omitempty" azure:"ro"` } // SnapshotsCreateOrUpdateOptions contains the optional parameters for the Snapshots.CreateOrUpdate method. @@ -2231,10 +2249,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -2250,9 +2268,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -2261,9 +2277,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) @@ -2323,8 +2337,8 @@ type TimeSpan struct { // MarshalJSON implements the json.Marshaller interface for type TimeSpan. func (t TimeSpan) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "end", (*timeRFC3339)(t.End)) - populate(objectMap, "start", (*timeRFC3339)(t.Start)) + populateTimeRFC3339(objectMap, "end", t.End) + populateTimeRFC3339(objectMap, "start", t.Start) return json.Marshal(objectMap) } @@ -2338,14 +2352,10 @@ func (t *TimeSpan) UnmarshalJSON(data []byte) error { var err error switch key { case "end": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.End = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.End) delete(rawMsg, key) case "start": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.Start = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.Start) delete(rawMsg, key) } if err != nil { @@ -2367,6 +2377,20 @@ type UserAssignedIdentity struct { ResourceID *string `json:"resourceId,omitempty"` } +// WindowsGmsaProfile - Windows gMSA Profile in the managed cluster. +type WindowsGmsaProfile struct { + // Specifies the DNS server for Windows gMSA. + // Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. + DNSServer *string `json:"dnsServer,omitempty"` + + // Specifies whether to enable Windows gMSA in the managed cluster. + Enabled *bool `json:"enabled,omitempty"` + + // Specifies the root domain name for Windows gMSA. + // Set it to empty if you have configured the DNS server in the vnet which is used to create the managed cluster. + RootDomainName *string `json:"rootDomainName,omitempty"` +} + func populate(m map[string]interface{}, k string, v interface{}) { if v == nil { return diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_operations_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_operations_client.go index 31ec6cfa1c4a..0ea8604fc7a8 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_operations_client.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armcontainerservice import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets a list of operations. @@ -55,7 +63,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -65,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_pagers.go b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_pagers.go index c15bef49bfee..c463d038a3bf 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_pagers.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armcontainerservice import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // AgentPoolsListPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_pollers.go b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_pollers.go index 88da0f85508c..d2b00f29d272 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_pollers.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armcontainerservice import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // AgentPoolsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_privateendpointconnections_client.go index bf61e699bf1d..53060eca2aaf 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_privateendpointconnections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. @@ -31,8 +31,15 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { - return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginDelete - Deletes a private endpoint connection. @@ -96,7 +103,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -156,7 +163,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -166,7 +173,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsGetResponse{}, err + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -221,7 +228,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -231,7 +238,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListResponse, error) { result := PrivateEndpointConnectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionsListResponse{}, err + return PrivateEndpointConnectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -290,7 +297,7 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -300,7 +307,7 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. func (client *PrivateEndpointConnectionsClient) updateHandleResponse(resp *http.Response) (PrivateEndpointConnectionsUpdateResponse, error) { result := PrivateEndpointConnectionsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsUpdateResponse{}, err + return PrivateEndpointConnectionsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_privatelinkresources_client.go index 74c484d5c106..438286c155c6 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_privatelinkresources_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. @@ -30,8 +31,15 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { - return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - To learn more about private clusters, see: https://docs.microsoft.com/azure/aks/private-clusters @@ -71,7 +79,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -81,7 +89,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, func (client *PrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (PrivateLinkResourcesListResponse, error) { result := PrivateLinkResourcesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourcesListResult); err != nil { - return PrivateLinkResourcesListResponse{}, err + return PrivateLinkResourcesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_resolveprivatelinkserviceid_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_resolveprivatelinkserviceid_client.go index f07101c18d12..75d3c06831c4 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_resolveprivatelinkserviceid_client.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_resolveprivatelinkserviceid_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ResolvePrivateLinkServiceIDClient contains the methods for the ResolvePrivateLinkServiceID group. @@ -30,8 +31,15 @@ type ResolvePrivateLinkServiceIDClient struct { } // NewResolvePrivateLinkServiceIDClient creates a new instance of ResolvePrivateLinkServiceIDClient with the specified values. -func NewResolvePrivateLinkServiceIDClient(con *arm.Connection, subscriptionID string) *ResolvePrivateLinkServiceIDClient { - return &ResolvePrivateLinkServiceIDClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewResolvePrivateLinkServiceIDClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ResolvePrivateLinkServiceIDClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ResolvePrivateLinkServiceIDClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // POST - Gets the private link service ID for the specified managed cluster. @@ -71,7 +79,7 @@ func (client *ResolvePrivateLinkServiceIDClient) postCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -81,7 +89,7 @@ func (client *ResolvePrivateLinkServiceIDClient) postCreateRequest(ctx context.C func (client *ResolvePrivateLinkServiceIDClient) postHandleResponse(resp *http.Response) (ResolvePrivateLinkServiceIDPOSTResponse, error) { result := ResolvePrivateLinkServiceIDPOSTResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { - return ResolvePrivateLinkServiceIDPOSTResponse{}, err + return ResolvePrivateLinkServiceIDPOSTResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_response_types.go b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_response_types.go index 510ff35cf35d..62c1d66fe9c8 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_response_types.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armcontainerservice import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // AgentPoolsCreateOrUpdatePollerResponse contains the response from method AgentPools.CreateOrUpdate. @@ -26,6 +25,8 @@ type AgentPoolsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AgentPoolsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AgentPoolsCreateOrUpdateResponse, error) { respType := AgentPoolsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AgentPool) @@ -76,6 +77,8 @@ type AgentPoolsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AgentPoolsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AgentPoolsDeleteResponse, error) { respType := AgentPoolsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -168,6 +171,8 @@ type AgentPoolsUpgradeNodeImageVersionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AgentPoolsUpgradeNodeImageVersionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AgentPoolsUpgradeNodeImageVersionResponse, error) { respType := AgentPoolsUpgradeNodeImageVersionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AgentPool) @@ -260,6 +265,8 @@ type ManagedClustersCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedClustersCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedClustersCreateOrUpdateResponse, error) { respType := ManagedClustersCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedCluster) @@ -310,6 +317,8 @@ type ManagedClustersDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedClustersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedClustersDeleteResponse, error) { respType := ManagedClustersDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -486,6 +495,8 @@ type ManagedClustersResetAADProfilePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedClustersResetAADProfilePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedClustersResetAADProfileResponse, error) { respType := ManagedClustersResetAADProfileResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -530,6 +541,8 @@ type ManagedClustersResetServicePrincipalProfilePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedClustersResetServicePrincipalProfilePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedClustersResetServicePrincipalProfileResponse, error) { respType := ManagedClustersResetServicePrincipalProfileResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -574,6 +587,8 @@ type ManagedClustersRotateClusterCertificatesPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedClustersRotateClusterCertificatesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedClustersRotateClusterCertificatesResponse, error) { respType := ManagedClustersRotateClusterCertificatesResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -618,6 +633,8 @@ type ManagedClustersRunCommandPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedClustersRunCommandPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedClustersRunCommandResponse, error) { respType := ManagedClustersRunCommandResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RunCommandResult) @@ -668,6 +685,8 @@ type ManagedClustersStartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedClustersStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedClustersStartResponse, error) { respType := ManagedClustersStartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -712,6 +731,8 @@ type ManagedClustersStopPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedClustersStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedClustersStopResponse, error) { respType := ManagedClustersStopResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -756,6 +777,8 @@ type ManagedClustersUpdateTagsPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedClustersUpdateTagsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedClustersUpdateTagsResponse, error) { respType := ManagedClustersUpdateTagsResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedCluster) @@ -818,6 +841,8 @@ type PrivateEndpointConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsDeleteResponse, error) { respType := PrivateEndpointConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_snapshots_client.go b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_snapshots_client.go index 7d67197fc67b..3e45f45152fc 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_snapshots_client.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_snapshots_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SnapshotsClient contains the methods for the Snapshots group. @@ -30,8 +31,15 @@ type SnapshotsClient struct { } // NewSnapshotsClient creates a new instance of SnapshotsClient with the specified values. -func NewSnapshotsClient(con *arm.Connection, subscriptionID string) *SnapshotsClient { - return &SnapshotsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSnapshotsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SnapshotsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SnapshotsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a snapshot. @@ -71,7 +79,7 @@ func (client *SnapshotsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -81,7 +89,7 @@ func (client *SnapshotsClient) createOrUpdateCreateRequest(ctx context.Context, func (client *SnapshotsClient) createOrUpdateHandleResponse(resp *http.Response) (SnapshotsCreateOrUpdateResponse, error) { result := SnapshotsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Snapshot); err != nil { - return SnapshotsCreateOrUpdateResponse{}, err + return SnapshotsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -136,7 +144,7 @@ func (client *SnapshotsClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -192,7 +200,7 @@ func (client *SnapshotsClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -202,7 +210,7 @@ func (client *SnapshotsClient) getCreateRequest(ctx context.Context, resourceGro func (client *SnapshotsClient) getHandleResponse(resp *http.Response) (SnapshotsGetResponse, error) { result := SnapshotsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Snapshot); err != nil { - return SnapshotsGetResponse{}, err + return SnapshotsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -246,7 +254,7 @@ func (client *SnapshotsClient) listCreateRequest(ctx context.Context, options *S return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -256,7 +264,7 @@ func (client *SnapshotsClient) listCreateRequest(ctx context.Context, options *S func (client *SnapshotsClient) listHandleResponse(resp *http.Response) (SnapshotsListResponse, error) { result := SnapshotsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotListResult); err != nil { - return SnapshotsListResponse{}, err + return SnapshotsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -304,7 +312,7 @@ func (client *SnapshotsClient) listByResourceGroupCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -314,7 +322,7 @@ func (client *SnapshotsClient) listByResourceGroupCreateRequest(ctx context.Cont func (client *SnapshotsClient) listByResourceGroupHandleResponse(resp *http.Response) (SnapshotsListByResourceGroupResponse, error) { result := SnapshotsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotListResult); err != nil { - return SnapshotsListByResourceGroupResponse{}, err + return SnapshotsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -369,7 +377,7 @@ func (client *SnapshotsClient) updateTagsCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-08-01") + reqQP.Set("api-version", "2021-09-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -379,7 +387,7 @@ func (client *SnapshotsClient) updateTagsCreateRequest(ctx context.Context, reso func (client *SnapshotsClient) updateTagsHandleResponse(resp *http.Response) (SnapshotsUpdateTagsResponse, error) { result := SnapshotsUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Snapshot); err != nil { - return SnapshotsUpdateTagsResponse{}, err + return SnapshotsUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_time_rfc3339.go b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_time_rfc3339.go index 7fc942454ab5..efe81fe66d23 100644 --- a/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/containerservice/armcontainerservice/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armcontainerservice import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md b/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md index d7a84c77149d..2abc9f558dc9 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md +++ b/sdk/resourcemanager/cosmos/armcosmos/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-10-08) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/cosmos/armcosmos") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/cosmos/armcosmos/README.md b/sdk/resourcemanager/cosmos/armcosmos/README.md index c9e573251abd..e9f9be2c1b5c 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/README.md +++ b/sdk/resourcemanager/cosmos/armcosmos/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Cosmos DB +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Cosmos DB modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armcosmos.NewDatabaseClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Cosmos DB modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armcosmos.{{NewClientMethod}} +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armcosmos.NewDatabaseClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/cosmos/armcosmos/autorest.md b/sdk/resourcemanager/cosmos/armcosmos/autorest.md index 3b4b492f0269..f91ae2ae19d0 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/autorest.md +++ b/sdk/resourcemanager/cosmos/armcosmos/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/cosmos-db/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/cosmos-db/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/cosmos-db/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/cosmos-db/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/cosmos/armcosmos/go.mod b/sdk/resourcemanager/cosmos/armcosmos/go.mod index e318d8d8e880..80f865ba4b8e 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/go.mod +++ b/sdk/resourcemanager/cosmos/armcosmos/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/cosmos/armcosmos go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/cosmos/armcosmos/go.sum b/sdk/resourcemanager/cosmos/armcosmos/go.sum index 4f0fb709cf31..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/go.sum +++ b/sdk/resourcemanager/cosmos/armcosmos/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible h1:Cw16jiP4dI+CK761aq44ol4RV5dUiIIXky1+EKpoiVM= -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_cassandraclusters_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_cassandraclusters_client.go index 25d93c717b60..e61fd4e1a12a 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_cassandraclusters_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_cassandraclusters_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CassandraClustersClient contains the methods for the CassandraClusters group. @@ -31,8 +31,15 @@ type CassandraClustersClient struct { } // NewCassandraClustersClient creates a new instance of CassandraClustersClient with the specified values. -func NewCassandraClustersClient(con *arm.Connection, subscriptionID string) *CassandraClustersClient { - return &CassandraClustersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCassandraClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CassandraClustersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CassandraClustersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateUpdate - Create or update a managed Cassandra cluster. When updating, you must specify all writable properties. To update only some properties, @@ -94,7 +101,7 @@ func (client *CassandraClustersClient) createUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, body) @@ -113,30 +120,34 @@ func (client *CassandraClustersClient) createUpdateHandleError(resp *http.Respon return runtime.NewResponseError(&errType, resp) } -// BeginDelete - Deletes a managed Cassandra cluster. +// BeginDeallocate - Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host virtual machine of this +// cluster, and reserved the data disk. This won't do anything on an +// already deallocated cluster. Use Start to restart the cluster. // If the operation fails it returns the *CloudError error type. -func (client *CassandraClustersClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersBeginDeleteOptions) (CassandraClustersDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, options) +func (client *CassandraClustersClient) BeginDeallocate(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersBeginDeallocateOptions) (CassandraClustersDeallocatePollerResponse, error) { + resp, err := client.deallocate(ctx, resourceGroupName, clusterName, options) if err != nil { - return CassandraClustersDeletePollerResponse{}, err + return CassandraClustersDeallocatePollerResponse{}, err } - result := CassandraClustersDeletePollerResponse{ + result := CassandraClustersDeallocatePollerResponse{ RawResponse: resp, } - pt, err := armruntime.NewPoller("CassandraClustersClient.Delete", "", resp, client.pl, client.deleteHandleError) + pt, err := armruntime.NewPoller("CassandraClustersClient.Deallocate", "", resp, client.pl, client.deallocateHandleError) if err != nil { - return CassandraClustersDeletePollerResponse{}, err + return CassandraClustersDeallocatePollerResponse{}, err } - result.Poller = &CassandraClustersDeletePoller{ + result.Poller = &CassandraClustersDeallocatePoller{ pt: pt, } return result, nil } -// Delete - Deletes a managed Cassandra cluster. +// Deallocate - Deallocate the Managed Cassandra Cluster and Associated Data Centers. Deallocation will deallocate the host virtual machine of this cluster, +// and reserved the data disk. This won't do anything on an +// already deallocated cluster. Use Start to restart the cluster. // If the operation fails it returns the *CloudError error type. -func (client *CassandraClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, options) +func (client *CassandraClustersClient) deallocate(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersBeginDeallocateOptions) (*http.Response, error) { + req, err := client.deallocateCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { return nil, err } @@ -144,15 +155,15 @@ func (client *CassandraClustersClient) deleteOperation(ctx context.Context, reso if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { - return nil, client.deleteHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, client.deallocateHandleError(resp) } return resp, nil } -// deleteCreateRequest creates the Delete request. -func (client *CassandraClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}" +// deallocateCreateRequest creates the Deallocate request. +func (client *CassandraClustersClient) deallocateCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersBeginDeallocateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/deallocate" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -165,19 +176,19 @@ func (client *CassandraClustersClient) deleteCreateRequest(ctx context.Context, return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil } -// deleteHandleError handles the Delete error response. -func (client *CassandraClustersClient) deleteHandleError(resp *http.Response) error { +// deallocateHandleError handles the Deallocate error response. +func (client *CassandraClustersClient) deallocateHandleError(resp *http.Response) error { body, err := runtime.Payload(resp) if err != nil { return runtime.NewResponseError(err, resp) @@ -189,30 +200,30 @@ func (client *CassandraClustersClient) deleteHandleError(resp *http.Response) er return runtime.NewResponseError(&errType, resp) } -// BeginFetchNodeStatus - Request the status of all nodes in the cluster (as returned by 'nodetool status'). +// BeginDelete - Deletes a managed Cassandra cluster. // If the operation fails it returns the *CloudError error type. -func (client *CassandraClustersClient) BeginFetchNodeStatus(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersBeginFetchNodeStatusOptions) (CassandraClustersFetchNodeStatusPollerResponse, error) { - resp, err := client.fetchNodeStatus(ctx, resourceGroupName, clusterName, options) +func (client *CassandraClustersClient) BeginDelete(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersBeginDeleteOptions) (CassandraClustersDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, clusterName, options) if err != nil { - return CassandraClustersFetchNodeStatusPollerResponse{}, err + return CassandraClustersDeletePollerResponse{}, err } - result := CassandraClustersFetchNodeStatusPollerResponse{ + result := CassandraClustersDeletePollerResponse{ RawResponse: resp, } - pt, err := armruntime.NewPoller("CassandraClustersClient.FetchNodeStatus", "", resp, client.pl, client.fetchNodeStatusHandleError) + pt, err := armruntime.NewPoller("CassandraClustersClient.Delete", "", resp, client.pl, client.deleteHandleError) if err != nil { - return CassandraClustersFetchNodeStatusPollerResponse{}, err + return CassandraClustersDeletePollerResponse{}, err } - result.Poller = &CassandraClustersFetchNodeStatusPoller{ + result.Poller = &CassandraClustersDeletePoller{ pt: pt, } return result, nil } -// FetchNodeStatus - Request the status of all nodes in the cluster (as returned by 'nodetool status'). +// Delete - Deletes a managed Cassandra cluster. // If the operation fails it returns the *CloudError error type. -func (client *CassandraClustersClient) fetchNodeStatus(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersBeginFetchNodeStatusOptions) (*http.Response, error) { - req, err := client.fetchNodeStatusCreateRequest(ctx, resourceGroupName, clusterName, options) +func (client *CassandraClustersClient) deleteOperation(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { return nil, err } @@ -220,15 +231,15 @@ func (client *CassandraClustersClient) fetchNodeStatus(ctx context.Context, reso if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, client.fetchNodeStatusHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) } return resp, nil } -// fetchNodeStatusCreateRequest creates the FetchNodeStatus request. -func (client *CassandraClustersClient) fetchNodeStatusCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersBeginFetchNodeStatusOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/fetchNodeStatus" +// deleteCreateRequest creates the Delete request. +func (client *CassandraClustersClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -241,19 +252,19 @@ func (client *CassandraClustersClient) fetchNodeStatusCreateRequest(ctx context. return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil } -// fetchNodeStatusHandleError handles the FetchNodeStatus error response. -func (client *CassandraClustersClient) fetchNodeStatusHandleError(resp *http.Response) error { +// deleteHandleError handles the Delete error response. +func (client *CassandraClustersClient) deleteHandleError(resp *http.Response) error { body, err := runtime.Payload(resp) if err != nil { return runtime.NewResponseError(err, resp) @@ -302,7 +313,7 @@ func (client *CassandraClustersClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -312,7 +323,7 @@ func (client *CassandraClustersClient) getCreateRequest(ctx context.Context, res func (client *CassandraClustersClient) getHandleResponse(resp *http.Response) (CassandraClustersGetResponse, error) { result := CassandraClustersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ClusterResource); err != nil { - return CassandraClustersGetResponse{}, err + return CassandraClustersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -330,95 +341,46 @@ func (client *CassandraClustersClient) getHandleError(resp *http.Response) error return runtime.NewResponseError(&errType, resp) } -// GetBackup - Get the properties of an individual backup of this cluster that is available to restore. +// BeginInvokeCommand - Invoke a command like nodetool for cassandra maintenance // If the operation fails it returns the *CloudError error type. -func (client *CassandraClustersClient) GetBackup(ctx context.Context, resourceGroupName string, clusterName string, backupID string, options *CassandraClustersGetBackupOptions) (CassandraClustersGetBackupResponse, error) { - req, err := client.getBackupCreateRequest(ctx, resourceGroupName, clusterName, backupID, options) - if err != nil { - return CassandraClustersGetBackupResponse{}, err - } - resp, err := client.pl.Do(req) +func (client *CassandraClustersClient) BeginInvokeCommand(ctx context.Context, resourceGroupName string, clusterName string, body CommandPostBody, options *CassandraClustersBeginInvokeCommandOptions) (CassandraClustersInvokeCommandPollerResponse, error) { + resp, err := client.invokeCommand(ctx, resourceGroupName, clusterName, body, options) if err != nil { - return CassandraClustersGetBackupResponse{}, err + return CassandraClustersInvokeCommandPollerResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CassandraClustersGetBackupResponse{}, client.getBackupHandleError(resp) - } - return client.getBackupHandleResponse(resp) -} - -// getBackupCreateRequest creates the GetBackup request. -func (client *CassandraClustersClient) getBackupCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, backupID string, options *CassandraClustersGetBackupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups/{backupId}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if clusterName == "" { - return nil, errors.New("parameter clusterName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - if backupID == "" { - return nil, errors.New("parameter backupID cannot be empty") + result := CassandraClustersInvokeCommandPollerResponse{ + RawResponse: resp, } - urlPath = strings.ReplaceAll(urlPath, "{backupId}", url.PathEscape(backupID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + pt, err := armruntime.NewPoller("CassandraClustersClient.InvokeCommand", "", resp, client.pl, client.invokeCommandHandleError) if err != nil { - return nil, err + return CassandraClustersInvokeCommandPollerResponse{}, err } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// getBackupHandleResponse handles the GetBackup response. -func (client *CassandraClustersClient) getBackupHandleResponse(resp *http.Response) (CassandraClustersGetBackupResponse, error) { - result := CassandraClustersGetBackupResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.BackupResource); err != nil { - return CassandraClustersGetBackupResponse{}, err + result.Poller = &CassandraClustersInvokeCommandPoller{ + pt: pt, } return result, nil } -// getBackupHandleError handles the GetBackup error response. -func (client *CassandraClustersClient) getBackupHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - errType := CloudError{raw: string(body)} - if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { - return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) - } - return runtime.NewResponseError(&errType, resp) -} - -// ListBackups - List the backups of this cluster that are available to restore. +// InvokeCommand - Invoke a command like nodetool for cassandra maintenance // If the operation fails it returns the *CloudError error type. -func (client *CassandraClustersClient) ListBackups(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersListBackupsOptions) (CassandraClustersListBackupsResponse, error) { - req, err := client.listBackupsCreateRequest(ctx, resourceGroupName, clusterName, options) +func (client *CassandraClustersClient) invokeCommand(ctx context.Context, resourceGroupName string, clusterName string, body CommandPostBody, options *CassandraClustersBeginInvokeCommandOptions) (*http.Response, error) { + req, err := client.invokeCommandCreateRequest(ctx, resourceGroupName, clusterName, body, options) if err != nil { - return CassandraClustersListBackupsResponse{}, err + return nil, err } resp, err := client.pl.Do(req) if err != nil { - return CassandraClustersListBackupsResponse{}, err + return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CassandraClustersListBackupsResponse{}, client.listBackupsHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, client.invokeCommandHandleError(resp) } - return client.listBackupsHandleResponse(resp) + return resp, nil } -// listBackupsCreateRequest creates the ListBackups request. -func (client *CassandraClustersClient) listBackupsCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersListBackupsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/backups" +// invokeCommandCreateRequest creates the InvokeCommand request. +func (client *CassandraClustersClient) invokeCommandCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, body CommandPostBody, options *CassandraClustersBeginInvokeCommandOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/invokeCommand" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -431,28 +393,19 @@ func (client *CassandraClustersClient) listBackupsCreateRequest(ctx context.Cont return nil, errors.New("parameter clusterName cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// listBackupsHandleResponse handles the ListBackups response. -func (client *CassandraClustersClient) listBackupsHandleResponse(resp *http.Response) (CassandraClustersListBackupsResponse, error) { - result := CassandraClustersListBackupsResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.ListBackups); err != nil { - return CassandraClustersListBackupsResponse{}, err - } - return result, nil + return req, runtime.MarshalAsJSON(req, body) } -// listBackupsHandleError handles the ListBackups error response. -func (client *CassandraClustersClient) listBackupsHandleError(resp *http.Response) error { +// invokeCommandHandleError handles the InvokeCommand error response. +func (client *CassandraClustersClient) invokeCommandHandleError(resp *http.Response) error { body, err := runtime.Payload(resp) if err != nil { return runtime.NewResponseError(err, resp) @@ -497,7 +450,7 @@ func (client *CassandraClustersClient) listByResourceGroupCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -507,7 +460,7 @@ func (client *CassandraClustersClient) listByResourceGroupCreateRequest(ctx cont func (client *CassandraClustersClient) listByResourceGroupHandleResponse(resp *http.Response) (CassandraClustersListByResourceGroupResponse, error) { result := CassandraClustersListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListClusters); err != nil { - return CassandraClustersListByResourceGroupResponse{}, err + return CassandraClustersListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -554,7 +507,7 @@ func (client *CassandraClustersClient) listBySubscriptionCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -564,7 +517,7 @@ func (client *CassandraClustersClient) listBySubscriptionCreateRequest(ctx conte func (client *CassandraClustersClient) listBySubscriptionHandleResponse(resp *http.Response) (CassandraClustersListBySubscriptionResponse, error) { result := CassandraClustersListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListClusters); err != nil { - return CassandraClustersListBySubscriptionResponse{}, err + return CassandraClustersListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -582,30 +535,34 @@ func (client *CassandraClustersClient) listBySubscriptionHandleError(resp *http. return runtime.NewResponseError(&errType, resp) } -// BeginRequestRepair - Request that repair begin on this cluster as soon as possible. +// BeginStart - Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of this cluster with reserved +// data disk. This won't do anything on an already running +// cluster. Use Deallocate to deallocate the cluster. // If the operation fails it returns the *CloudError error type. -func (client *CassandraClustersClient) BeginRequestRepair(ctx context.Context, resourceGroupName string, clusterName string, body RepairPostBody, options *CassandraClustersBeginRequestRepairOptions) (CassandraClustersRequestRepairPollerResponse, error) { - resp, err := client.requestRepair(ctx, resourceGroupName, clusterName, body, options) +func (client *CassandraClustersClient) BeginStart(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersBeginStartOptions) (CassandraClustersStartPollerResponse, error) { + resp, err := client.start(ctx, resourceGroupName, clusterName, options) if err != nil { - return CassandraClustersRequestRepairPollerResponse{}, err + return CassandraClustersStartPollerResponse{}, err } - result := CassandraClustersRequestRepairPollerResponse{ + result := CassandraClustersStartPollerResponse{ RawResponse: resp, } - pt, err := armruntime.NewPoller("CassandraClustersClient.RequestRepair", "", resp, client.pl, client.requestRepairHandleError) + pt, err := armruntime.NewPoller("CassandraClustersClient.Start", "", resp, client.pl, client.startHandleError) if err != nil { - return CassandraClustersRequestRepairPollerResponse{}, err + return CassandraClustersStartPollerResponse{}, err } - result.Poller = &CassandraClustersRequestRepairPoller{ + result.Poller = &CassandraClustersStartPoller{ pt: pt, } return result, nil } -// RequestRepair - Request that repair begin on this cluster as soon as possible. +// Start - Start the Managed Cassandra Cluster and Associated Data Centers. Start will start the host virtual machine of this cluster with reserved data +// disk. This won't do anything on an already running +// cluster. Use Deallocate to deallocate the cluster. // If the operation fails it returns the *CloudError error type. -func (client *CassandraClustersClient) requestRepair(ctx context.Context, resourceGroupName string, clusterName string, body RepairPostBody, options *CassandraClustersBeginRequestRepairOptions) (*http.Response, error) { - req, err := client.requestRepairCreateRequest(ctx, resourceGroupName, clusterName, body, options) +func (client *CassandraClustersClient) start(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersBeginStartOptions) (*http.Response, error) { + req, err := client.startCreateRequest(ctx, resourceGroupName, clusterName, options) if err != nil { return nil, err } @@ -613,15 +570,15 @@ func (client *CassandraClustersClient) requestRepair(ctx context.Context, resour if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return nil, client.requestRepairHandleError(resp) + if !runtime.HasStatusCode(resp, http.StatusAccepted) { + return nil, client.startHandleError(resp) } return resp, nil } -// requestRepairCreateRequest creates the RequestRepair request. -func (client *CassandraClustersClient) requestRepairCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, body RepairPostBody, options *CassandraClustersBeginRequestRepairOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/repair" +// startCreateRequest creates the Start request. +func (client *CassandraClustersClient) startCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersBeginStartOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/start" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") } @@ -639,14 +596,79 @@ func (client *CassandraClustersClient) requestRepairCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") - return req, runtime.MarshalAsJSON(req, body) + return req, nil +} + +// startHandleError handles the Start error response. +func (client *CassandraClustersClient) startHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Status - Gets the CPU, memory, and disk usage statistics for each Cassandra node in a cluster. +// If the operation fails it returns the *CloudError error type. +func (client *CassandraClustersClient) Status(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersStatusOptions) (CassandraClustersStatusResponse, error) { + req, err := client.statusCreateRequest(ctx, resourceGroupName, clusterName, options) + if err != nil { + return CassandraClustersStatusResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return CassandraClustersStatusResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return CassandraClustersStatusResponse{}, client.statusHandleError(resp) + } + return client.statusHandleResponse(resp) +} + +// statusCreateRequest creates the Status request. +func (client *CassandraClustersClient) statusCreateRequest(ctx context.Context, resourceGroupName string, clusterName string, options *CassandraClustersStatusOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/cassandraClusters/{clusterName}/status" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if clusterName == "" { + return nil, errors.New("parameter clusterName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{clusterName}", url.PathEscape(clusterName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-15") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// statusHandleResponse handles the Status response. +func (client *CassandraClustersClient) statusHandleResponse(resp *http.Response) (CassandraClustersStatusResponse, error) { + result := CassandraClustersStatusResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.CassandraClusterPublicStatus); err != nil { + return CassandraClustersStatusResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil } -// requestRepairHandleError handles the RequestRepair error response. -func (client *CassandraClustersClient) requestRepairHandleError(resp *http.Response) error { +// statusHandleError handles the Status error response. +func (client *CassandraClustersClient) statusHandleError(resp *http.Response) error { body, err := runtime.Payload(resp) if err != nil { return runtime.NewResponseError(err, resp) @@ -715,7 +737,7 @@ func (client *CassandraClustersClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, body) diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_cassandradatacenters_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_cassandradatacenters_client.go index 3b732b28332f..7a98e5bc99fc 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_cassandradatacenters_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_cassandradatacenters_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CassandraDataCentersClient contains the methods for the CassandraDataCenters group. @@ -31,8 +31,15 @@ type CassandraDataCentersClient struct { } // NewCassandraDataCentersClient creates a new instance of CassandraDataCentersClient with the specified values. -func NewCassandraDataCentersClient(con *arm.Connection, subscriptionID string) *CassandraDataCentersClient { - return &CassandraDataCentersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCassandraDataCentersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CassandraDataCentersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CassandraDataCentersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateUpdate - Create or update a managed Cassandra data center. When updating, overwrite all properties. To update only some properties, use PATCH. @@ -96,7 +103,7 @@ func (client *CassandraDataCentersClient) createUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, body) @@ -176,7 +183,7 @@ func (client *CassandraDataCentersClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *CassandraDataCentersClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *CassandraDataCentersClient) getCreateRequest(ctx context.Context, func (client *CassandraDataCentersClient) getHandleResponse(resp *http.Response) (CassandraDataCentersGetResponse, error) { result := CassandraDataCentersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCenterResource); err != nil { - return CassandraDataCentersGetResponse{}, err + return CassandraDataCentersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -301,7 +308,7 @@ func (client *CassandraDataCentersClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -311,7 +318,7 @@ func (client *CassandraDataCentersClient) listCreateRequest(ctx context.Context, func (client *CassandraDataCentersClient) listHandleResponse(resp *http.Response) (CassandraDataCentersListResponse, error) { result := CassandraDataCentersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListDataCenters); err != nil { - return CassandraDataCentersListResponse{}, err + return CassandraDataCentersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -390,7 +397,7 @@ func (client *CassandraDataCentersClient) updateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, body) diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_cassandraresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_cassandraresources_client.go index bba2ee827ce4..dbc46d269721 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_cassandraresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_cassandraresources_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CassandraResourcesClient contains the methods for the CassandraResources group. @@ -31,8 +31,15 @@ type CassandraResourcesClient struct { } // NewCassandraResourcesClient creates a new instance of CassandraResourcesClient with the specified values. -func NewCassandraResourcesClient(con *arm.Connection, subscriptionID string) *CassandraResourcesClient { - return &CassandraResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCassandraResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CassandraResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CassandraResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateUpdateCassandraKeyspace - Create or update an Azure Cosmos DB Cassandra keyspace @@ -96,7 +103,7 @@ func (client *CassandraResourcesClient) createUpdateCassandraKeyspaceCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, createUpdateCassandraKeyspaceParameters) @@ -179,7 +186,7 @@ func (client *CassandraResourcesClient) createUpdateCassandraTableCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, createUpdateCassandraTableParameters) @@ -197,89 +204,6 @@ func (client *CassandraResourcesClient) createUpdateCassandraTableHandleError(re return runtime.NewResponseError(errors.New(string(body)), resp) } -// BeginCreateUpdateCassandraView - Create or update an Azure Cosmos DB Cassandra View -// If the operation fails it returns a generic error. -func (client *CassandraResourcesClient) BeginCreateUpdateCassandraView(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, createUpdateCassandraViewParameters CassandraViewCreateUpdateParameters, options *CassandraResourcesBeginCreateUpdateCassandraViewOptions) (CassandraResourcesCreateUpdateCassandraViewPollerResponse, error) { - resp, err := client.createUpdateCassandraView(ctx, resourceGroupName, accountName, keyspaceName, viewName, createUpdateCassandraViewParameters, options) - if err != nil { - return CassandraResourcesCreateUpdateCassandraViewPollerResponse{}, err - } - result := CassandraResourcesCreateUpdateCassandraViewPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("CassandraResourcesClient.CreateUpdateCassandraView", "", resp, client.pl, client.createUpdateCassandraViewHandleError) - if err != nil { - return CassandraResourcesCreateUpdateCassandraViewPollerResponse{}, err - } - result.Poller = &CassandraResourcesCreateUpdateCassandraViewPoller{ - pt: pt, - } - return result, nil -} - -// CreateUpdateCassandraView - Create or update an Azure Cosmos DB Cassandra View -// If the operation fails it returns a generic error. -func (client *CassandraResourcesClient) createUpdateCassandraView(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, createUpdateCassandraViewParameters CassandraViewCreateUpdateParameters, options *CassandraResourcesBeginCreateUpdateCassandraViewOptions) (*http.Response, error) { - req, err := client.createUpdateCassandraViewCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, createUpdateCassandraViewParameters, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, client.createUpdateCassandraViewHandleError(resp) - } - return resp, nil -} - -// createUpdateCassandraViewCreateRequest creates the CreateUpdateCassandraView request. -func (client *CassandraResourcesClient) createUpdateCassandraViewCreateRequest(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, createUpdateCassandraViewParameters CassandraViewCreateUpdateParameters, options *CassandraResourcesBeginCreateUpdateCassandraViewOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if accountName == "" { - return nil, errors.New("parameter accountName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) - if keyspaceName == "" { - return nil, errors.New("parameter keyspaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{keyspaceName}", url.PathEscape(keyspaceName)) - if viewName == "" { - return nil, errors.New("parameter viewName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, runtime.MarshalAsJSON(req, createUpdateCassandraViewParameters) -} - -// createUpdateCassandraViewHandleError handles the CreateUpdateCassandraView error response. -func (client *CassandraResourcesClient) createUpdateCassandraViewHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - // BeginDeleteCassandraKeyspace - Deletes an existing Azure Cosmos DB Cassandra keyspace. // If the operation fails it returns a generic error. func (client *CassandraResourcesClient) BeginDeleteCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, options *CassandraResourcesBeginDeleteCassandraKeyspaceOptions) (CassandraResourcesDeleteCassandraKeyspacePollerResponse, error) { @@ -341,7 +265,7 @@ func (client *CassandraResourcesClient) deleteCassandraKeyspaceCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -423,7 +347,7 @@ func (client *CassandraResourcesClient) deleteCassandraTableCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -440,88 +364,6 @@ func (client *CassandraResourcesClient) deleteCassandraTableHandleError(resp *ht return runtime.NewResponseError(errors.New(string(body)), resp) } -// BeginDeleteCassandraView - Deletes an existing Azure Cosmos DB Cassandra view. -// If the operation fails it returns a generic error. -func (client *CassandraResourcesClient) BeginDeleteCassandraView(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesBeginDeleteCassandraViewOptions) (CassandraResourcesDeleteCassandraViewPollerResponse, error) { - resp, err := client.deleteCassandraView(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) - if err != nil { - return CassandraResourcesDeleteCassandraViewPollerResponse{}, err - } - result := CassandraResourcesDeleteCassandraViewPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("CassandraResourcesClient.DeleteCassandraView", "", resp, client.pl, client.deleteCassandraViewHandleError) - if err != nil { - return CassandraResourcesDeleteCassandraViewPollerResponse{}, err - } - result.Poller = &CassandraResourcesDeleteCassandraViewPoller{ - pt: pt, - } - return result, nil -} - -// DeleteCassandraView - Deletes an existing Azure Cosmos DB Cassandra view. -// If the operation fails it returns a generic error. -func (client *CassandraResourcesClient) deleteCassandraView(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesBeginDeleteCassandraViewOptions) (*http.Response, error) { - req, err := client.deleteCassandraViewCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, client.deleteCassandraViewHandleError(resp) - } - return resp, nil -} - -// deleteCassandraViewCreateRequest creates the DeleteCassandraView request. -func (client *CassandraResourcesClient) deleteCassandraViewCreateRequest(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesBeginDeleteCassandraViewOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if accountName == "" { - return nil, errors.New("parameter accountName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) - if keyspaceName == "" { - return nil, errors.New("parameter keyspaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{keyspaceName}", url.PathEscape(keyspaceName)) - if viewName == "" { - return nil, errors.New("parameter viewName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - return req, nil -} - -// deleteCassandraViewHandleError handles the DeleteCassandraView error response. -func (client *CassandraResourcesClient) deleteCassandraViewHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - // GetCassandraKeyspace - Gets the Cassandra keyspaces under an existing Azure Cosmos DB database account with the provided name. // If the operation fails it returns a generic error. func (client *CassandraResourcesClient) GetCassandraKeyspace(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, options *CassandraResourcesGetCassandraKeyspaceOptions) (CassandraResourcesGetCassandraKeyspaceResponse, error) { @@ -563,7 +405,7 @@ func (client *CassandraResourcesClient) getCassandraKeyspaceCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -573,7 +415,7 @@ func (client *CassandraResourcesClient) getCassandraKeyspaceCreateRequest(ctx co func (client *CassandraResourcesClient) getCassandraKeyspaceHandleResponse(resp *http.Response) (CassandraResourcesGetCassandraKeyspaceResponse, error) { result := CassandraResourcesGetCassandraKeyspaceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CassandraKeyspaceGetResults); err != nil { - return CassandraResourcesGetCassandraKeyspaceResponse{}, err + return CassandraResourcesGetCassandraKeyspaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -632,7 +474,7 @@ func (client *CassandraResourcesClient) getCassandraKeyspaceThroughputCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -642,7 +484,7 @@ func (client *CassandraResourcesClient) getCassandraKeyspaceThroughputCreateRequ func (client *CassandraResourcesClient) getCassandraKeyspaceThroughputHandleResponse(resp *http.Response) (CassandraResourcesGetCassandraKeyspaceThroughputResponse, error) { result := CassandraResourcesGetCassandraKeyspaceThroughputResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ThroughputSettingsGetResults); err != nil { - return CassandraResourcesGetCassandraKeyspaceThroughputResponse{}, err + return CassandraResourcesGetCassandraKeyspaceThroughputResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -704,7 +546,7 @@ func (client *CassandraResourcesClient) getCassandraTableCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -714,7 +556,7 @@ func (client *CassandraResourcesClient) getCassandraTableCreateRequest(ctx conte func (client *CassandraResourcesClient) getCassandraTableHandleResponse(resp *http.Response) (CassandraResourcesGetCassandraTableResponse, error) { result := CassandraResourcesGetCassandraTableResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CassandraTableGetResults); err != nil { - return CassandraResourcesGetCassandraTableResponse{}, err + return CassandraResourcesGetCassandraTableResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -776,7 +618,7 @@ func (client *CassandraResourcesClient) getCassandraTableThroughputCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -786,7 +628,7 @@ func (client *CassandraResourcesClient) getCassandraTableThroughputCreateRequest func (client *CassandraResourcesClient) getCassandraTableThroughputHandleResponse(resp *http.Response) (CassandraResourcesGetCassandraTableThroughputResponse, error) { result := CassandraResourcesGetCassandraTableThroughputResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ThroughputSettingsGetResults); err != nil { - return CassandraResourcesGetCassandraTableThroughputResponse{}, err + return CassandraResourcesGetCassandraTableThroughputResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -803,150 +645,6 @@ func (client *CassandraResourcesClient) getCassandraTableThroughputHandleError(r return runtime.NewResponseError(errors.New(string(body)), resp) } -// GetCassandraView - Gets the Cassandra view under an existing Azure Cosmos DB database account. -// If the operation fails it returns a generic error. -func (client *CassandraResourcesClient) GetCassandraView(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesGetCassandraViewOptions) (CassandraResourcesGetCassandraViewResponse, error) { - req, err := client.getCassandraViewCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) - if err != nil { - return CassandraResourcesGetCassandraViewResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return CassandraResourcesGetCassandraViewResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CassandraResourcesGetCassandraViewResponse{}, client.getCassandraViewHandleError(resp) - } - return client.getCassandraViewHandleResponse(resp) -} - -// getCassandraViewCreateRequest creates the GetCassandraView request. -func (client *CassandraResourcesClient) getCassandraViewCreateRequest(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesGetCassandraViewOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if accountName == "" { - return nil, errors.New("parameter accountName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) - if keyspaceName == "" { - return nil, errors.New("parameter keyspaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{keyspaceName}", url.PathEscape(keyspaceName)) - if viewName == "" { - return nil, errors.New("parameter viewName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// getCassandraViewHandleResponse handles the GetCassandraView response. -func (client *CassandraResourcesClient) getCassandraViewHandleResponse(resp *http.Response) (CassandraResourcesGetCassandraViewResponse, error) { - result := CassandraResourcesGetCassandraViewResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.CassandraViewGetResults); err != nil { - return CassandraResourcesGetCassandraViewResponse{}, err - } - return result, nil -} - -// getCassandraViewHandleError handles the GetCassandraView error response. -func (client *CassandraResourcesClient) getCassandraViewHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// GetCassandraViewThroughput - Gets the RUs per second of the Cassandra view under an existing Azure Cosmos DB database account with the provided name. -// If the operation fails it returns a generic error. -func (client *CassandraResourcesClient) GetCassandraViewThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesGetCassandraViewThroughputOptions) (CassandraResourcesGetCassandraViewThroughputResponse, error) { - req, err := client.getCassandraViewThroughputCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) - if err != nil { - return CassandraResourcesGetCassandraViewThroughputResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return CassandraResourcesGetCassandraViewThroughputResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CassandraResourcesGetCassandraViewThroughputResponse{}, client.getCassandraViewThroughputHandleError(resp) - } - return client.getCassandraViewThroughputHandleResponse(resp) -} - -// getCassandraViewThroughputCreateRequest creates the GetCassandraViewThroughput request. -func (client *CassandraResourcesClient) getCassandraViewThroughputCreateRequest(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesGetCassandraViewThroughputOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if accountName == "" { - return nil, errors.New("parameter accountName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) - if keyspaceName == "" { - return nil, errors.New("parameter keyspaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{keyspaceName}", url.PathEscape(keyspaceName)) - if viewName == "" { - return nil, errors.New("parameter viewName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// getCassandraViewThroughputHandleResponse handles the GetCassandraViewThroughput response. -func (client *CassandraResourcesClient) getCassandraViewThroughputHandleResponse(resp *http.Response) (CassandraResourcesGetCassandraViewThroughputResponse, error) { - result := CassandraResourcesGetCassandraViewThroughputResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.ThroughputSettingsGetResults); err != nil { - return CassandraResourcesGetCassandraViewThroughputResponse{}, err - } - return result, nil -} - -// getCassandraViewThroughputHandleError handles the GetCassandraViewThroughput error response. -func (client *CassandraResourcesClient) getCassandraViewThroughputHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - // ListCassandraKeyspaces - Lists the Cassandra keyspaces under an existing Azure Cosmos DB database account. // If the operation fails it returns a generic error. func (client *CassandraResourcesClient) ListCassandraKeyspaces(ctx context.Context, resourceGroupName string, accountName string, options *CassandraResourcesListCassandraKeyspacesOptions) (CassandraResourcesListCassandraKeyspacesResponse, error) { @@ -984,7 +682,7 @@ func (client *CassandraResourcesClient) listCassandraKeyspacesCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -994,7 +692,7 @@ func (client *CassandraResourcesClient) listCassandraKeyspacesCreateRequest(ctx func (client *CassandraResourcesClient) listCassandraKeyspacesHandleResponse(resp *http.Response) (CassandraResourcesListCassandraKeyspacesResponse, error) { result := CassandraResourcesListCassandraKeyspacesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CassandraKeyspaceListResult); err != nil { - return CassandraResourcesListCassandraKeyspacesResponse{}, err + return CassandraResourcesListCassandraKeyspacesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1052,7 +750,7 @@ func (client *CassandraResourcesClient) listCassandraTablesCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1062,7 +760,7 @@ func (client *CassandraResourcesClient) listCassandraTablesCreateRequest(ctx con func (client *CassandraResourcesClient) listCassandraTablesHandleResponse(resp *http.Response) (CassandraResourcesListCassandraTablesResponse, error) { result := CassandraResourcesListCassandraTablesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CassandraTableListResult); err != nil { - return CassandraResourcesListCassandraTablesResponse{}, err + return CassandraResourcesListCassandraTablesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1079,74 +777,6 @@ func (client *CassandraResourcesClient) listCassandraTablesHandleError(resp *htt return runtime.NewResponseError(errors.New(string(body)), resp) } -// ListCassandraViews - Lists the Cassandra materialized views under an existing Azure Cosmos DB database account. -// If the operation fails it returns a generic error. -func (client *CassandraResourcesClient) ListCassandraViews(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, options *CassandraResourcesListCassandraViewsOptions) (CassandraResourcesListCassandraViewsResponse, error) { - req, err := client.listCassandraViewsCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, options) - if err != nil { - return CassandraResourcesListCassandraViewsResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return CassandraResourcesListCassandraViewsResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return CassandraResourcesListCassandraViewsResponse{}, client.listCassandraViewsHandleError(resp) - } - return client.listCassandraViewsHandleResponse(resp) -} - -// listCassandraViewsCreateRequest creates the ListCassandraViews request. -func (client *CassandraResourcesClient) listCassandraViewsCreateRequest(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, options *CassandraResourcesListCassandraViewsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if accountName == "" { - return nil, errors.New("parameter accountName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) - if keyspaceName == "" { - return nil, errors.New("parameter keyspaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{keyspaceName}", url.PathEscape(keyspaceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// listCassandraViewsHandleResponse handles the ListCassandraViews response. -func (client *CassandraResourcesClient) listCassandraViewsHandleResponse(resp *http.Response) (CassandraResourcesListCassandraViewsResponse, error) { - result := CassandraResourcesListCassandraViewsResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.CassandraViewListResult); err != nil { - return CassandraResourcesListCassandraViewsResponse{}, err - } - return result, nil -} - -// listCassandraViewsHandleError handles the ListCassandraViews error response. -func (client *CassandraResourcesClient) listCassandraViewsHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - // BeginMigrateCassandraKeyspaceToAutoscale - Migrate an Azure Cosmos DB Cassandra Keyspace from manual throughput to autoscale // If the operation fails it returns the *CloudError error type. func (client *CassandraResourcesClient) BeginMigrateCassandraKeyspaceToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, options *CassandraResourcesBeginMigrateCassandraKeyspaceToAutoscaleOptions) (CassandraResourcesMigrateCassandraKeyspaceToAutoscalePollerResponse, error) { @@ -1208,7 +838,7 @@ func (client *CassandraResourcesClient) migrateCassandraKeyspaceToAutoscaleCreat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1288,7 +918,7 @@ func (client *CassandraResourcesClient) migrateCassandraKeyspaceToManualThroughp return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1372,7 +1002,7 @@ func (client *CassandraResourcesClient) migrateCassandraTableToAutoscaleCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1456,7 +1086,7 @@ func (client *CassandraResourcesClient) migrateCassandraTableToManualThroughputC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1475,174 +1105,6 @@ func (client *CassandraResourcesClient) migrateCassandraTableToManualThroughputH return runtime.NewResponseError(&errType, resp) } -// BeginMigrateCassandraViewToAutoscale - Migrate an Azure Cosmos DB Cassandra view from manual throughput to autoscale -// If the operation fails it returns the *CloudError error type. -func (client *CassandraResourcesClient) BeginMigrateCassandraViewToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesBeginMigrateCassandraViewToAutoscaleOptions) (CassandraResourcesMigrateCassandraViewToAutoscalePollerResponse, error) { - resp, err := client.migrateCassandraViewToAutoscale(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) - if err != nil { - return CassandraResourcesMigrateCassandraViewToAutoscalePollerResponse{}, err - } - result := CassandraResourcesMigrateCassandraViewToAutoscalePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("CassandraResourcesClient.MigrateCassandraViewToAutoscale", "", resp, client.pl, client.migrateCassandraViewToAutoscaleHandleError) - if err != nil { - return CassandraResourcesMigrateCassandraViewToAutoscalePollerResponse{}, err - } - result.Poller = &CassandraResourcesMigrateCassandraViewToAutoscalePoller{ - pt: pt, - } - return result, nil -} - -// MigrateCassandraViewToAutoscale - Migrate an Azure Cosmos DB Cassandra view from manual throughput to autoscale -// If the operation fails it returns the *CloudError error type. -func (client *CassandraResourcesClient) migrateCassandraViewToAutoscale(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesBeginMigrateCassandraViewToAutoscaleOptions) (*http.Response, error) { - req, err := client.migrateCassandraViewToAutoscaleCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, client.migrateCassandraViewToAutoscaleHandleError(resp) - } - return resp, nil -} - -// migrateCassandraViewToAutoscaleCreateRequest creates the MigrateCassandraViewToAutoscale request. -func (client *CassandraResourcesClient) migrateCassandraViewToAutoscaleCreateRequest(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesBeginMigrateCassandraViewToAutoscaleOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToAutoscale" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if accountName == "" { - return nil, errors.New("parameter accountName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) - if keyspaceName == "" { - return nil, errors.New("parameter keyspaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{keyspaceName}", url.PathEscape(keyspaceName)) - if viewName == "" { - return nil, errors.New("parameter viewName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// migrateCassandraViewToAutoscaleHandleError handles the MigrateCassandraViewToAutoscale error response. -func (client *CassandraResourcesClient) migrateCassandraViewToAutoscaleHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - errType := CloudError{raw: string(body)} - if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { - return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) - } - return runtime.NewResponseError(&errType, resp) -} - -// BeginMigrateCassandraViewToManualThroughput - Migrate an Azure Cosmos DB Cassandra view from autoscale to manual throughput -// If the operation fails it returns the *CloudError error type. -func (client *CassandraResourcesClient) BeginMigrateCassandraViewToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesBeginMigrateCassandraViewToManualThroughputOptions) (CassandraResourcesMigrateCassandraViewToManualThroughputPollerResponse, error) { - resp, err := client.migrateCassandraViewToManualThroughput(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) - if err != nil { - return CassandraResourcesMigrateCassandraViewToManualThroughputPollerResponse{}, err - } - result := CassandraResourcesMigrateCassandraViewToManualThroughputPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("CassandraResourcesClient.MigrateCassandraViewToManualThroughput", "", resp, client.pl, client.migrateCassandraViewToManualThroughputHandleError) - if err != nil { - return CassandraResourcesMigrateCassandraViewToManualThroughputPollerResponse{}, err - } - result.Poller = &CassandraResourcesMigrateCassandraViewToManualThroughputPoller{ - pt: pt, - } - return result, nil -} - -// MigrateCassandraViewToManualThroughput - Migrate an Azure Cosmos DB Cassandra view from autoscale to manual throughput -// If the operation fails it returns the *CloudError error type. -func (client *CassandraResourcesClient) migrateCassandraViewToManualThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesBeginMigrateCassandraViewToManualThroughputOptions) (*http.Response, error) { - req, err := client.migrateCassandraViewToManualThroughputCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, client.migrateCassandraViewToManualThroughputHandleError(resp) - } - return resp, nil -} - -// migrateCassandraViewToManualThroughputCreateRequest creates the MigrateCassandraViewToManualThroughput request. -func (client *CassandraResourcesClient) migrateCassandraViewToManualThroughputCreateRequest(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, options *CassandraResourcesBeginMigrateCassandraViewToManualThroughputOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default/migrateToManualThroughput" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if accountName == "" { - return nil, errors.New("parameter accountName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) - if keyspaceName == "" { - return nil, errors.New("parameter keyspaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{keyspaceName}", url.PathEscape(keyspaceName)) - if viewName == "" { - return nil, errors.New("parameter viewName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// migrateCassandraViewToManualThroughputHandleError handles the MigrateCassandraViewToManualThroughput error response. -func (client *CassandraResourcesClient) migrateCassandraViewToManualThroughputHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - errType := CloudError{raw: string(body)} - if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { - return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) - } - return runtime.NewResponseError(&errType, resp) -} - // BeginUpdateCassandraKeyspaceThroughput - Update RUs per second of an Azure Cosmos DB Cassandra Keyspace // If the operation fails it returns a generic error. func (client *CassandraResourcesClient) BeginUpdateCassandraKeyspaceThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *CassandraResourcesBeginUpdateCassandraKeyspaceThroughputOptions) (CassandraResourcesUpdateCassandraKeyspaceThroughputPollerResponse, error) { @@ -1704,7 +1166,7 @@ func (client *CassandraResourcesClient) updateCassandraKeyspaceThroughputCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, updateThroughputParameters) @@ -1787,7 +1249,7 @@ func (client *CassandraResourcesClient) updateCassandraTableThroughputCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, updateThroughputParameters) @@ -1804,86 +1266,3 @@ func (client *CassandraResourcesClient) updateCassandraTableThroughputHandleErro } return runtime.NewResponseError(errors.New(string(body)), resp) } - -// BeginUpdateCassandraViewThroughput - Update RUs per second of an Azure Cosmos DB Cassandra view -// If the operation fails it returns a generic error. -func (client *CassandraResourcesClient) BeginUpdateCassandraViewThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *CassandraResourcesBeginUpdateCassandraViewThroughputOptions) (CassandraResourcesUpdateCassandraViewThroughputPollerResponse, error) { - resp, err := client.updateCassandraViewThroughput(ctx, resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters, options) - if err != nil { - return CassandraResourcesUpdateCassandraViewThroughputPollerResponse{}, err - } - result := CassandraResourcesUpdateCassandraViewThroughputPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("CassandraResourcesClient.UpdateCassandraViewThroughput", "", resp, client.pl, client.updateCassandraViewThroughputHandleError) - if err != nil { - return CassandraResourcesUpdateCassandraViewThroughputPollerResponse{}, err - } - result.Poller = &CassandraResourcesUpdateCassandraViewThroughputPoller{ - pt: pt, - } - return result, nil -} - -// UpdateCassandraViewThroughput - Update RUs per second of an Azure Cosmos DB Cassandra view -// If the operation fails it returns a generic error. -func (client *CassandraResourcesClient) updateCassandraViewThroughput(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *CassandraResourcesBeginUpdateCassandraViewThroughputOptions) (*http.Response, error) { - req, err := client.updateCassandraViewThroughputCreateRequest(ctx, resourceGroupName, accountName, keyspaceName, viewName, updateThroughputParameters, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, client.updateCassandraViewThroughputHandleError(resp) - } - return resp, nil -} - -// updateCassandraViewThroughputCreateRequest creates the UpdateCassandraViewThroughput request. -func (client *CassandraResourcesClient) updateCassandraViewThroughputCreateRequest(ctx context.Context, resourceGroupName string, accountName string, keyspaceName string, viewName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *CassandraResourcesBeginUpdateCassandraViewThroughputOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/cassandraKeyspaces/{keyspaceName}/views/{viewName}/throughputSettings/default" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if accountName == "" { - return nil, errors.New("parameter accountName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) - if keyspaceName == "" { - return nil, errors.New("parameter keyspaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{keyspaceName}", url.PathEscape(keyspaceName)) - if viewName == "" { - return nil, errors.New("parameter viewName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{viewName}", url.PathEscape(viewName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, runtime.MarshalAsJSON(req, updateThroughputParameters) -} - -// updateCassandraViewThroughputHandleError handles the UpdateCassandraViewThroughput error response. -func (client *CassandraResourcesClient) updateCassandraViewThroughputHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_collection_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_collection_client.go index d07a7171e3d9..01c490bf31e8 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_collection_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_collection_client.go @@ -11,13 +11,14 @@ package armcosmos import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CollectionClient contains the methods for the Collection group. @@ -29,8 +30,15 @@ type CollectionClient struct { } // NewCollectionClient creates a new instance of CollectionClient with the specified values. -func NewCollectionClient(con *arm.Connection, subscriptionID string) *CollectionClient { - return &CollectionClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCollectionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CollectionClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CollectionClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListMetricDefinitions - Retrieves metric definitions for the given collection. @@ -78,7 +86,7 @@ func (client *CollectionClient) listMetricDefinitionsCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -88,7 +96,7 @@ func (client *CollectionClient) listMetricDefinitionsCreateRequest(ctx context.C func (client *CollectionClient) listMetricDefinitionsHandleResponse(resp *http.Response) (CollectionListMetricDefinitionsResponse, error) { result := CollectionListMetricDefinitionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricDefinitionsListResult); err != nil { - return CollectionListMetricDefinitionsResponse{}, err + return CollectionListMetricDefinitionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -150,7 +158,7 @@ func (client *CollectionClient) listMetricsCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") @@ -161,7 +169,7 @@ func (client *CollectionClient) listMetricsCreateRequest(ctx context.Context, re func (client *CollectionClient) listMetricsHandleResponse(resp *http.Response) (CollectionListMetricsResponse, error) { result := CollectionListMetricsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricListResult); err != nil { - return CollectionListMetricsResponse{}, err + return CollectionListMetricsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -223,7 +231,7 @@ func (client *CollectionClient) listUsagesCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -236,7 +244,7 @@ func (client *CollectionClient) listUsagesCreateRequest(ctx context.Context, res func (client *CollectionClient) listUsagesHandleResponse(resp *http.Response) (CollectionListUsagesResponse, error) { result := CollectionListUsagesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UsagesResult); err != nil { - return CollectionListUsagesResponse{}, err + return CollectionListUsagesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_collectionpartition_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_collectionpartition_client.go index 651bea9edf60..23487fe0fa2e 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_collectionpartition_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_collectionpartition_client.go @@ -11,13 +11,14 @@ package armcosmos import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CollectionPartitionClient contains the methods for the CollectionPartition group. @@ -29,8 +30,15 @@ type CollectionPartitionClient struct { } // NewCollectionPartitionClient creates a new instance of CollectionPartitionClient with the specified values. -func NewCollectionPartitionClient(con *arm.Connection, subscriptionID string) *CollectionPartitionClient { - return &CollectionPartitionClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCollectionPartitionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CollectionPartitionClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CollectionPartitionClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListMetrics - Retrieves the metrics determined by the given filter for the given collection, split by partition. @@ -78,7 +86,7 @@ func (client *CollectionPartitionClient) listMetricsCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") @@ -89,7 +97,7 @@ func (client *CollectionPartitionClient) listMetricsCreateRequest(ctx context.Co func (client *CollectionPartitionClient) listMetricsHandleResponse(resp *http.Response) (CollectionPartitionListMetricsResponse, error) { result := CollectionPartitionListMetricsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PartitionMetricListResult); err != nil { - return CollectionPartitionListMetricsResponse{}, err + return CollectionPartitionListMetricsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -151,7 +159,7 @@ func (client *CollectionPartitionClient) listUsagesCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -164,7 +172,7 @@ func (client *CollectionPartitionClient) listUsagesCreateRequest(ctx context.Con func (client *CollectionPartitionClient) listUsagesHandleResponse(resp *http.Response) (CollectionPartitionListUsagesResponse, error) { result := CollectionPartitionListUsagesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PartitionUsagesResult); err != nil { - return CollectionPartitionListUsagesResponse{}, err + return CollectionPartitionListUsagesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_collectionpartitionregion_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_collectionpartitionregion_client.go index caab30b403af..5b5475c335fe 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_collectionpartitionregion_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_collectionpartitionregion_client.go @@ -11,13 +11,14 @@ package armcosmos import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CollectionPartitionRegionClient contains the methods for the CollectionPartitionRegion group. @@ -29,8 +30,15 @@ type CollectionPartitionRegionClient struct { } // NewCollectionPartitionRegionClient creates a new instance of CollectionPartitionRegionClient with the specified values. -func NewCollectionPartitionRegionClient(con *arm.Connection, subscriptionID string) *CollectionPartitionRegionClient { - return &CollectionPartitionRegionClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCollectionPartitionRegionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CollectionPartitionRegionClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CollectionPartitionRegionClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListMetrics - Retrieves the metrics determined by the given filter for the given collection and region, split by partition. @@ -82,7 +90,7 @@ func (client *CollectionPartitionRegionClient) listMetricsCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") @@ -93,7 +101,7 @@ func (client *CollectionPartitionRegionClient) listMetricsCreateRequest(ctx cont func (client *CollectionPartitionRegionClient) listMetricsHandleResponse(resp *http.Response) (CollectionPartitionRegionListMetricsResponse, error) { result := CollectionPartitionRegionListMetricsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PartitionMetricListResult); err != nil { - return CollectionPartitionRegionListMetricsResponse{}, err + return CollectionPartitionRegionListMetricsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_collectionregion_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_collectionregion_client.go index bdb011c79576..0cee144cb3e0 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_collectionregion_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_collectionregion_client.go @@ -11,13 +11,14 @@ package armcosmos import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CollectionRegionClient contains the methods for the CollectionRegion group. @@ -29,8 +30,15 @@ type CollectionRegionClient struct { } // NewCollectionRegionClient creates a new instance of CollectionRegionClient with the specified values. -func NewCollectionRegionClient(con *arm.Connection, subscriptionID string) *CollectionRegionClient { - return &CollectionRegionClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCollectionRegionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CollectionRegionClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CollectionRegionClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListMetrics - Retrieves the metrics determined by the given filter for the given database account, collection and region. @@ -82,7 +90,7 @@ func (client *CollectionRegionClient) listMetricsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") @@ -93,7 +101,7 @@ func (client *CollectionRegionClient) listMetricsCreateRequest(ctx context.Conte func (client *CollectionRegionClient) listMetricsHandleResponse(resp *http.Response) (CollectionRegionListMetricsResponse, error) { result := CollectionRegionListMetricsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricListResult); err != nil { - return CollectionRegionListMetricsResponse{}, err + return CollectionRegionListMetricsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_constants.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_constants.go index ba5a1092b3a9..cc87559dc8fe 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_constants.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_constants.go @@ -10,7 +10,7 @@ package armcosmos const ( module = "armcosmos" - version = "v0.1.0" + version = "v0.2.0" ) // APIType - Enum to indicate the API type of the restorable database account. @@ -197,6 +197,35 @@ func (c ConflictResolutionMode) ToPtr() *ConflictResolutionMode { return &c } +// ConnectionState - The kind of connection error that occurred. +type ConnectionState string + +const ( + ConnectionStateDatacenterToDatacenterNetworkError ConnectionState = "DatacenterToDatacenterNetworkError" + ConnectionStateInternalError ConnectionState = "InternalError" + ConnectionStateInternalOperatorToDataCenterCertificateError ConnectionState = "InternalOperatorToDataCenterCertificateError" + ConnectionStateOK ConnectionState = "OK" + ConnectionStateOperatorToDataCenterNetworkError ConnectionState = "OperatorToDataCenterNetworkError" + ConnectionStateUnknown ConnectionState = "Unknown" +) + +// PossibleConnectionStateValues returns the possible values for the ConnectionState const type. +func PossibleConnectionStateValues() []ConnectionState { + return []ConnectionState{ + ConnectionStateDatacenterToDatacenterNetworkError, + ConnectionStateInternalError, + ConnectionStateInternalOperatorToDataCenterCertificateError, + ConnectionStateOK, + ConnectionStateOperatorToDataCenterNetworkError, + ConnectionStateUnknown, + } +} + +// ToPtr returns a *ConnectionState pointing to the current value. +func (c ConnectionState) ToPtr() *ConnectionState { + return &c +} + // ConnectorOffer - The cassandra connector offer type for the Cosmos DB C* database account. type ConnectorOffer string @@ -341,29 +370,6 @@ func (c DefaultConsistencyLevel) ToPtr() *DefaultConsistencyLevel { return &c } -// EnableFullTextQuery - Describe the level of detail with which queries are to be logged. -type EnableFullTextQuery string - -const ( - EnableFullTextQueryNone EnableFullTextQuery = "None" - EnableFullTextQueryTrue EnableFullTextQuery = "True" - EnableFullTextQueryFalse EnableFullTextQuery = "False" -) - -// PossibleEnableFullTextQueryValues returns the possible values for the EnableFullTextQuery const type. -func PossibleEnableFullTextQueryValues() []EnableFullTextQuery { - return []EnableFullTextQuery{ - EnableFullTextQueryNone, - EnableFullTextQueryTrue, - EnableFullTextQueryFalse, - } -} - -// ToPtr returns a *EnableFullTextQuery pointing to the current value. -func (c EnableFullTextQuery) ToPtr() *EnableFullTextQuery { - return &c -} - // IndexKind - Indicates the type of index. type IndexKind string @@ -464,6 +470,27 @@ func (c ManagedCassandraProvisioningState) ToPtr() *ManagedCassandraProvisioning return &c } +// ManagedCassandraResourceIdentityType - The type of the resource. +type ManagedCassandraResourceIdentityType string + +const ( + ManagedCassandraResourceIdentityTypeNone ManagedCassandraResourceIdentityType = "None" + ManagedCassandraResourceIdentityTypeSystemAssigned ManagedCassandraResourceIdentityType = "SystemAssigned" +) + +// PossibleManagedCassandraResourceIdentityTypeValues returns the possible values for the ManagedCassandraResourceIdentityType const type. +func PossibleManagedCassandraResourceIdentityTypeValues() []ManagedCassandraResourceIdentityType { + return []ManagedCassandraResourceIdentityType{ + ManagedCassandraResourceIdentityTypeNone, + ManagedCassandraResourceIdentityTypeSystemAssigned, + } +} + +// ToPtr returns a *ManagedCassandraResourceIdentityType pointing to the current value. +func (c ManagedCassandraResourceIdentityType) ToPtr() *ManagedCassandraResourceIdentityType { + return &c +} + // NetworkACLBypass - Indicates what services are allowed to bypass firewall checks. type NetworkACLBypass string @@ -485,7 +512,7 @@ func (c NetworkACLBypass) ToPtr() *NetworkACLBypass { return &c } -// NodeState - The state of the node in relation to the cluster. +// NodeState - The state of the node in Cassandra ring. type NodeState string const ( @@ -740,81 +767,6 @@ func (c ServerVersion) ToPtr() *ServerVersion { return &c } -// ServiceSize - Instance type for the service. -type ServiceSize string - -const ( - ServiceSizeCosmosD16S ServiceSize = "Cosmos.D16s" - ServiceSizeCosmosD4S ServiceSize = "Cosmos.D4s" - ServiceSizeCosmosD8S ServiceSize = "Cosmos.D8s" -) - -// PossibleServiceSizeValues returns the possible values for the ServiceSize const type. -func PossibleServiceSizeValues() []ServiceSize { - return []ServiceSize{ - ServiceSizeCosmosD16S, - ServiceSizeCosmosD4S, - ServiceSizeCosmosD8S, - } -} - -// ToPtr returns a *ServiceSize pointing to the current value. -func (c ServiceSize) ToPtr() *ServiceSize { - return &c -} - -// ServiceStatus - Describes the status of a service. -type ServiceStatus string - -const ( - ServiceStatusCreating ServiceStatus = "Creating" - ServiceStatusDeleting ServiceStatus = "Deleting" - ServiceStatusError ServiceStatus = "Error" - ServiceStatusRunning ServiceStatus = "Running" - ServiceStatusStopped ServiceStatus = "Stopped" - ServiceStatusUpdating ServiceStatus = "Updating" -) - -// PossibleServiceStatusValues returns the possible values for the ServiceStatus const type. -func PossibleServiceStatusValues() []ServiceStatus { - return []ServiceStatus{ - ServiceStatusCreating, - ServiceStatusDeleting, - ServiceStatusError, - ServiceStatusRunning, - ServiceStatusStopped, - ServiceStatusUpdating, - } -} - -// ToPtr returns a *ServiceStatus pointing to the current value. -func (c ServiceStatus) ToPtr() *ServiceStatus { - return &c -} - -// ServiceType - ServiceType for the service. -type ServiceType string - -const ( - ServiceTypeDataTransfer ServiceType = "DataTransfer" - ServiceTypeGraphAPICompute ServiceType = "GraphAPICompute" - ServiceTypeSQLDedicatedGateway ServiceType = "SqlDedicatedGateway" -) - -// PossibleServiceTypeValues returns the possible values for the ServiceType const type. -func PossibleServiceTypeValues() []ServiceType { - return []ServiceType{ - ServiceTypeDataTransfer, - ServiceTypeGraphAPICompute, - ServiceTypeSQLDedicatedGateway, - } -} - -// ToPtr returns a *ServiceType pointing to the current value. -func (c ServiceType) ToPtr() *ServiceType { - return &c -} - // SpatialType - Indicates the spatial type of index. type SpatialType string diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_database_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_database_client.go index a988023cb70d..5af52b7e89c1 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_database_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_database_client.go @@ -11,13 +11,14 @@ package armcosmos import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabaseClient contains the methods for the Database group. @@ -29,8 +30,15 @@ type DatabaseClient struct { } // NewDatabaseClient creates a new instance of DatabaseClient with the specified values. -func NewDatabaseClient(con *arm.Connection, subscriptionID string) *DatabaseClient { - return &DatabaseClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabaseClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabaseClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabaseClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListMetricDefinitions - Retrieves metric definitions for the given database. @@ -74,7 +82,7 @@ func (client *DatabaseClient) listMetricDefinitionsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -84,7 +92,7 @@ func (client *DatabaseClient) listMetricDefinitionsCreateRequest(ctx context.Con func (client *DatabaseClient) listMetricDefinitionsHandleResponse(resp *http.Response) (DatabaseListMetricDefinitionsResponse, error) { result := DatabaseListMetricDefinitionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricDefinitionsListResult); err != nil { - return DatabaseListMetricDefinitionsResponse{}, err + return DatabaseListMetricDefinitionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -142,7 +150,7 @@ func (client *DatabaseClient) listMetricsCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") @@ -153,7 +161,7 @@ func (client *DatabaseClient) listMetricsCreateRequest(ctx context.Context, reso func (client *DatabaseClient) listMetricsHandleResponse(resp *http.Response) (DatabaseListMetricsResponse, error) { result := DatabaseListMetricsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricListResult); err != nil { - return DatabaseListMetricsResponse{}, err + return DatabaseListMetricsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -211,7 +219,7 @@ func (client *DatabaseClient) listUsagesCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -224,7 +232,7 @@ func (client *DatabaseClient) listUsagesCreateRequest(ctx context.Context, resou func (client *DatabaseClient) listUsagesHandleResponse(resp *http.Response) (DatabaseListUsagesResponse, error) { result := DatabaseListUsagesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UsagesResult); err != nil { - return DatabaseListUsagesResponse{}, err + return DatabaseListUsagesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_databaseaccountregion_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_databaseaccountregion_client.go index b333e28f60bb..dee53e1a8deb 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_databaseaccountregion_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_databaseaccountregion_client.go @@ -11,13 +11,14 @@ package armcosmos import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabaseAccountRegionClient contains the methods for the DatabaseAccountRegion group. @@ -29,8 +30,15 @@ type DatabaseAccountRegionClient struct { } // NewDatabaseAccountRegionClient creates a new instance of DatabaseAccountRegionClient with the specified values. -func NewDatabaseAccountRegionClient(con *arm.Connection, subscriptionID string) *DatabaseAccountRegionClient { - return &DatabaseAccountRegionClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabaseAccountRegionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabaseAccountRegionClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabaseAccountRegionClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListMetrics - Retrieves the metrics determined by the given filter for the given database account and region. @@ -74,7 +82,7 @@ func (client *DatabaseAccountRegionClient) listMetricsCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") @@ -85,7 +93,7 @@ func (client *DatabaseAccountRegionClient) listMetricsCreateRequest(ctx context. func (client *DatabaseAccountRegionClient) listMetricsHandleResponse(resp *http.Response) (DatabaseAccountRegionListMetricsResponse, error) { result := DatabaseAccountRegionListMetricsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricListResult); err != nil { - return DatabaseAccountRegionListMetricsResponse{}, err + return DatabaseAccountRegionListMetricsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_databaseaccounts_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_databaseaccounts_client.go index 0607bcbad954..a7d249b08973 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_databaseaccounts_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_databaseaccounts_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabaseAccountsClient contains the methods for the DatabaseAccounts group. @@ -31,8 +31,15 @@ type DatabaseAccountsClient struct { } // NewDatabaseAccountsClient creates a new instance of DatabaseAccountsClient with the specified values. -func NewDatabaseAccountsClient(con *arm.Connection, subscriptionID string) *DatabaseAccountsClient { - return &DatabaseAccountsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabaseAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabaseAccountsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabaseAccountsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNameExists - Checks that the Azure Cosmos DB account name already exists. A valid account name may contain only lowercase letters, numbers, and @@ -66,7 +73,7 @@ func (client *DatabaseAccountsClient) checkNameExistsCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -128,7 +135,7 @@ func (client *DatabaseAccountsClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, createUpdateParameters) @@ -203,7 +210,7 @@ func (client *DatabaseAccountsClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -281,7 +288,7 @@ func (client *DatabaseAccountsClient) failoverPriorityChangeCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, runtime.MarshalAsJSON(req, failoverParameters) } @@ -335,7 +342,7 @@ func (client *DatabaseAccountsClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -345,7 +352,7 @@ func (client *DatabaseAccountsClient) getCreateRequest(ctx context.Context, reso func (client *DatabaseAccountsClient) getHandleResponse(resp *http.Response) (DatabaseAccountsGetResponse, error) { result := DatabaseAccountsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseAccountGetResults); err != nil { - return DatabaseAccountsGetResponse{}, err + return DatabaseAccountsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -399,7 +406,7 @@ func (client *DatabaseAccountsClient) getReadOnlyKeysCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -409,7 +416,7 @@ func (client *DatabaseAccountsClient) getReadOnlyKeysCreateRequest(ctx context.C func (client *DatabaseAccountsClient) getReadOnlyKeysHandleResponse(resp *http.Response) (DatabaseAccountsGetReadOnlyKeysResponse, error) { result := DatabaseAccountsGetReadOnlyKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseAccountListReadOnlyKeysResult); err != nil { - return DatabaseAccountsGetReadOnlyKeysResponse{}, err + return DatabaseAccountsGetReadOnlyKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -455,7 +462,7 @@ func (client *DatabaseAccountsClient) listCreateRequest(ctx context.Context, opt return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -465,7 +472,7 @@ func (client *DatabaseAccountsClient) listCreateRequest(ctx context.Context, opt func (client *DatabaseAccountsClient) listHandleResponse(resp *http.Response) (DatabaseAccountsListResponse, error) { result := DatabaseAccountsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseAccountsListResult); err != nil { - return DatabaseAccountsListResponse{}, err + return DatabaseAccountsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -515,7 +522,7 @@ func (client *DatabaseAccountsClient) listByResourceGroupCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -525,7 +532,7 @@ func (client *DatabaseAccountsClient) listByResourceGroupCreateRequest(ctx conte func (client *DatabaseAccountsClient) listByResourceGroupHandleResponse(resp *http.Response) (DatabaseAccountsListByResourceGroupResponse, error) { result := DatabaseAccountsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseAccountsListResult); err != nil { - return DatabaseAccountsListByResourceGroupResponse{}, err + return DatabaseAccountsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -579,7 +586,7 @@ func (client *DatabaseAccountsClient) listConnectionStringsCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -589,7 +596,7 @@ func (client *DatabaseAccountsClient) listConnectionStringsCreateRequest(ctx con func (client *DatabaseAccountsClient) listConnectionStringsHandleResponse(resp *http.Response) (DatabaseAccountsListConnectionStringsResponse, error) { result := DatabaseAccountsListConnectionStringsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseAccountListConnectionStringsResult); err != nil { - return DatabaseAccountsListConnectionStringsResponse{}, err + return DatabaseAccountsListConnectionStringsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -643,7 +650,7 @@ func (client *DatabaseAccountsClient) listKeysCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -653,7 +660,7 @@ func (client *DatabaseAccountsClient) listKeysCreateRequest(ctx context.Context, func (client *DatabaseAccountsClient) listKeysHandleResponse(resp *http.Response) (DatabaseAccountsListKeysResponse, error) { result := DatabaseAccountsListKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseAccountListKeysResult); err != nil { - return DatabaseAccountsListKeysResponse{}, err + return DatabaseAccountsListKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -707,7 +714,7 @@ func (client *DatabaseAccountsClient) listMetricDefinitionsCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -717,7 +724,7 @@ func (client *DatabaseAccountsClient) listMetricDefinitionsCreateRequest(ctx con func (client *DatabaseAccountsClient) listMetricDefinitionsHandleResponse(resp *http.Response) (DatabaseAccountsListMetricDefinitionsResponse, error) { result := DatabaseAccountsListMetricDefinitionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricDefinitionsListResult); err != nil { - return DatabaseAccountsListMetricDefinitionsResponse{}, err + return DatabaseAccountsListMetricDefinitionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -771,7 +778,7 @@ func (client *DatabaseAccountsClient) listMetricsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") @@ -782,7 +789,7 @@ func (client *DatabaseAccountsClient) listMetricsCreateRequest(ctx context.Conte func (client *DatabaseAccountsClient) listMetricsHandleResponse(resp *http.Response) (DatabaseAccountsListMetricsResponse, error) { result := DatabaseAccountsListMetricsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricListResult); err != nil { - return DatabaseAccountsListMetricsResponse{}, err + return DatabaseAccountsListMetricsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -836,7 +843,7 @@ func (client *DatabaseAccountsClient) listReadOnlyKeysCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -846,7 +853,7 @@ func (client *DatabaseAccountsClient) listReadOnlyKeysCreateRequest(ctx context. func (client *DatabaseAccountsClient) listReadOnlyKeysHandleResponse(resp *http.Response) (DatabaseAccountsListReadOnlyKeysResponse, error) { result := DatabaseAccountsListReadOnlyKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseAccountListReadOnlyKeysResult); err != nil { - return DatabaseAccountsListReadOnlyKeysResponse{}, err + return DatabaseAccountsListReadOnlyKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -900,7 +907,7 @@ func (client *DatabaseAccountsClient) listUsagesCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -913,7 +920,7 @@ func (client *DatabaseAccountsClient) listUsagesCreateRequest(ctx context.Contex func (client *DatabaseAccountsClient) listUsagesHandleResponse(resp *http.Response) (DatabaseAccountsListUsagesResponse, error) { result := DatabaseAccountsListUsagesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UsagesResult); err != nil { - return DatabaseAccountsListUsagesResponse{}, err + return DatabaseAccountsListUsagesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -987,7 +994,7 @@ func (client *DatabaseAccountsClient) offlineRegionCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, regionParameterForOffline) @@ -1063,7 +1070,7 @@ func (client *DatabaseAccountsClient) onlineRegionCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, regionParameterForOnline) @@ -1139,7 +1146,7 @@ func (client *DatabaseAccountsClient) regenerateKeyCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, runtime.MarshalAsJSON(req, keyToRegenerate) } @@ -1213,7 +1220,7 @@ func (client *DatabaseAccountsClient) updateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, updateParameters) diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_graphresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_graphresources_client.go deleted file mode 100644 index 26656066b2e2..000000000000 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_graphresources_client.go +++ /dev/null @@ -1,324 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armcosmos - -import ( - "context" - "errors" - "net/http" - "net/url" - "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" -) - -// GraphResourcesClient contains the methods for the GraphResources group. -// Don't use this type directly, use NewGraphResourcesClient() instead. -type GraphResourcesClient struct { - ep string - pl runtime.Pipeline - subscriptionID string -} - -// NewGraphResourcesClient creates a new instance of GraphResourcesClient with the specified values. -func NewGraphResourcesClient(con *arm.Connection, subscriptionID string) *GraphResourcesClient { - return &GraphResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} -} - -// BeginCreateUpdateGraph - Create or update an Azure Cosmos DB Graph. -// If the operation fails it returns a generic error. -func (client *GraphResourcesClient) BeginCreateUpdateGraph(ctx context.Context, resourceGroupName string, accountName string, graphName string, createUpdateGraphParameters GraphResourceCreateUpdateParameters, options *GraphResourcesBeginCreateUpdateGraphOptions) (GraphResourcesCreateUpdateGraphPollerResponse, error) { - resp, err := client.createUpdateGraph(ctx, resourceGroupName, accountName, graphName, createUpdateGraphParameters, options) - if err != nil { - return GraphResourcesCreateUpdateGraphPollerResponse{}, err - } - result := GraphResourcesCreateUpdateGraphPollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("GraphResourcesClient.CreateUpdateGraph", "", resp, client.pl, client.createUpdateGraphHandleError) - if err != nil { - return GraphResourcesCreateUpdateGraphPollerResponse{}, err - } - result.Poller = &GraphResourcesCreateUpdateGraphPoller{ - pt: pt, - } - return result, nil -} - -// CreateUpdateGraph - Create or update an Azure Cosmos DB Graph. -// If the operation fails it returns a generic error. -func (client *GraphResourcesClient) createUpdateGraph(ctx context.Context, resourceGroupName string, accountName string, graphName string, createUpdateGraphParameters GraphResourceCreateUpdateParameters, options *GraphResourcesBeginCreateUpdateGraphOptions) (*http.Response, error) { - req, err := client.createUpdateGraphCreateRequest(ctx, resourceGroupName, accountName, graphName, createUpdateGraphParameters, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return nil, client.createUpdateGraphHandleError(resp) - } - return resp, nil -} - -// createUpdateGraphCreateRequest creates the CreateUpdateGraph request. -func (client *GraphResourcesClient) createUpdateGraphCreateRequest(ctx context.Context, resourceGroupName string, accountName string, graphName string, createUpdateGraphParameters GraphResourceCreateUpdateParameters, options *GraphResourcesBeginCreateUpdateGraphOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if accountName == "" { - return nil, errors.New("parameter accountName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) - if graphName == "" { - return nil, errors.New("parameter graphName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{graphName}", url.PathEscape(graphName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, runtime.MarshalAsJSON(req, createUpdateGraphParameters) -} - -// createUpdateGraphHandleError handles the CreateUpdateGraph error response. -func (client *GraphResourcesClient) createUpdateGraphHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// BeginDeleteGraphResource - Deletes an existing Azure Cosmos DB Graph Resource. -// If the operation fails it returns a generic error. -func (client *GraphResourcesClient) BeginDeleteGraphResource(ctx context.Context, resourceGroupName string, accountName string, graphName string, options *GraphResourcesBeginDeleteGraphResourceOptions) (GraphResourcesDeleteGraphResourcePollerResponse, error) { - resp, err := client.deleteGraphResource(ctx, resourceGroupName, accountName, graphName, options) - if err != nil { - return GraphResourcesDeleteGraphResourcePollerResponse{}, err - } - result := GraphResourcesDeleteGraphResourcePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("GraphResourcesClient.DeleteGraphResource", "", resp, client.pl, client.deleteGraphResourceHandleError) - if err != nil { - return GraphResourcesDeleteGraphResourcePollerResponse{}, err - } - result.Poller = &GraphResourcesDeleteGraphResourcePoller{ - pt: pt, - } - return result, nil -} - -// DeleteGraphResource - Deletes an existing Azure Cosmos DB Graph Resource. -// If the operation fails it returns a generic error. -func (client *GraphResourcesClient) deleteGraphResource(ctx context.Context, resourceGroupName string, accountName string, graphName string, options *GraphResourcesBeginDeleteGraphResourceOptions) (*http.Response, error) { - req, err := client.deleteGraphResourceCreateRequest(ctx, resourceGroupName, accountName, graphName, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, client.deleteGraphResourceHandleError(resp) - } - return resp, nil -} - -// deleteGraphResourceCreateRequest creates the DeleteGraphResource request. -func (client *GraphResourcesClient) deleteGraphResourceCreateRequest(ctx context.Context, resourceGroupName string, accountName string, graphName string, options *GraphResourcesBeginDeleteGraphResourceOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if accountName == "" { - return nil, errors.New("parameter accountName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) - if graphName == "" { - return nil, errors.New("parameter graphName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{graphName}", url.PathEscape(graphName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - return req, nil -} - -// deleteGraphResourceHandleError handles the DeleteGraphResource error response. -func (client *GraphResourcesClient) deleteGraphResourceHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// GetGraph - Gets the Graph resource under an existing Azure Cosmos DB database account with the provided name. -// If the operation fails it returns a generic error. -func (client *GraphResourcesClient) GetGraph(ctx context.Context, resourceGroupName string, accountName string, graphName string, options *GraphResourcesGetGraphOptions) (GraphResourcesGetGraphResponse, error) { - req, err := client.getGraphCreateRequest(ctx, resourceGroupName, accountName, graphName, options) - if err != nil { - return GraphResourcesGetGraphResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return GraphResourcesGetGraphResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GraphResourcesGetGraphResponse{}, client.getGraphHandleError(resp) - } - return client.getGraphHandleResponse(resp) -} - -// getGraphCreateRequest creates the GetGraph request. -func (client *GraphResourcesClient) getGraphCreateRequest(ctx context.Context, resourceGroupName string, accountName string, graphName string, options *GraphResourcesGetGraphOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs/{graphName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if accountName == "" { - return nil, errors.New("parameter accountName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) - if graphName == "" { - return nil, errors.New("parameter graphName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{graphName}", url.PathEscape(graphName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// getGraphHandleResponse handles the GetGraph response. -func (client *GraphResourcesClient) getGraphHandleResponse(resp *http.Response) (GraphResourcesGetGraphResponse, error) { - result := GraphResourcesGetGraphResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.GraphResourceGetResults); err != nil { - return GraphResourcesGetGraphResponse{}, err - } - return result, nil -} - -// getGraphHandleError handles the GetGraph error response. -func (client *GraphResourcesClient) getGraphHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// ListGraphs - Lists the graphs under an existing Azure Cosmos DB database account. -// If the operation fails it returns a generic error. -func (client *GraphResourcesClient) ListGraphs(ctx context.Context, resourceGroupName string, accountName string, options *GraphResourcesListGraphsOptions) (GraphResourcesListGraphsResponse, error) { - req, err := client.listGraphsCreateRequest(ctx, resourceGroupName, accountName, options) - if err != nil { - return GraphResourcesListGraphsResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return GraphResourcesListGraphsResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return GraphResourcesListGraphsResponse{}, client.listGraphsHandleError(resp) - } - return client.listGraphsHandleResponse(resp) -} - -// listGraphsCreateRequest creates the ListGraphs request. -func (client *GraphResourcesClient) listGraphsCreateRequest(ctx context.Context, resourceGroupName string, accountName string, options *GraphResourcesListGraphsOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/graphs" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if accountName == "" { - return nil, errors.New("parameter accountName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// listGraphsHandleResponse handles the ListGraphs response. -func (client *GraphResourcesClient) listGraphsHandleResponse(resp *http.Response) (GraphResourcesListGraphsResponse, error) { - result := GraphResourcesListGraphsResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.GraphResourcesListResult); err != nil { - return GraphResourcesListGraphsResponse{}, err - } - return result, nil -} - -// listGraphsHandleError handles the ListGraphs error response. -func (client *GraphResourcesClient) listGraphsHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_gremlinresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_gremlinresources_client.go index de64e12290d5..3330ed6302a0 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_gremlinresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_gremlinresources_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // GremlinResourcesClient contains the methods for the GremlinResources group. @@ -31,8 +31,15 @@ type GremlinResourcesClient struct { } // NewGremlinResourcesClient creates a new instance of GremlinResourcesClient with the specified values. -func NewGremlinResourcesClient(con *arm.Connection, subscriptionID string) *GremlinResourcesClient { - return &GremlinResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewGremlinResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *GremlinResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &GremlinResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateUpdateGremlinDatabase - Create or update an Azure Cosmos DB Gremlin database @@ -96,7 +103,7 @@ func (client *GremlinResourcesClient) createUpdateGremlinDatabaseCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, createUpdateGremlinDatabaseParameters) @@ -179,7 +186,7 @@ func (client *GremlinResourcesClient) createUpdateGremlinGraphCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, createUpdateGremlinGraphParameters) @@ -258,7 +265,7 @@ func (client *GremlinResourcesClient) deleteGremlinDatabaseCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -340,7 +347,7 @@ func (client *GremlinResourcesClient) deleteGremlinGraphCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -398,7 +405,7 @@ func (client *GremlinResourcesClient) getGremlinDatabaseCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -408,7 +415,7 @@ func (client *GremlinResourcesClient) getGremlinDatabaseCreateRequest(ctx contex func (client *GremlinResourcesClient) getGremlinDatabaseHandleResponse(resp *http.Response) (GremlinResourcesGetGremlinDatabaseResponse, error) { result := GremlinResourcesGetGremlinDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GremlinDatabaseGetResults); err != nil { - return GremlinResourcesGetGremlinDatabaseResponse{}, err + return GremlinResourcesGetGremlinDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -466,7 +473,7 @@ func (client *GremlinResourcesClient) getGremlinDatabaseThroughputCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -476,7 +483,7 @@ func (client *GremlinResourcesClient) getGremlinDatabaseThroughputCreateRequest( func (client *GremlinResourcesClient) getGremlinDatabaseThroughputHandleResponse(resp *http.Response) (GremlinResourcesGetGremlinDatabaseThroughputResponse, error) { result := GremlinResourcesGetGremlinDatabaseThroughputResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ThroughputSettingsGetResults); err != nil { - return GremlinResourcesGetGremlinDatabaseThroughputResponse{}, err + return GremlinResourcesGetGremlinDatabaseThroughputResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -538,7 +545,7 @@ func (client *GremlinResourcesClient) getGremlinGraphCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -548,7 +555,7 @@ func (client *GremlinResourcesClient) getGremlinGraphCreateRequest(ctx context.C func (client *GremlinResourcesClient) getGremlinGraphHandleResponse(resp *http.Response) (GremlinResourcesGetGremlinGraphResponse, error) { result := GremlinResourcesGetGremlinGraphResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GremlinGraphGetResults); err != nil { - return GremlinResourcesGetGremlinGraphResponse{}, err + return GremlinResourcesGetGremlinGraphResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -610,7 +617,7 @@ func (client *GremlinResourcesClient) getGremlinGraphThroughputCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -620,7 +627,7 @@ func (client *GremlinResourcesClient) getGremlinGraphThroughputCreateRequest(ctx func (client *GremlinResourcesClient) getGremlinGraphThroughputHandleResponse(resp *http.Response) (GremlinResourcesGetGremlinGraphThroughputResponse, error) { result := GremlinResourcesGetGremlinGraphThroughputResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ThroughputSettingsGetResults); err != nil { - return GremlinResourcesGetGremlinGraphThroughputResponse{}, err + return GremlinResourcesGetGremlinGraphThroughputResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -674,7 +681,7 @@ func (client *GremlinResourcesClient) listGremlinDatabasesCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -684,7 +691,7 @@ func (client *GremlinResourcesClient) listGremlinDatabasesCreateRequest(ctx cont func (client *GremlinResourcesClient) listGremlinDatabasesHandleResponse(resp *http.Response) (GremlinResourcesListGremlinDatabasesResponse, error) { result := GremlinResourcesListGremlinDatabasesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GremlinDatabaseListResult); err != nil { - return GremlinResourcesListGremlinDatabasesResponse{}, err + return GremlinResourcesListGremlinDatabasesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -742,7 +749,7 @@ func (client *GremlinResourcesClient) listGremlinGraphsCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -752,7 +759,7 @@ func (client *GremlinResourcesClient) listGremlinGraphsCreateRequest(ctx context func (client *GremlinResourcesClient) listGremlinGraphsHandleResponse(resp *http.Response) (GremlinResourcesListGremlinGraphsResponse, error) { result := GremlinResourcesListGremlinGraphsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GremlinGraphListResult); err != nil { - return GremlinResourcesListGremlinGraphsResponse{}, err + return GremlinResourcesListGremlinGraphsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -830,7 +837,7 @@ func (client *GremlinResourcesClient) migrateGremlinDatabaseToAutoscaleCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -910,7 +917,7 @@ func (client *GremlinResourcesClient) migrateGremlinDatabaseToManualThroughputCr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -994,7 +1001,7 @@ func (client *GremlinResourcesClient) migrateGremlinGraphToAutoscaleCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1078,7 +1085,7 @@ func (client *GremlinResourcesClient) migrateGremlinGraphToManualThroughputCreat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1158,7 +1165,7 @@ func (client *GremlinResourcesClient) updateGremlinDatabaseThroughputCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, updateThroughputParameters) @@ -1241,7 +1248,7 @@ func (client *GremlinResourcesClient) updateGremlinGraphThroughputCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, updateThroughputParameters) diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_cosmosdbmanagementclient_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_locations_client.go similarity index 50% rename from sdk/resourcemanager/cosmos/armcosmos/zz_generated_cosmosdbmanagementclient_client.go rename to sdk/resourcemanager/cosmos/armcosmos/zz_generated_locations_client.go index ed2c96d37644..23ce910d5033 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_cosmosdbmanagementclient_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_locations_client.go @@ -12,47 +12,55 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) -// CosmosDBManagementClient contains the methods for the CosmosDBManagementClient group. -// Don't use this type directly, use NewCosmosDBManagementClient() instead. -type CosmosDBManagementClient struct { +// LocationsClient contains the methods for the Locations group. +// Don't use this type directly, use NewLocationsClient() instead. +type LocationsClient struct { ep string pl runtime.Pipeline subscriptionID string } -// NewCosmosDBManagementClient creates a new instance of CosmosDBManagementClient with the specified values. -func NewCosmosDBManagementClient(con *arm.Connection, subscriptionID string) *CosmosDBManagementClient { - return &CosmosDBManagementClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +// NewLocationsClient creates a new instance of LocationsClient with the specified values. +func NewLocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LocationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LocationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } -// LocationGet - Get the properties of an existing Cosmos DB location +// Get - Get the properties of an existing Cosmos DB location // If the operation fails it returns the *CloudError error type. -func (client *CosmosDBManagementClient) LocationGet(ctx context.Context, location string, options *CosmosDBManagementClientLocationGetOptions) (CosmosDBManagementClientLocationGetResponse, error) { - req, err := client.locationGetCreateRequest(ctx, location, options) +func (client *LocationsClient) Get(ctx context.Context, location string, options *LocationsGetOptions) (LocationsGetResponse, error) { + req, err := client.getCreateRequest(ctx, location, options) if err != nil { - return CosmosDBManagementClientLocationGetResponse{}, err + return LocationsGetResponse{}, err } resp, err := client.pl.Do(req) if err != nil { - return CosmosDBManagementClientLocationGetResponse{}, err + return LocationsGetResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { - return CosmosDBManagementClientLocationGetResponse{}, client.locationGetHandleError(resp) + return LocationsGetResponse{}, client.getHandleError(resp) } - return client.locationGetHandleResponse(resp) + return client.getHandleResponse(resp) } -// locationGetCreateRequest creates the LocationGet request. -func (client *CosmosDBManagementClient) locationGetCreateRequest(ctx context.Context, location string, options *CosmosDBManagementClientLocationGetOptions) (*policy.Request, error) { +// getCreateRequest creates the Get request. +func (client *LocationsClient) getCreateRequest(ctx context.Context, location string, options *LocationsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations/{location}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -67,23 +75,23 @@ func (client *CosmosDBManagementClient) locationGetCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil } -// locationGetHandleResponse handles the LocationGet response. -func (client *CosmosDBManagementClient) locationGetHandleResponse(resp *http.Response) (CosmosDBManagementClientLocationGetResponse, error) { - result := CosmosDBManagementClientLocationGetResponse{RawResponse: resp} +// getHandleResponse handles the Get response. +func (client *LocationsClient) getHandleResponse(resp *http.Response) (LocationsGetResponse, error) { + result := LocationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LocationGetResult); err != nil { - return CosmosDBManagementClientLocationGetResponse{}, err + return LocationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } -// locationGetHandleError handles the LocationGet error response. -func (client *CosmosDBManagementClient) locationGetHandleError(resp *http.Response) error { +// getHandleError handles the Get error response. +func (client *LocationsClient) getHandleError(resp *http.Response) error { body, err := runtime.Payload(resp) if err != nil { return runtime.NewResponseError(err, resp) @@ -95,25 +103,25 @@ func (client *CosmosDBManagementClient) locationGetHandleError(resp *http.Respon return runtime.NewResponseError(&errType, resp) } -// LocationList - List Cosmos DB locations and their properties +// List - List Cosmos DB locations and their properties // If the operation fails it returns the *CloudError error type. -func (client *CosmosDBManagementClient) LocationList(ctx context.Context, options *CosmosDBManagementClientLocationListOptions) (CosmosDBManagementClientLocationListResponse, error) { - req, err := client.locationListCreateRequest(ctx, options) +func (client *LocationsClient) List(ctx context.Context, options *LocationsListOptions) (LocationsListResponse, error) { + req, err := client.listCreateRequest(ctx, options) if err != nil { - return CosmosDBManagementClientLocationListResponse{}, err + return LocationsListResponse{}, err } resp, err := client.pl.Do(req) if err != nil { - return CosmosDBManagementClientLocationListResponse{}, err + return LocationsListResponse{}, err } if !runtime.HasStatusCode(resp, http.StatusOK) { - return CosmosDBManagementClientLocationListResponse{}, client.locationListHandleError(resp) + return LocationsListResponse{}, client.listHandleError(resp) } - return client.locationListHandleResponse(resp) + return client.listHandleResponse(resp) } -// locationListCreateRequest creates the LocationList request. -func (client *CosmosDBManagementClient) locationListCreateRequest(ctx context.Context, options *CosmosDBManagementClientLocationListOptions) (*policy.Request, error) { +// listCreateRequest creates the List request. +func (client *LocationsClient) listCreateRequest(ctx context.Context, options *LocationsListOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.DocumentDB/locations" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -124,23 +132,23 @@ func (client *CosmosDBManagementClient) locationListCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil } -// locationListHandleResponse handles the LocationList response. -func (client *CosmosDBManagementClient) locationListHandleResponse(resp *http.Response) (CosmosDBManagementClientLocationListResponse, error) { - result := CosmosDBManagementClientLocationListResponse{RawResponse: resp} +// listHandleResponse handles the List response. +func (client *LocationsClient) listHandleResponse(resp *http.Response) (LocationsListResponse, error) { + result := LocationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LocationListResult); err != nil { - return CosmosDBManagementClientLocationListResponse{}, err + return LocationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } -// locationListHandleError handles the LocationList error response. -func (client *CosmosDBManagementClient) locationListHandleError(resp *http.Response) error { +// listHandleError handles the List error response. +func (client *LocationsClient) listHandleError(resp *http.Response) error { body, err := runtime.Payload(resp) if err != nil { return runtime.NewResponseError(err, resp) diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_models.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_models.go index 8d424aa4eb8a..6c88f247097f 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_models.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_models.go @@ -10,10 +10,9 @@ package armcosmos import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) type APIProperties struct { @@ -40,47 +39,14 @@ func (a ARMProxyResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type ARMProxyResource. -func (a *ARMProxyResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - return a.unmarshalInternal(rawMsg) -} - func (a ARMProxyResource) marshalInternal(objectMap map[string]interface{}) { populate(objectMap, "id", a.ID) populate(objectMap, "name", a.Name) populate(objectMap, "type", a.Type) } -func (a *ARMProxyResource) unmarshalInternal(rawMsg map[string]json.RawMessage) error { - for key, val := range rawMsg { - var err error - switch key { - case "id": - err = unpopulate(val, &a.ID) - delete(rawMsg, key) - case "name": - err = unpopulate(val, &a.Name) - delete(rawMsg, key) - case "type": - err = unpopulate(val, &a.Type) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - // ARMResourceProperties - The core properties of ARM resources. type ARMResourceProperties struct { - // Identity for the resource. - Identity *ManagedServiceIdentity `json:"identity,omitempty"` - // The location of the resource group to which the resource belongs. Location *string `json:"location,omitempty"` @@ -110,7 +76,6 @@ func (a ARMResourceProperties) MarshalJSON() ([]byte, error) { func (a ARMResourceProperties) marshalInternal(objectMap map[string]interface{}) { populate(objectMap, "id", a.ID) - populate(objectMap, "identity", a.Identity) populate(objectMap, "location", a.Location) populate(objectMap, "name", a.Name) populate(objectMap, "tags", a.Tags) @@ -221,7 +186,7 @@ type BackupPolicyMigrationState struct { // MarshalJSON implements the json.Marshaller interface for type BackupPolicyMigrationState. func (b BackupPolicyMigrationState) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "startTime", (*timeRFC3339)(b.StartTime)) + populateTimeRFC3339(objectMap, "startTime", b.StartTime) populate(objectMap, "status", b.Status) populate(objectMap, "targetType", b.TargetType) return json.Marshal(objectMap) @@ -237,9 +202,7 @@ func (b *BackupPolicyMigrationState) UnmarshalJSON(data []byte) error { var err error switch key { case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - b.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &b.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &b.Status) @@ -255,81 +218,57 @@ func (b *BackupPolicyMigrationState) UnmarshalJSON(data []byte) error { return nil } -// BackupResource - A restorable backup of a Cassandra cluster. -type BackupResource struct { - ARMProxyResource - Properties *BackupResourceProperties `json:"properties,omitempty"` +// Capability - Cosmos DB capability object +type Capability struct { + // Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin". + Name *string `json:"name,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type BackupResource. -func (b BackupResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - b.ARMProxyResource.marshalInternal(objectMap) - populate(objectMap, "properties", b.Properties) - return json.Marshal(objectMap) +// Capacity - The object that represents all properties related to capacity enforcement on an account. +type Capacity struct { + // The total throughput limit imposed on the account. A totalThroughputLimit of 2000 imposes a strict limit of max throughput that can be provisioned on + // that account to be 2000. A totalThroughputLimit of + // -1 indicates no limits on provisioning of throughput. + TotalThroughputLimit *int32 `json:"totalThroughputLimit,omitempty"` } -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupResource. -func (b *BackupResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, &b.Properties) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - if err := b.ARMProxyResource.unmarshalInternal(rawMsg); err != nil { - return err - } - return nil -} +// CassandraClusterPublicStatus - Properties of a managed Cassandra cluster public status. +type CassandraClusterPublicStatus struct { + // List relevant information about any connection errors to the Datacenters. + ConnectionErrors []*ConnectionError `json:"connectionErrors,omitempty"` -type BackupResourceProperties struct { - // The time this backup was taken, formatted like 2021-01-21T17:35:21 - Timestamp *time.Time `json:"timestamp,omitempty"` + // List of the status of each datacenter in this cluster. + DataCenters []*CassandraClusterPublicStatusDataCentersItem `json:"dataCenters,omitempty"` + ETag *string `json:"eTag,omitempty"` + ReaperStatus *ManagedCassandraReaperStatus `json:"reaperStatus,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type BackupResourceProperties. -func (b BackupResourceProperties) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type CassandraClusterPublicStatus. +func (c CassandraClusterPublicStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "timestamp", (*timeRFC3339)(b.Timestamp)) + populate(objectMap, "connectionErrors", c.ConnectionErrors) + populate(objectMap, "dataCenters", c.DataCenters) + populate(objectMap, "eTag", c.ETag) + populate(objectMap, "reaperStatus", c.ReaperStatus) return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type BackupResourceProperties. -func (b *BackupResourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "timestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - b.Timestamp = (*time.Time)(&aux) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil +type CassandraClusterPublicStatusDataCentersItem struct { + // The name of this Datacenter. + Name *string `json:"name,omitempty"` + Nodes []*ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems `json:"nodes,omitempty"` + + // A list of all seed nodes in the cluster, managed and unmanaged. + SeedNodes []*string `json:"seedNodes,omitempty"` } -// Capability - Cosmos DB capability object -type Capability struct { - // Name of the Cosmos DB capability. For example, "name": "EnableCassandra". Current values also include "EnableTable" and "EnableGremlin". - Name *string `json:"name,omitempty"` +// MarshalJSON implements the json.Marshaller interface for type CassandraClusterPublicStatusDataCentersItem. +func (c CassandraClusterPublicStatusDataCentersItem) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "name", c.Name) + populate(objectMap, "nodes", c.Nodes) + populate(objectMap, "seedNodes", c.SeedNodes) + return json.Marshal(objectMap) } // CassandraClustersBeginCreateUpdateOptions contains the optional parameters for the CassandraClusters.BeginCreateUpdate method. @@ -337,18 +276,23 @@ type CassandraClustersBeginCreateUpdateOptions struct { // placeholder for future optional parameters } +// CassandraClustersBeginDeallocateOptions contains the optional parameters for the CassandraClusters.BeginDeallocate method. +type CassandraClustersBeginDeallocateOptions struct { + // placeholder for future optional parameters +} + // CassandraClustersBeginDeleteOptions contains the optional parameters for the CassandraClusters.BeginDelete method. type CassandraClustersBeginDeleteOptions struct { // placeholder for future optional parameters } -// CassandraClustersBeginFetchNodeStatusOptions contains the optional parameters for the CassandraClusters.BeginFetchNodeStatus method. -type CassandraClustersBeginFetchNodeStatusOptions struct { +// CassandraClustersBeginInvokeCommandOptions contains the optional parameters for the CassandraClusters.BeginInvokeCommand method. +type CassandraClustersBeginInvokeCommandOptions struct { // placeholder for future optional parameters } -// CassandraClustersBeginRequestRepairOptions contains the optional parameters for the CassandraClusters.BeginRequestRepair method. -type CassandraClustersBeginRequestRepairOptions struct { +// CassandraClustersBeginStartOptions contains the optional parameters for the CassandraClusters.BeginStart method. +type CassandraClustersBeginStartOptions struct { // placeholder for future optional parameters } @@ -357,21 +301,11 @@ type CassandraClustersBeginUpdateOptions struct { // placeholder for future optional parameters } -// CassandraClustersGetBackupOptions contains the optional parameters for the CassandraClusters.GetBackup method. -type CassandraClustersGetBackupOptions struct { - // placeholder for future optional parameters -} - // CassandraClustersGetOptions contains the optional parameters for the CassandraClusters.Get method. type CassandraClustersGetOptions struct { // placeholder for future optional parameters } -// CassandraClustersListBackupsOptions contains the optional parameters for the CassandraClusters.ListBackups method. -type CassandraClustersListBackupsOptions struct { - // placeholder for future optional parameters -} - // CassandraClustersListByResourceGroupOptions contains the optional parameters for the CassandraClusters.ListByResourceGroup method. type CassandraClustersListByResourceGroupOptions struct { // placeholder for future optional parameters @@ -382,6 +316,11 @@ type CassandraClustersListBySubscriptionOptions struct { // placeholder for future optional parameters } +// CassandraClustersStatusOptions contains the optional parameters for the CassandraClusters.Status method. +type CassandraClustersStatusOptions struct { + // placeholder for future optional parameters +} + // CassandraDataCentersBeginCreateUpdateOptions contains the optional parameters for the CassandraDataCenters.BeginCreateUpdate method. type CassandraDataCentersBeginCreateUpdateOptions struct { // placeholder for future optional parameters @@ -509,11 +448,6 @@ type CassandraResourcesBeginCreateUpdateCassandraTableOptions struct { // placeholder for future optional parameters } -// CassandraResourcesBeginCreateUpdateCassandraViewOptions contains the optional parameters for the CassandraResources.BeginCreateUpdateCassandraView method. -type CassandraResourcesBeginCreateUpdateCassandraViewOptions struct { - // placeholder for future optional parameters -} - // CassandraResourcesBeginDeleteCassandraKeyspaceOptions contains the optional parameters for the CassandraResources.BeginDeleteCassandraKeyspace method. type CassandraResourcesBeginDeleteCassandraKeyspaceOptions struct { // placeholder for future optional parameters @@ -524,11 +458,6 @@ type CassandraResourcesBeginDeleteCassandraTableOptions struct { // placeholder for future optional parameters } -// CassandraResourcesBeginDeleteCassandraViewOptions contains the optional parameters for the CassandraResources.BeginDeleteCassandraView method. -type CassandraResourcesBeginDeleteCassandraViewOptions struct { - // placeholder for future optional parameters -} - // CassandraResourcesBeginMigrateCassandraKeyspaceToAutoscaleOptions contains the optional parameters for the CassandraResources.BeginMigrateCassandraKeyspaceToAutoscale // method. type CassandraResourcesBeginMigrateCassandraKeyspaceToAutoscaleOptions struct { @@ -553,18 +482,6 @@ type CassandraResourcesBeginMigrateCassandraTableToManualThroughputOptions struc // placeholder for future optional parameters } -// CassandraResourcesBeginMigrateCassandraViewToAutoscaleOptions contains the optional parameters for the CassandraResources.BeginMigrateCassandraViewToAutoscale -// method. -type CassandraResourcesBeginMigrateCassandraViewToAutoscaleOptions struct { - // placeholder for future optional parameters -} - -// CassandraResourcesBeginMigrateCassandraViewToManualThroughputOptions contains the optional parameters for the CassandraResources.BeginMigrateCassandraViewToManualThroughput -// method. -type CassandraResourcesBeginMigrateCassandraViewToManualThroughputOptions struct { - // placeholder for future optional parameters -} - // CassandraResourcesBeginUpdateCassandraKeyspaceThroughputOptions contains the optional parameters for the CassandraResources.BeginUpdateCassandraKeyspaceThroughput // method. type CassandraResourcesBeginUpdateCassandraKeyspaceThroughputOptions struct { @@ -577,12 +494,6 @@ type CassandraResourcesBeginUpdateCassandraTableThroughputOptions struct { // placeholder for future optional parameters } -// CassandraResourcesBeginUpdateCassandraViewThroughputOptions contains the optional parameters for the CassandraResources.BeginUpdateCassandraViewThroughput -// method. -type CassandraResourcesBeginUpdateCassandraViewThroughputOptions struct { - // placeholder for future optional parameters -} - // CassandraResourcesGetCassandraKeyspaceOptions contains the optional parameters for the CassandraResources.GetCassandraKeyspace method. type CassandraResourcesGetCassandraKeyspaceOptions struct { // placeholder for future optional parameters @@ -603,16 +514,6 @@ type CassandraResourcesGetCassandraTableThroughputOptions struct { // placeholder for future optional parameters } -// CassandraResourcesGetCassandraViewOptions contains the optional parameters for the CassandraResources.GetCassandraView method. -type CassandraResourcesGetCassandraViewOptions struct { - // placeholder for future optional parameters -} - -// CassandraResourcesGetCassandraViewThroughputOptions contains the optional parameters for the CassandraResources.GetCassandraViewThroughput method. -type CassandraResourcesGetCassandraViewThroughputOptions struct { - // placeholder for future optional parameters -} - // CassandraResourcesListCassandraKeyspacesOptions contains the optional parameters for the CassandraResources.ListCassandraKeyspaces method. type CassandraResourcesListCassandraKeyspacesOptions struct { // placeholder for future optional parameters @@ -623,11 +524,6 @@ type CassandraResourcesListCassandraTablesOptions struct { // placeholder for future optional parameters } -// CassandraResourcesListCassandraViewsOptions contains the optional parameters for the CassandraResources.ListCassandraViews method. -type CassandraResourcesListCassandraViewsOptions struct { - // placeholder for future optional parameters -} - // CassandraSchema - Cosmos DB Cassandra table schema type CassandraSchema struct { // List of cluster key. @@ -745,94 +641,6 @@ func (c CassandraTableResource) marshalInternal(objectMap map[string]interface{} populate(objectMap, "schema", c.Schema) } -// CassandraViewCreateUpdateParameters - Parameters to create and update Cosmos DB Cassandra view. -type CassandraViewCreateUpdateParameters struct { - ARMResourceProperties - // REQUIRED; Properties to create and update Azure Cosmos DB Cassandra view. - Properties *CassandraViewCreateUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type CassandraViewCreateUpdateParameters. -func (c CassandraViewCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - c.ARMResourceProperties.marshalInternal(objectMap) - populate(objectMap, "properties", c.Properties) - return json.Marshal(objectMap) -} - -// CassandraViewCreateUpdateProperties - Properties to create and update Azure Cosmos DB Cassandra view. -type CassandraViewCreateUpdateProperties struct { - // REQUIRED; The standard JSON format of a Cassandra view - Resource *CassandraViewResource `json:"resource,omitempty"` - - // A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// CassandraViewGetProperties - The properties of an Azure Cosmos DB Cassandra view -type CassandraViewGetProperties struct { - Options *CassandraViewGetPropertiesOptions `json:"options,omitempty"` - Resource *CassandraViewGetPropertiesResource `json:"resource,omitempty"` -} - -type CassandraViewGetPropertiesOptions struct { - OptionsResource -} - -type CassandraViewGetPropertiesResource struct { - CassandraViewResource - ExtendedResourceProperties -} - -// CassandraViewGetResults - An Azure Cosmos DB Cassandra view. -type CassandraViewGetResults struct { - ARMResourceProperties - // The properties of an Azure Cosmos DB Cassandra view - Properties *CassandraViewGetProperties `json:"properties,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type CassandraViewGetResults. -func (c CassandraViewGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - c.ARMResourceProperties.marshalInternal(objectMap) - populate(objectMap, "properties", c.Properties) - return json.Marshal(objectMap) -} - -// CassandraViewListResult - The List operation response, that contains the Cassandra views and their properties. -type CassandraViewListResult struct { - // READ-ONLY; List of Cassandra views and their properties. - Value []*CassandraViewGetResults `json:"value,omitempty" azure:"ro"` -} - -// MarshalJSON implements the json.Marshaller interface for type CassandraViewListResult. -func (c CassandraViewListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", c.Value) - return json.Marshal(objectMap) -} - -// CassandraViewResource - Cosmos DB Cassandra view resource object -type CassandraViewResource struct { - // REQUIRED; Name of the Cosmos DB Cassandra view - ID *string `json:"id,omitempty"` - - // REQUIRED; View Definition of the Cosmos DB Cassandra view - ViewDefinition *string `json:"viewDefinition,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type CassandraViewResource. -func (c CassandraViewResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - c.marshalInternal(objectMap) - return json.Marshal(objectMap) -} - -func (c CassandraViewResource) marshalInternal(objectMap map[string]interface{}) { - populate(objectMap, "id", c.ID) - populate(objectMap, "viewDefinition", c.ViewDefinition) -} - type Certificate struct { // PEM formatted public key. Pem *string `json:"pem,omitempty"` @@ -861,70 +669,9 @@ type ClusterKey struct { OrderBy *string `json:"orderBy,omitempty"` } -// ClusterNodeStatus - The status of all nodes in the cluster (as returned by 'nodetool status'). -type ClusterNodeStatus struct { - // Information about nodes in the cluster (corresponds to what is returned from nodetool info). - Nodes []*ClusterNodeStatusNodesItem `json:"nodes,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type ClusterNodeStatus. -func (c ClusterNodeStatus) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nodes", c.Nodes) - return json.Marshal(objectMap) -} - -type ClusterNodeStatusNodesItem struct { - // The node's URL. - Address *string `json:"address,omitempty"` - - // The Cassandra data center this node resides in. - Datacenter *string `json:"datacenter,omitempty"` - - // The network ID of the node. - HostID *string `json:"hostId,omitempty"` - - // The amount of file system data in the data directory (e.g., 47.66 KB), excluding all content in the snapshots subdirectories. Because all SSTable data - // files are included, any data that is not cleaned - // up (such as TTL-expired cell or tombstoned data) is counted. - Load *string `json:"load,omitempty"` - - // The percentage of the data owned by the node per datacenter times the replication factor (e.g., 33.3, or null if the data is not available). For example, - // a node can own 33% of the ring, but shows 100% - // if the replication factor is 3. For non-system keyspaces, the endpoint percentage ownership information is shown. - Owns *float64 `json:"owns,omitempty"` - - // The rack this node is part of. - Rack *string `json:"rack,omitempty"` - - // The state of the node in relation to the cluster. - State *NodeState `json:"state,omitempty"` - - // Indicates whether the node is functioning or not. - Status *NodeStatus `json:"status,omitempty"` - - // List of tokens. - Tokens []*string `json:"tokens,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type ClusterNodeStatusNodesItem. -func (c ClusterNodeStatusNodesItem) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "address", c.Address) - populate(objectMap, "datacenter", c.Datacenter) - populate(objectMap, "hostId", c.HostID) - populate(objectMap, "load", c.Load) - populate(objectMap, "owns", c.Owns) - populate(objectMap, "rack", c.Rack) - populate(objectMap, "state", c.State) - populate(objectMap, "status", c.Status) - populate(objectMap, "tokens", c.Tokens) - return json.Marshal(objectMap) -} - // ClusterResource - Representation of a managed Cassandra cluster. type ClusterResource struct { - ARMResourceProperties + ManagedCassandraARMResourceProperties // Properties of a managed Cassandra cluster. Properties *ClusterResourceProperties `json:"properties,omitempty"` } @@ -932,7 +679,7 @@ type ClusterResource struct { // MarshalJSON implements the json.Marshaller interface for type ClusterResource. func (c ClusterResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - c.ARMResourceProperties.marshalInternal(objectMap) + c.ManagedCassandraARMResourceProperties.marshalInternal(objectMap) populate(objectMap, "properties", c.Properties) return json.Marshal(objectMap) } @@ -944,6 +691,9 @@ type ClusterResourceProperties struct { // authentication. The default is 'Cassandra'. AuthenticationMethod *AuthenticationMethod `json:"authenticationMethod,omitempty"` + // Whether Cassandra audit logging is enabled + CassandraAuditLoggingEnabled *bool `json:"cassandraAuditLoggingEnabled,omitempty"` + // Which version of Cassandra should this cluster converge to running (e.g., 3.11). When updated, the cluster may take some time to migrate to the new version. CassandraVersion *string `json:"cassandraVersion,omitempty"` @@ -956,6 +706,9 @@ type ClusterResourceProperties struct { // If you need to set the clusterName property in cassandra.yaml to something besides the resource name of the cluster, set the value to use on this property. ClusterNameOverride *string `json:"clusterNameOverride,omitempty"` + // Whether the cluster and associated data centers has been deallocated. + Deallocated *bool `json:"deallocated,omitempty"` + // Resource id of a subnet that this cluster's management service should have its network interface attached to. The subnet must be routable to all subnets // that will be delegated to data centers. The // resource id must be of the form '/subscriptions//resourceGroups//providers/Microsoft.Network/virtualNetworks//subnets/' @@ -1003,9 +756,11 @@ type ClusterResourceProperties struct { func (c ClusterResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "authenticationMethod", c.AuthenticationMethod) + populate(objectMap, "cassandraAuditLoggingEnabled", c.CassandraAuditLoggingEnabled) populate(objectMap, "cassandraVersion", c.CassandraVersion) populate(objectMap, "clientCertificates", c.ClientCertificates) populate(objectMap, "clusterNameOverride", c.ClusterNameOverride) + populate(objectMap, "deallocated", c.Deallocated) populate(objectMap, "delegatedManagementSubnetId", c.DelegatedManagementSubnetID) populate(objectMap, "externalGossipCertificates", c.ExternalGossipCertificates) populate(objectMap, "externalSeedNodes", c.ExternalSeedNodes) @@ -1068,6 +823,41 @@ type Column struct { Type *string `json:"type,omitempty"` } +// CommandOutput - Response of /command api +type CommandOutput struct { + // Output of the command. + CommandOutput *string `json:"commandOutput,omitempty"` +} + +// CommandPostBody - Specification of which command to run where +type CommandPostBody struct { + // REQUIRED; The command which should be run + Command *string `json:"command,omitempty"` + + // REQUIRED; IP address of the cassandra host to run the command on + Host *string `json:"host,omitempty"` + + // The arguments for the command to be run + Arguments map[string]*string `json:"arguments,omitempty"` + + // If true, stops cassandra before executing the command and then start it again + CassandraStopStart *bool `json:"cassandra-stop-start,omitempty"` + + // If true, allows the command to write to the cassandra directory, otherwise read-only. + Readwrite *bool `json:"readwrite,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CommandPostBody. +func (c CommandPostBody) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "arguments", c.Arguments) + populate(objectMap, "cassandra-stop-start", c.CassandraStopStart) + populate(objectMap, "command", c.Command) + populate(objectMap, "host", c.Host) + populate(objectMap, "readwrite", c.Readwrite) + return json.Marshal(objectMap) +} + type Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentitiesAdditionalproperties struct { // READ-ONLY; The client id of user assigned identity. ClientID *string `json:"clientId,omitempty" azure:"ro"` @@ -1076,6 +866,76 @@ type Components1Jq1T4ISchemasManagedserviceidentityPropertiesUserassignedidentit PrincipalID *string `json:"principalId,omitempty" azure:"ro"` } +type ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems struct { + // The node's IP address. + Address *string `json:"address,omitempty"` + + // A float representing the current system-wide CPU utilization as a percentage. + CPUUsage *float64 `json:"cpuUsage,omitempty"` + + // The amount of disk free, in kB, of the directory /var/lib/cassandra. + DiskFreeKB *int64 `json:"diskFreeKB,omitempty"` + + // The amount of disk used, in kB, of the directory /var/lib/cassandra. + DiskUsedKB *int64 `json:"diskUsedKB,omitempty"` + + // The network ID of the node. + HostID *string `json:"hostID,omitempty"` + + // The amount of file system data in the data directory (e.g., 47.66 kB), excluding all content in the snapshots subdirectories. Because all SSTable data + // files are included, any data that is not cleaned + // up (such as TTL-expired cells or tombstones) is counted. + Load *string `json:"load,omitempty"` + + // Memory used by kernel buffers (Buffers in /proc/meminfo) and page cache and slabs (Cached and SReclaimable in /proc/meminfo), in kB. + MemoryBuffersAndCachedKB *int64 `json:"memoryBuffersAndCachedKB,omitempty"` + + // Unused memory (MemFree and SwapFree in /proc/meminfo), in kB. + MemoryFreeKB *int64 `json:"memoryFreeKB,omitempty"` + + // Total installed memory (MemTotal and SwapTotal in /proc/meminfo), in kB. + MemoryTotalKB *int64 `json:"memoryTotalKB,omitempty"` + + // Used memory (calculated as total - free - buffers - cache), in kB. + MemoryUsedKB *int64 `json:"memoryUsedKB,omitempty"` + + // The rack this node is part of. + Rack *string `json:"rack,omitempty"` + Size *int32 `json:"size,omitempty"` + + // The state of the node in Cassandra ring. + State *NodeState `json:"state,omitempty"` + Status *string `json:"status,omitempty"` + + // The timestamp when these statistics were captured. + Timestamp *string `json:"timestamp,omitempty"` + + // List of tokens this node covers. + Tokens []*string `json:"tokens,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems. +func (c ComponentsM9L909SchemasCassandraclusterpublicstatusPropertiesDatacentersItemsPropertiesNodesItems) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "address", c.Address) + populate(objectMap, "cpuUsage", c.CPUUsage) + populate(objectMap, "diskFreeKB", c.DiskFreeKB) + populate(objectMap, "diskUsedKB", c.DiskUsedKB) + populate(objectMap, "hostID", c.HostID) + populate(objectMap, "load", c.Load) + populate(objectMap, "memoryBuffersAndCachedKB", c.MemoryBuffersAndCachedKB) + populate(objectMap, "memoryFreeKB", c.MemoryFreeKB) + populate(objectMap, "memoryTotalKB", c.MemoryTotalKB) + populate(objectMap, "memoryUsedKB", c.MemoryUsedKB) + populate(objectMap, "rack", c.Rack) + populate(objectMap, "size", c.Size) + populate(objectMap, "state", c.State) + populate(objectMap, "status", c.Status) + populate(objectMap, "timestamp", c.Timestamp) + populate(objectMap, "tokens", c.Tokens) + return json.Marshal(objectMap) +} + type CompositePath struct { // Sort order for composite paths. Order *CompositePathSortOrder `json:"order,omitempty"` @@ -1096,6 +956,23 @@ type ConflictResolutionPolicy struct { Mode *ConflictResolutionMode `json:"mode,omitempty"` } +type ConnectionError struct { + // The kind of connection error that occurred. + ConnectionState *ConnectionState `json:"connectionState,omitempty"` + + // Detailed error message about the failed connection. + Exception *string `json:"exception,omitempty"` + + // The IP of host that originated the failed connection. + IPFrom *string `json:"iPFrom,omitempty"` + + // The IP that the connection attempted to reach. + IPTo *string `json:"iPTo,omitempty"` + + // The TCP port the connection was attempted on. + Port *int32 `json:"port,omitempty"` +} + // ConsistencyPolicy - The consistency policy for the Cosmos DB database account. type ConsistencyPolicy struct { // REQUIRED; The default consistency level and configuration settings of the Cosmos DB account. @@ -1179,16 +1056,6 @@ type CorsPolicy struct { MaxAgeInSeconds *int64 `json:"maxAgeInSeconds,omitempty"` } -// CosmosDBManagementClientLocationGetOptions contains the optional parameters for the CosmosDBManagementClient.LocationGet method. -type CosmosDBManagementClientLocationGetOptions struct { - // placeholder for future optional parameters -} - -// CosmosDBManagementClientLocationListOptions contains the optional parameters for the CosmosDBManagementClient.LocationList method. -type CosmosDBManagementClientLocationListOptions struct { - // placeholder for future optional parameters -} - // CreateUpdateOptions are a list of key-value pairs that describe the resource. Supported keys are "If-Match", "If-None-Match", "Session-Token" and "Throughput" type CreateUpdateOptions struct { // Specifies the Autoscale settings. @@ -1213,31 +1080,14 @@ func (d DataCenterResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type DataCenterResource. -func (d *DataCenterResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, &d.Properties) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - if err := d.ARMProxyResource.unmarshalInternal(rawMsg); err != nil { - return err - } - return nil -} - // DataCenterResourceProperties - Properties of a managed Cassandra data center. type DataCenterResourceProperties struct { + // If the azure data center has Availability Zone support, apply it to the Virtual Machine ScaleSet that host the cassandra data center virtual machines. + AvailabilityZone *bool `json:"availabilityZone,omitempty"` + + // Indicates the Key Uri of the customer key to use for encryption of the backup storage account. + BackupStorageCustomerKeyURI *string `json:"backupStorageCustomerKeyUri,omitempty"` + // A fragment of a cassandra.yaml configuration file to be included in the cassandra.yaml for all nodes in this data center. The fragment should be Base64 // encoded, and only a subset of keys are allowed. Base64EncodedCassandraYamlFragment *string `json:"base64EncodedCassandraYamlFragment,omitempty"` @@ -1251,6 +1101,16 @@ type DataCenterResourceProperties struct { // /providers/Microsoft.Network/virtualNetworks//subnets/'. DelegatedSubnetID *string `json:"delegatedSubnetId,omitempty"` + // Number of disk used for data centers. Default value is 4. + DiskCapacity *int32 `json:"diskCapacity,omitempty"` + + // Disk SKU used for data centers. Default value is P30. + DiskSKU *string `json:"diskSku,omitempty"` + + // Key uri to use for encryption of managed disks. Ensure the system assigned identity of the cluster has been assigned appropriate permissions(key get/wrap/unwrap + // permissions) on the key. + ManagedDiskCustomerKeyURI *string `json:"managedDiskCustomerKeyUri,omitempty"` + // The number of nodes the data center should have. This is the desired number. After it is set, it may take some time for the data center to be scaled // to match. To monitor the number of nodes and their // status, use the fetchNodeStatus method on the cluster. @@ -1259,6 +1119,9 @@ type DataCenterResourceProperties struct { // The status of the resource at the time the operation was called. ProvisioningState *ManagedCassandraProvisioningState `json:"provisioningState,omitempty"` + // Virtual Machine SKU used for data centers. Default value is StandardDS14v2 + SKU *string `json:"sku,omitempty"` + // READ-ONLY; IP addresses for seed nodes in this data center. This is for reference. Generally you will want to use the seedNodes property on the cluster, // which aggregates the seed nodes from all data centers in // the cluster. @@ -1268,64 +1131,21 @@ type DataCenterResourceProperties struct { // MarshalJSON implements the json.Marshaller interface for type DataCenterResourceProperties. func (d DataCenterResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + populate(objectMap, "availabilityZone", d.AvailabilityZone) + populate(objectMap, "backupStorageCustomerKeyUri", d.BackupStorageCustomerKeyURI) populate(objectMap, "base64EncodedCassandraYamlFragment", d.Base64EncodedCassandraYamlFragment) populate(objectMap, "dataCenterLocation", d.DataCenterLocation) populate(objectMap, "delegatedSubnetId", d.DelegatedSubnetID) + populate(objectMap, "diskCapacity", d.DiskCapacity) + populate(objectMap, "diskSku", d.DiskSKU) + populate(objectMap, "managedDiskCustomerKeyUri", d.ManagedDiskCustomerKeyURI) populate(objectMap, "nodeCount", d.NodeCount) populate(objectMap, "provisioningState", d.ProvisioningState) + populate(objectMap, "sku", d.SKU) populate(objectMap, "seedNodes", d.SeedNodes) return json.Marshal(objectMap) } -// DataTransferRegionalServiceResource - Resource for a regional service location. -type DataTransferRegionalServiceResource struct { - RegionalServiceResource -} - -// DataTransferServiceResource - Describes the service response property. -type DataTransferServiceResource struct { - // Properties for DataTransferServiceResource. - Properties *DataTransferServiceResourceProperties `json:"properties,omitempty"` -} - -// DataTransferServiceResourceProperties - Properties for DataTransferServiceResource. -type DataTransferServiceResourceProperties struct { - ServiceResourceProperties - // READ-ONLY; An array that contains all of the locations for the service. - Locations []*DataTransferRegionalServiceResource `json:"locations,omitempty" azure:"ro"` -} - -// MarshalJSON implements the json.Marshaller interface for type DataTransferServiceResourceProperties. -func (d DataTransferServiceResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - d.ServiceResourceProperties.marshalInternal(objectMap, ServiceTypeDataTransfer) - populate(objectMap, "locations", d.Locations) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type DataTransferServiceResourceProperties. -func (d *DataTransferServiceResourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "locations": - err = unpopulate(val, &d.Locations) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - if err := d.ServiceResourceProperties.unmarshalInternal(rawMsg); err != nil { - return err - } - return nil -} - // DatabaseAccountConnectionString - Connection string for the Cosmos DB account type DatabaseAccountConnectionString struct { // READ-ONLY; Value of the connection string @@ -1341,6 +1161,9 @@ type DatabaseAccountCreateUpdateParameters struct { // REQUIRED; Properties to create and update Azure Cosmos DB database accounts. Properties *DatabaseAccountCreateUpdateProperties `json:"properties,omitempty"` + // Identity for the resource. + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // Indicates the type of database account. This can only be set at database account creation. Kind *DatabaseAccountKind `json:"kind,omitempty"` } @@ -1349,6 +1172,7 @@ type DatabaseAccountCreateUpdateParameters struct { func (d DatabaseAccountCreateUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) d.ARMResourceProperties.marshalInternal(objectMap) + populate(objectMap, "identity", d.Identity) populate(objectMap, "kind", d.Kind) populate(objectMap, "properties", d.Properties) return json.Marshal(objectMap) @@ -1356,9 +1180,6 @@ func (d DatabaseAccountCreateUpdateParameters) MarshalJSON() ([]byte, error) { // DatabaseAccountCreateUpdateProperties - Properties to create and update Azure Cosmos DB database accounts. type DatabaseAccountCreateUpdateProperties struct { - // REQUIRED; Enum to indicate the mode of account creation. - CreateMode *CreateMode `json:"createMode,omitempty"` - // REQUIRED; The offer type for the database DatabaseAccountOfferType *string `json:"databaseAccountOfferType,omitempty"` @@ -1377,6 +1198,9 @@ type DatabaseAccountCreateUpdateProperties struct { // List of Cosmos DB capabilities for the account Capabilities []*Capability `json:"capabilities,omitempty"` + // The object that represents all properties related to capacity enforcement on an account. + Capacity *Capacity `json:"capacity,omitempty"` + // The cassandra connector offer type for the Cosmos DB database C* account. ConnectorOffer *ConnectorOffer `json:"connectorOffer,omitempty"` @@ -1386,14 +1210,14 @@ type DatabaseAccountCreateUpdateProperties struct { // The CORS policy for the Cosmos DB database account. Cors []*CorsPolicy `json:"cors,omitempty"` + // Enum to indicate the mode of account creation. + CreateMode *CreateMode `json:"createMode,omitempty"` + // The default identity for accessing key vault used in features like customer managed keys. The default identity needs to be explicitly set by the users. // It can be "FirstPartyIdentity", // "SystemAssignedIdentity" and more. DefaultIdentity *string `json:"defaultIdentity,omitempty"` - // The Object representing the different Diagnostic log settings for the Cosmos DB Account. - DiagnosticLogSettings *DiagnosticLogSettings `json:"diagnosticLogSettings,omitempty"` - // Disable write operations on metadata resources (databases, containers, throughput) via account keys DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` @@ -1449,13 +1273,13 @@ func (d DatabaseAccountCreateUpdateProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "analyticalStorageConfiguration", d.AnalyticalStorageConfiguration) populate(objectMap, "backupPolicy", d.BackupPolicy) populate(objectMap, "capabilities", d.Capabilities) + populate(objectMap, "capacity", d.Capacity) populate(objectMap, "connectorOffer", d.ConnectorOffer) populate(objectMap, "consistencyPolicy", d.ConsistencyPolicy) populate(objectMap, "cors", d.Cors) populate(objectMap, "createMode", d.CreateMode) populate(objectMap, "databaseAccountOfferType", d.DatabaseAccountOfferType) populate(objectMap, "defaultIdentity", d.DefaultIdentity) - populate(objectMap, "diagnosticLogSettings", d.DiagnosticLogSettings) populate(objectMap, "disableKeyBasedMetadataWriteAccess", d.DisableKeyBasedMetadataWriteAccess) populate(objectMap, "disableLocalAuth", d.DisableLocalAuth) populate(objectMap, "enableAnalyticalStorage", d.EnableAnalyticalStorage) @@ -1496,6 +1320,9 @@ func (d *DatabaseAccountCreateUpdateProperties) UnmarshalJSON(data []byte) error case "capabilities": err = unpopulate(val, &d.Capabilities) delete(rawMsg, key) + case "capacity": + err = unpopulate(val, &d.Capacity) + delete(rawMsg, key) case "connectorOffer": err = unpopulate(val, &d.ConnectorOffer) delete(rawMsg, key) @@ -1514,9 +1341,6 @@ func (d *DatabaseAccountCreateUpdateProperties) UnmarshalJSON(data []byte) error case "defaultIdentity": err = unpopulate(val, &d.DefaultIdentity) delete(rawMsg, key) - case "diagnosticLogSettings": - err = unpopulate(val, &d.DiagnosticLogSettings) - delete(rawMsg, key) case "disableKeyBasedMetadataWriteAccess": err = unpopulate(val, &d.DisableKeyBasedMetadataWriteAccess) delete(rawMsg, key) @@ -1587,6 +1411,9 @@ type DatabaseAccountGetProperties struct { // List of Cosmos DB capabilities for the account Capabilities []*Capability `json:"capabilities,omitempty"` + // The object that represents all properties related to capacity enforcement on an account. + Capacity *Capacity `json:"capacity,omitempty"` + // The cassandra connector offer type for the Cosmos DB database C* account. ConnectorOffer *ConnectorOffer `json:"connectorOffer,omitempty"` @@ -1604,9 +1431,6 @@ type DatabaseAccountGetProperties struct { // "SystemAssignedIdentity" and more. DefaultIdentity *string `json:"defaultIdentity,omitempty"` - // The Object representing the different Diagnostic log settings for the Cosmos DB Account. - DiagnosticLogSettings *DiagnosticLogSettings `json:"diagnosticLogSettings,omitempty"` - // Disable write operations on metadata resources (databases, containers, throughput) via account keys DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` @@ -1694,13 +1518,13 @@ func (d DatabaseAccountGetProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "analyticalStorageConfiguration", d.AnalyticalStorageConfiguration) populate(objectMap, "backupPolicy", d.BackupPolicy) populate(objectMap, "capabilities", d.Capabilities) + populate(objectMap, "capacity", d.Capacity) populate(objectMap, "connectorOffer", d.ConnectorOffer) populate(objectMap, "consistencyPolicy", d.ConsistencyPolicy) populate(objectMap, "cors", d.Cors) populate(objectMap, "createMode", d.CreateMode) populate(objectMap, "databaseAccountOfferType", d.DatabaseAccountOfferType) populate(objectMap, "defaultIdentity", d.DefaultIdentity) - populate(objectMap, "diagnosticLogSettings", d.DiagnosticLogSettings) populate(objectMap, "disableKeyBasedMetadataWriteAccess", d.DisableKeyBasedMetadataWriteAccess) populate(objectMap, "disableLocalAuth", d.DisableLocalAuth) populate(objectMap, "documentEndpoint", d.DocumentEndpoint) @@ -1748,6 +1572,9 @@ func (d *DatabaseAccountGetProperties) UnmarshalJSON(data []byte) error { case "capabilities": err = unpopulate(val, &d.Capabilities) delete(rawMsg, key) + case "capacity": + err = unpopulate(val, &d.Capacity) + delete(rawMsg, key) case "connectorOffer": err = unpopulate(val, &d.ConnectorOffer) delete(rawMsg, key) @@ -1766,9 +1593,6 @@ func (d *DatabaseAccountGetProperties) UnmarshalJSON(data []byte) error { case "defaultIdentity": err = unpopulate(val, &d.DefaultIdentity) delete(rawMsg, key) - case "diagnosticLogSettings": - err = unpopulate(val, &d.DiagnosticLogSettings) - delete(rawMsg, key) case "disableKeyBasedMetadataWriteAccess": err = unpopulate(val, &d.DisableKeyBasedMetadataWriteAccess) delete(rawMsg, key) @@ -1849,6 +1673,9 @@ func (d *DatabaseAccountGetProperties) UnmarshalJSON(data []byte) error { // DatabaseAccountGetResults - An Azure Cosmos DB database account. type DatabaseAccountGetResults struct { ARMResourceProperties + // Identity for the resource. + Identity *ManagedServiceIdentity `json:"identity,omitempty"` + // Indicates the type of database account. This can only be set at database account creation. Kind *DatabaseAccountKind `json:"kind,omitempty"` @@ -1863,6 +1690,7 @@ type DatabaseAccountGetResults struct { func (d DatabaseAccountGetResults) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) d.ARMResourceProperties.marshalInternal(objectMap) + populate(objectMap, "identity", d.Identity) populate(objectMap, "kind", d.Kind) populate(objectMap, "properties", d.Properties) populate(objectMap, "systemData", d.SystemData) @@ -1955,6 +1783,9 @@ type DatabaseAccountUpdateProperties struct { // List of Cosmos DB capabilities for the account Capabilities []*Capability `json:"capabilities,omitempty"` + // The object that represents all properties related to capacity enforcement on an account. + Capacity *Capacity `json:"capacity,omitempty"` + // The cassandra connector offer type for the Cosmos DB database C* account. ConnectorOffer *ConnectorOffer `json:"connectorOffer,omitempty"` @@ -1969,9 +1800,6 @@ type DatabaseAccountUpdateProperties struct { // "SystemAssignedIdentity" and more. DefaultIdentity *string `json:"defaultIdentity,omitempty"` - // The Object representing the different Diagnostic log settings for the Cosmos DB Account. - DiagnosticLogSettings *DiagnosticLogSettings `json:"diagnosticLogSettings,omitempty"` - // Disable write operations on metadata resources (databases, containers, throughput) via account keys DisableKeyBasedMetadataWriteAccess *bool `json:"disableKeyBasedMetadataWriteAccess,omitempty"` @@ -2027,11 +1855,11 @@ func (d DatabaseAccountUpdateProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "analyticalStorageConfiguration", d.AnalyticalStorageConfiguration) populate(objectMap, "backupPolicy", d.BackupPolicy) populate(objectMap, "capabilities", d.Capabilities) + populate(objectMap, "capacity", d.Capacity) populate(objectMap, "connectorOffer", d.ConnectorOffer) populate(objectMap, "consistencyPolicy", d.ConsistencyPolicy) populate(objectMap, "cors", d.Cors) populate(objectMap, "defaultIdentity", d.DefaultIdentity) - populate(objectMap, "diagnosticLogSettings", d.DiagnosticLogSettings) populate(objectMap, "disableKeyBasedMetadataWriteAccess", d.DisableKeyBasedMetadataWriteAccess) populate(objectMap, "disableLocalAuth", d.DisableLocalAuth) populate(objectMap, "enableAnalyticalStorage", d.EnableAnalyticalStorage) @@ -2071,6 +1899,9 @@ func (d *DatabaseAccountUpdateProperties) UnmarshalJSON(data []byte) error { case "capabilities": err = unpopulate(val, &d.Capabilities) delete(rawMsg, key) + case "capacity": + err = unpopulate(val, &d.Capacity) + delete(rawMsg, key) case "connectorOffer": err = unpopulate(val, &d.ConnectorOffer) delete(rawMsg, key) @@ -2083,9 +1914,6 @@ func (d *DatabaseAccountUpdateProperties) UnmarshalJSON(data []byte) error { case "defaultIdentity": err = unpopulate(val, &d.DefaultIdentity) delete(rawMsg, key) - case "diagnosticLogSettings": - err = unpopulate(val, &d.DiagnosticLogSettings) - delete(rawMsg, key) case "disableKeyBasedMetadataWriteAccess": err = unpopulate(val, &d.DisableKeyBasedMetadataWriteAccess) delete(rawMsg, key) @@ -2278,12 +2106,6 @@ func (d DatabaseRestoreResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// DiagnosticLogSettings - Indicates what diagnostic log settings are to be enabled. -type DiagnosticLogSettings struct { - // Describe the level of detail with which queries are to be logged. - EnableFullTextQuery *EnableFullTextQuery `json:"enableFullTextQuery,omitempty"` -} - // ErrorResponse - Error Response. // Implements the error and azcore.HTTPResponse interfaces. type ErrorResponse struct { @@ -2358,168 +2180,6 @@ type FailoverPolicy struct { ID *string `json:"id,omitempty" azure:"ro"` } -// GraphAPIComputeRegionalServiceResource - Resource for a regional service location. -type GraphAPIComputeRegionalServiceResource struct { - RegionalServiceResource - // READ-ONLY; The regional endpoint for GraphAPICompute. - GraphAPIComputeEndpoint *string `json:"graphApiComputeEndpoint,omitempty" azure:"ro"` -} - -// GraphAPIComputeServiceResource - Describes the service response property for GraphAPICompute. -type GraphAPIComputeServiceResource struct { - // Properties for GraphAPIComputeServiceResource. - Properties *GraphAPIComputeServiceResourceProperties `json:"properties,omitempty"` -} - -// GraphAPIComputeServiceResourceProperties - Properties for GraphAPIComputeServiceResource. -type GraphAPIComputeServiceResourceProperties struct { - ServiceResourceProperties - // GraphAPICompute endpoint for the service. - GraphAPIComputeEndpoint *string `json:"graphApiComputeEndpoint,omitempty"` - - // READ-ONLY; An array that contains all of the locations for the service. - Locations []*GraphAPIComputeRegionalServiceResource `json:"locations,omitempty" azure:"ro"` -} - -// MarshalJSON implements the json.Marshaller interface for type GraphAPIComputeServiceResourceProperties. -func (g GraphAPIComputeServiceResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - g.ServiceResourceProperties.marshalInternal(objectMap, ServiceTypeGraphAPICompute) - populate(objectMap, "graphApiComputeEndpoint", g.GraphAPIComputeEndpoint) - populate(objectMap, "locations", g.Locations) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type GraphAPIComputeServiceResourceProperties. -func (g *GraphAPIComputeServiceResourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "graphApiComputeEndpoint": - err = unpopulate(val, &g.GraphAPIComputeEndpoint) - delete(rawMsg, key) - case "locations": - err = unpopulate(val, &g.Locations) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - if err := g.ServiceResourceProperties.unmarshalInternal(rawMsg); err != nil { - return err - } - return nil -} - -// GraphResource - Cosmos DB Graph resource object -type GraphResource struct { - // REQUIRED; Name of the Cosmos DB Graph - ID *string `json:"id,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type GraphResource. -func (g GraphResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - g.marshalInternal(objectMap) - return json.Marshal(objectMap) -} - -func (g GraphResource) marshalInternal(objectMap map[string]interface{}) { - populate(objectMap, "id", g.ID) -} - -// GraphResourceCreateUpdateParameters - Parameters to create and update Cosmos DB Graph resource. -type GraphResourceCreateUpdateParameters struct { - ARMResourceProperties - // REQUIRED; Properties to create and update Azure Cosmos DB Graph resource. - Properties *GraphResourceCreateUpdateProperties `json:"properties,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type GraphResourceCreateUpdateParameters. -func (g GraphResourceCreateUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - g.ARMResourceProperties.marshalInternal(objectMap) - populate(objectMap, "properties", g.Properties) - return json.Marshal(objectMap) -} - -// GraphResourceCreateUpdateProperties - Properties to create and update Azure Cosmos DB Graph resource. -type GraphResourceCreateUpdateProperties struct { - // REQUIRED; The standard JSON format of a Graph resource - Resource *GraphResource `json:"resource,omitempty"` - - // A key-value pair of options to be applied for the request. This corresponds to the headers sent with the request. - Options *CreateUpdateOptions `json:"options,omitempty"` -} - -// GraphResourceGetProperties - The properties of an Azure Cosmos DB SQL database -type GraphResourceGetProperties struct { - Options *GraphResourceGetPropertiesOptions `json:"options,omitempty"` - Resource *GraphResourceGetPropertiesResource `json:"resource,omitempty"` -} - -type GraphResourceGetPropertiesOptions struct { - OptionsResource -} - -type GraphResourceGetPropertiesResource struct { - ExtendedResourceProperties - GraphResource -} - -// GraphResourceGetResults - An Azure Cosmos DB Graph resource. -type GraphResourceGetResults struct { - ARMResourceProperties - // The properties of an Azure Cosmos DB Graph resource. - Properties *GraphResourceGetProperties `json:"properties,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type GraphResourceGetResults. -func (g GraphResourceGetResults) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - g.ARMResourceProperties.marshalInternal(objectMap) - populate(objectMap, "properties", g.Properties) - return json.Marshal(objectMap) -} - -// GraphResourcesBeginCreateUpdateGraphOptions contains the optional parameters for the GraphResources.BeginCreateUpdateGraph method. -type GraphResourcesBeginCreateUpdateGraphOptions struct { - // placeholder for future optional parameters -} - -// GraphResourcesBeginDeleteGraphResourceOptions contains the optional parameters for the GraphResources.BeginDeleteGraphResource method. -type GraphResourcesBeginDeleteGraphResourceOptions struct { - // placeholder for future optional parameters -} - -// GraphResourcesGetGraphOptions contains the optional parameters for the GraphResources.GetGraph method. -type GraphResourcesGetGraphOptions struct { - // placeholder for future optional parameters -} - -// GraphResourcesListGraphsOptions contains the optional parameters for the GraphResources.ListGraphs method. -type GraphResourcesListGraphsOptions struct { - // placeholder for future optional parameters -} - -// GraphResourcesListResult - The List operation response, that contains the Graph resource and their properties. -type GraphResourcesListResult struct { - // READ-ONLY; List of Graph resource and their properties. - Value []*GraphResourceGetResults `json:"value,omitempty" azure:"ro"` -} - -// MarshalJSON implements the json.Marshaller interface for type GraphResourcesListResult. -func (g GraphResourcesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", g.Value) - return json.Marshal(objectMap) -} - // GremlinDatabaseCreateUpdateParameters - Parameters to create and update Cosmos DB Gremlin database. type GremlinDatabaseCreateUpdateParameters struct { ARMResourceProperties @@ -2864,19 +2524,6 @@ func (i IndexingPolicy) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// ListBackups - List of restorable backups for a Cassandra cluster. -type ListBackups struct { - // READ-ONLY; Container for array of backups. - Value []*BackupResource `json:"value,omitempty" azure:"ro"` -} - -// MarshalJSON implements the json.Marshaller interface for type ListBackups. -func (l ListBackups) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", l.Value) - return json.Marshal(objectMap) -} - // ListClusters - List of managed Cassandra clusters. type ListClusters struct { // Container for the array of clusters. @@ -2946,64 +2593,119 @@ func (l LocationGetResult) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type LocationGetResult. -func (l *LocationGetResult) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, &l.Properties) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - if err := l.ARMProxyResource.unmarshalInternal(rawMsg); err != nil { - return err - } - return nil +// LocationListResult - The List operation response, that contains Cosmos DB locations and their properties. +type LocationListResult struct { + // READ-ONLY; List of Cosmos DB locations and their properties. + Value []*LocationGetResult `json:"value,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type LocationListResult. +func (l LocationListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + +// LocationProperties - Cosmos DB location metadata +type LocationProperties struct { + // READ-ONLY; The properties of available backup storage redundancies. + BackupStorageRedundancies []*BackupStorageRedundancy `json:"backupStorageRedundancies,omitempty" azure:"ro"` + + // READ-ONLY; Flag indicating whether the location is residency sensitive. + IsResidencyRestricted *bool `json:"isResidencyRestricted,omitempty" azure:"ro"` + + // READ-ONLY; Flag indicating whether the location supports availability zones or not. + SupportsAvailabilityZone *bool `json:"supportsAvailabilityZone,omitempty" azure:"ro"` } -// LocationListResult - The List operation response, that contains Cosmos DB locations and their properties. -type LocationListResult struct { - // READ-ONLY; List of Cosmos DB locations and their properties. - Value []*LocationGetResult `json:"value,omitempty" azure:"ro"` +// MarshalJSON implements the json.Marshaller interface for type LocationProperties. +func (l LocationProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "backupStorageRedundancies", l.BackupStorageRedundancies) + populate(objectMap, "isResidencyRestricted", l.IsResidencyRestricted) + populate(objectMap, "supportsAvailabilityZone", l.SupportsAvailabilityZone) + return json.Marshal(objectMap) +} + +// LocationsGetOptions contains the optional parameters for the Locations.Get method. +type LocationsGetOptions struct { + // placeholder for future optional parameters +} + +// LocationsListOptions contains the optional parameters for the Locations.List method. +type LocationsListOptions struct { + // placeholder for future optional parameters +} + +// ManagedCassandraARMResourceProperties - The core properties of ARM resources. +type ManagedCassandraARMResourceProperties struct { + // Identity for the resource. + Identity *ManagedCassandraManagedServiceIdentity `json:"identity,omitempty"` + + // The location of the resource group to which the resource belongs. + Location *string `json:"location,omitempty"` + + // Tags are a list of key-value pairs that describe the resource. These tags can be used in viewing and grouping this resource (across resource groups). + // A maximum of 15 tags can be provided for a + // resource. Each tag must have a key no greater than 128 characters and value no greater than 256 characters. For example, the default experience for a + // template type is set with "defaultExperience": + // "Cassandra". Current "defaultExperience" values also include "Table", "Graph", "DocumentDB", and "MongoDB". + Tags map[string]*string `json:"tags,omitempty"` + + // READ-ONLY; The unique resource identifier of the ARM resource. + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The name of the ARM resource. + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of Azure resource. + Type *string `json:"type,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type LocationListResult. -func (l LocationListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type ManagedCassandraARMResourceProperties. +func (m ManagedCassandraARMResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "value", l.Value) + m.marshalInternal(objectMap) return json.Marshal(objectMap) } -// LocationProperties - Cosmos DB location metadata -type LocationProperties struct { - // READ-ONLY; The properties of available backup storage redundancies. - BackupStorageRedundancies []*BackupStorageRedundancy `json:"backupStorageRedundancies,omitempty" azure:"ro"` +func (m ManagedCassandraARMResourceProperties) marshalInternal(objectMap map[string]interface{}) { + populate(objectMap, "id", m.ID) + populate(objectMap, "identity", m.Identity) + populate(objectMap, "location", m.Location) + populate(objectMap, "name", m.Name) + populate(objectMap, "tags", m.Tags) + populate(objectMap, "type", m.Type) +} - // READ-ONLY; Flag indicating whether the location is residency sensitive. - IsResidencyRestricted *bool `json:"isResidencyRestricted,omitempty" azure:"ro"` +// ManagedCassandraManagedServiceIdentity - Identity for the resource. +type ManagedCassandraManagedServiceIdentity struct { + // The type of the resource. + Type *ManagedCassandraResourceIdentityType `json:"type,omitempty"` - // READ-ONLY; The current status of location in Azure. - Status *string `json:"status,omitempty" azure:"ro"` + // READ-ONLY; The object id of the identity resource. + PrincipalID *string `json:"principalId,omitempty" azure:"ro"` - // READ-ONLY; Flag indicating whether the location supports availability zones or not. - SupportsAvailabilityZone *bool `json:"supportsAvailabilityZone,omitempty" azure:"ro"` + // READ-ONLY; The tenant id of the resource. + TenantID *string `json:"tenantId,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type LocationProperties. -func (l LocationProperties) MarshalJSON() ([]byte, error) { +type ManagedCassandraReaperStatus struct { + Healthy *bool `json:"healthy,omitempty"` + + // Dictionary of + RepairRunIDs map[string]*string `json:"repairRunIds,omitempty"` + + // Dictionary of + RepairSchedules map[string]*string `json:"repairSchedules,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ManagedCassandraReaperStatus. +func (m ManagedCassandraReaperStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "backupStorageRedundancies", l.BackupStorageRedundancies) - populate(objectMap, "isResidencyRestricted", l.IsResidencyRestricted) - populate(objectMap, "status", l.Status) - populate(objectMap, "supportsAvailabilityZone", l.SupportsAvailabilityZone) + populate(objectMap, "healthy", m.Healthy) + populate(objectMap, "repairRunIds", m.RepairRunIDs) + populate(objectMap, "repairSchedules", m.RepairSchedules) return json.Marshal(objectMap) } @@ -3073,10 +2775,10 @@ func (m *Metric) UnmarshalJSON(data []byte) error { } func (m Metric) marshalInternal(objectMap map[string]interface{}) { - populate(objectMap, "endTime", (*timeRFC3339)(m.EndTime)) + populateTimeRFC3339(objectMap, "endTime", m.EndTime) populate(objectMap, "metricValues", m.MetricValues) populate(objectMap, "name", m.Name) - populate(objectMap, "startTime", (*timeRFC3339)(m.StartTime)) + populateTimeRFC3339(objectMap, "startTime", m.StartTime) populate(objectMap, "timeGrain", m.TimeGrain) populate(objectMap, "unit", m.Unit) } @@ -3086,9 +2788,7 @@ func (m *Metric) unmarshalInternal(rawMsg map[string]json.RawMessage) error { var err error switch key { case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.EndTime) delete(rawMsg, key) case "metricValues": err = unpopulate(val, &m.MetricValues) @@ -3097,9 +2797,7 @@ func (m *Metric) unmarshalInternal(rawMsg map[string]json.RawMessage) error { err = unpopulate(val, &m.Name) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.StartTime) delete(rawMsg, key) case "timeGrain": err = unpopulate(val, &m.TimeGrain) @@ -3230,7 +2928,7 @@ func (m MetricValue) marshalInternal(objectMap map[string]interface{}) { populate(objectMap, "_count", m.Count) populate(objectMap, "maximum", m.Maximum) populate(objectMap, "minimum", m.Minimum) - populate(objectMap, "timestamp", (*timeRFC3339)(m.Timestamp)) + populateTimeRFC3339(objectMap, "timestamp", m.Timestamp) populate(objectMap, "total", m.Total) } @@ -3251,9 +2949,7 @@ func (m *MetricValue) unmarshalInternal(rawMsg map[string]json.RawMessage) error err = unpopulate(val, &m.Minimum) delete(rawMsg, key) case "timestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.Timestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.Timestamp) delete(rawMsg, key) case "total": err = unpopulate(val, &m.Total) @@ -3491,6 +3187,12 @@ type MongoDBResourcesBeginMigrateMongoDBDatabaseToManualThroughputOptions struct // placeholder for future optional parameters } +// MongoDBResourcesBeginRetrieveContinuousBackupInformationOptions contains the optional parameters for the MongoDBResources.BeginRetrieveContinuousBackupInformation +// method. +type MongoDBResourcesBeginRetrieveContinuousBackupInformationOptions struct { + // placeholder for future optional parameters +} + // MongoDBResourcesBeginUpdateMongoDBCollectionThroughputOptions contains the optional parameters for the MongoDBResources.BeginUpdateMongoDBCollectionThroughput // method. type MongoDBResourcesBeginUpdateMongoDBCollectionThroughputOptions struct { @@ -3579,29 +3281,6 @@ func (n NotebookWorkspace) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type NotebookWorkspace. -func (n *NotebookWorkspace) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, &n.Properties) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - if err := n.ARMProxyResource.unmarshalInternal(rawMsg); err != nil { - return err - } - return nil -} - // NotebookWorkspaceConnectionInfoResult - The connection info for the given notebook workspace type NotebookWorkspaceConnectionInfoResult struct { // READ-ONLY; Specifies auth token used for connecting to Notebook server (uses token-based auth). @@ -3849,10 +3528,10 @@ type PercentileMetric struct { // MarshalJSON implements the json.Marshaller interface for type PercentileMetric. func (p PercentileMetric) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "endTime", (*timeRFC3339)(p.EndTime)) + populateTimeRFC3339(objectMap, "endTime", p.EndTime) populate(objectMap, "metricValues", p.MetricValues) populate(objectMap, "name", p.Name) - populate(objectMap, "startTime", (*timeRFC3339)(p.StartTime)) + populateTimeRFC3339(objectMap, "startTime", p.StartTime) populate(objectMap, "timeGrain", p.TimeGrain) populate(objectMap, "unit", p.Unit) return json.Marshal(objectMap) @@ -3868,9 +3547,7 @@ func (p *PercentileMetric) UnmarshalJSON(data []byte) error { var err error switch key { case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - p.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &p.EndTime) delete(rawMsg, key) case "metricValues": err = unpopulate(val, &p.MetricValues) @@ -3879,9 +3556,7 @@ func (p *PercentileMetric) UnmarshalJSON(data []byte) error { err = unpopulate(val, &p.Name) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - p.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &p.StartTime) delete(rawMsg, key) case "timeGrain": err = unpopulate(val, &p.TimeGrain) @@ -4143,29 +3818,6 @@ func (p PrivateLinkResource) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type PrivateLinkResource. -func (p *PrivateLinkResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, &p.Properties) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - if err := p.ARMProxyResource.unmarshalInternal(rawMsg); err != nil { - return err - } - return nil -} - // PrivateLinkResourceListResult - A list of private link resources type PrivateLinkResourceListResult struct { // Array of private link resources @@ -4233,35 +3885,6 @@ type RegionForOnlineOffline struct { Region *string `json:"region,omitempty"` } -// RegionalServiceResource - Resource for a regional service location. -type RegionalServiceResource struct { - // READ-ONLY; The location name. - Location *string `json:"location,omitempty" azure:"ro"` - - // READ-ONLY; The regional service name. - Name *string `json:"name,omitempty" azure:"ro"` - - // READ-ONLY; Describes the status of a service. - Status *ServiceStatus `json:"status,omitempty" azure:"ro"` -} - -// RepairPostBody - Specification of the keyspaces and tables to run repair on. -type RepairPostBody struct { - // REQUIRED; The name of the keyspace that repair should be run on. - Keyspace *string `json:"keyspace,omitempty"` - - // List of tables in the keyspace to repair. If omitted, repair all tables in the keyspace. - Tables []*string `json:"tables,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type RepairPostBody. -func (r RepairPostBody) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "keyspace", r.Keyspace) - populate(objectMap, "tables", r.Tables) - return json.Marshal(objectMap) -} - // Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} @@ -4315,8 +3938,8 @@ func (r RestorableDatabaseAccountProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "apiType", r.APIType) populate(objectMap, "accountName", r.AccountName) - populate(objectMap, "creationTime", (*timeRFC3339)(r.CreationTime)) - populate(objectMap, "deletionTime", (*timeRFC3339)(r.DeletionTime)) + populateTimeRFC3339(objectMap, "creationTime", r.CreationTime) + populateTimeRFC3339(objectMap, "deletionTime", r.DeletionTime) populate(objectMap, "restorableLocations", r.RestorableLocations) return json.Marshal(objectMap) } @@ -4337,14 +3960,10 @@ func (r *RestorableDatabaseAccountProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.AccountName) delete(rawMsg, key) case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.CreationTime) delete(rawMsg, key) case "deletionTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.DeletionTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.DeletionTime) delete(rawMsg, key) case "restorableLocations": err = unpopulate(val, &r.RestorableLocations) @@ -4403,8 +4022,8 @@ type RestorableLocationResource struct { // MarshalJSON implements the json.Marshaller interface for type RestorableLocationResource. func (r RestorableLocationResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(r.CreationTime)) - populate(objectMap, "deletionTime", (*timeRFC3339)(r.DeletionTime)) + populateTimeRFC3339(objectMap, "creationTime", r.CreationTime) + populateTimeRFC3339(objectMap, "deletionTime", r.DeletionTime) populate(objectMap, "locationName", r.LocationName) populate(objectMap, "regionalDatabaseAccountInstanceId", r.RegionalDatabaseAccountInstanceID) return json.Marshal(objectMap) @@ -4420,14 +4039,10 @@ func (r *RestorableLocationResource) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.CreationTime) delete(rawMsg, key) case "deletionTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.DeletionTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.DeletionTime) delete(rawMsg, key) case "locationName": err = unpopulate(val, &r.LocationName) @@ -4789,7 +4404,7 @@ func (r RestoreParameters) MarshalJSON() ([]byte, error) { populate(objectMap, "databasesToRestore", r.DatabasesToRestore) populate(objectMap, "restoreMode", r.RestoreMode) populate(objectMap, "restoreSource", r.RestoreSource) - populate(objectMap, "restoreTimestampInUtc", (*timeRFC3339)(r.RestoreTimestampInUTC)) + populateTimeRFC3339(objectMap, "restoreTimestampInUtc", r.RestoreTimestampInUTC) return json.Marshal(objectMap) } @@ -4812,9 +4427,7 @@ func (r *RestoreParameters) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.RestoreSource) delete(rawMsg, key) case "restoreTimestampInUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.RestoreTimestampInUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.RestoreTimestampInUTC) delete(rawMsg, key) } if err != nil { @@ -5031,64 +4644,6 @@ func (s SQLDatabaseResource) marshalInternal(objectMap map[string]interface{}) { populate(objectMap, "id", s.ID) } -// SQLDedicatedGatewayRegionalServiceResource - Resource for a regional service location. -type SQLDedicatedGatewayRegionalServiceResource struct { - RegionalServiceResource - // READ-ONLY; The regional endpoint for SqlDedicatedGateway. - SQLDedicatedGatewayEndpoint *string `json:"sqlDedicatedGatewayEndpoint,omitempty" azure:"ro"` -} - -// SQLDedicatedGatewayServiceResource - Describes the service response property for SqlDedicatedGateway. -type SQLDedicatedGatewayServiceResource struct { - // Properties for SqlDedicatedGatewayServiceResource. - Properties *SQLDedicatedGatewayServiceResourceProperties `json:"properties,omitempty"` -} - -// SQLDedicatedGatewayServiceResourceProperties - Properties for SqlDedicatedGatewayServiceResource. -type SQLDedicatedGatewayServiceResourceProperties struct { - ServiceResourceProperties - // SqlDedicatedGateway endpoint for the service. - SQLDedicatedGatewayEndpoint *string `json:"sqlDedicatedGatewayEndpoint,omitempty"` - - // READ-ONLY; An array that contains all of the locations for the service. - Locations []*SQLDedicatedGatewayRegionalServiceResource `json:"locations,omitempty" azure:"ro"` -} - -// MarshalJSON implements the json.Marshaller interface for type SQLDedicatedGatewayServiceResourceProperties. -func (s SQLDedicatedGatewayServiceResourceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - s.ServiceResourceProperties.marshalInternal(objectMap, ServiceTypeSQLDedicatedGateway) - populate(objectMap, "locations", s.Locations) - populate(objectMap, "sqlDedicatedGatewayEndpoint", s.SQLDedicatedGatewayEndpoint) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLDedicatedGatewayServiceResourceProperties. -func (s *SQLDedicatedGatewayServiceResourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "locations": - err = unpopulate(val, &s.Locations) - delete(rawMsg, key) - case "sqlDedicatedGatewayEndpoint": - err = unpopulate(val, &s.SQLDedicatedGatewayEndpoint) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - if err := s.ServiceResourceProperties.unmarshalInternal(rawMsg); err != nil { - return err - } - return nil -} - // SQLResourcesBeginCreateUpdateSQLContainerOptions contains the optional parameters for the SQLResources.BeginCreateUpdateSQLContainer method. type SQLResourcesBeginCreateUpdateSQLContainerOptions struct { // placeholder for future optional parameters @@ -5299,29 +4854,6 @@ func (s SQLRoleAssignmentGetResults) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLRoleAssignmentGetResults. -func (s *SQLRoleAssignmentGetResults) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, &s.Properties) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - if err := s.ARMProxyResource.unmarshalInternal(rawMsg); err != nil { - return err - } - return nil -} - // SQLRoleAssignmentListResult - The relevant Role Assignments. type SQLRoleAssignmentListResult struct { // READ-ONLY; List of Role Assignments and their properties @@ -5370,29 +4902,6 @@ func (s SQLRoleDefinitionGetResults) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// UnmarshalJSON implements the json.Unmarshaller interface for type SQLRoleDefinitionGetResults. -func (s *SQLRoleDefinitionGetResults) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - err = unpopulate(val, &s.Properties) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - if err := s.ARMProxyResource.unmarshalInternal(rawMsg); err != nil { - return err - } - return nil -} - // SQLRoleDefinitionListResult - The relevant Role Definitions. type SQLRoleDefinitionListResult struct { // READ-ONLY; List of Role Definitions and their properties. @@ -5697,192 +5206,6 @@ type SeedNode struct { IPAddress *string `json:"ipAddress,omitempty"` } -// ServiceBeginCreateOptions contains the optional parameters for the Service.BeginCreate method. -type ServiceBeginCreateOptions struct { - // placeholder for future optional parameters -} - -// ServiceBeginDeleteOptions contains the optional parameters for the Service.BeginDelete method. -type ServiceBeginDeleteOptions struct { - // placeholder for future optional parameters -} - -// ServiceGetOptions contains the optional parameters for the Service.Get method. -type ServiceGetOptions struct { - // placeholder for future optional parameters -} - -// ServiceListOptions contains the optional parameters for the Service.List method. -type ServiceListOptions struct { - // placeholder for future optional parameters -} - -// ServiceResource - Properties for the database account. -type ServiceResource struct { - ARMProxyResource - // Services response resource. - Properties ServiceResourcePropertiesClassification `json:"properties,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type ServiceResource. -func (s ServiceResource) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - s.ARMProxyResource.marshalInternal(objectMap) - populate(objectMap, "properties", s.Properties) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceResource. -func (s *ServiceResource) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "properties": - s.Properties, err = unmarshalServiceResourcePropertiesClassification(val) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - if err := s.ARMProxyResource.unmarshalInternal(rawMsg); err != nil { - return err - } - return nil -} - -// ServiceResourceCreateUpdateParameters - Parameters for Create or Update Request for ServiceResource -type ServiceResourceCreateUpdateParameters struct { - // Properties in ServiceResourceCreateUpdateParameters. - Properties *ServiceResourceCreateUpdateProperties `json:"properties,omitempty"` -} - -// ServiceResourceCreateUpdateProperties - Properties in ServiceResourceCreateUpdateParameters. -type ServiceResourceCreateUpdateProperties struct { - // Instance count for the service. - InstanceCount *int32 `json:"instanceCount,omitempty"` - - // Instance type for the service. - InstanceSize *ServiceSize `json:"instanceSize,omitempty"` - - // ServiceType for the service. - ServiceType *ServiceType `json:"serviceType,omitempty"` -} - -// ServiceResourceListResult - The List operation response, that contains the Service Resource and their properties. -type ServiceResourceListResult struct { - // READ-ONLY; List of Service Resource and their properties. - Value []*ServiceResource `json:"value,omitempty" azure:"ro"` -} - -// MarshalJSON implements the json.Marshaller interface for type ServiceResourceListResult. -func (s ServiceResourceListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "value", s.Value) - return json.Marshal(objectMap) -} - -// ServiceResourcePropertiesClassification provides polymorphic access to related types. -// Call the interface's GetServiceResourceProperties() method to access the common type. -// Use a type switch to determine the concrete type. The possible types are: -// - *DataTransferServiceResourceProperties, *GraphAPIComputeServiceResourceProperties, *ServiceResourceProperties, *SqlDedicatedGatewayServiceResourceProperties -type ServiceResourcePropertiesClassification interface { - // GetServiceResourceProperties returns the ServiceResourceProperties content of the underlying type. - GetServiceResourceProperties() *ServiceResourceProperties -} - -// ServiceResourceProperties - Services response resource. -type ServiceResourceProperties struct { - // REQUIRED; ServiceType for the service. - ServiceType *ServiceType `json:"serviceType,omitempty"` - - // OPTIONAL; Contains additional key/value pairs not defined in the schema. - AdditionalProperties map[string]map[string]interface{} - - // Instance count for the service. - InstanceCount *int32 `json:"instanceCount,omitempty"` - - // Instance type for the service. - InstanceSize *ServiceSize `json:"instanceSize,omitempty"` - - // READ-ONLY; Time of the last state change (ISO-8601 format). - CreationTime *time.Time `json:"creationTime,omitempty" azure:"ro"` - - // READ-ONLY; Describes the status of a service. - Status *ServiceStatus `json:"status,omitempty" azure:"ro"` -} - -// GetServiceResourceProperties implements the ServiceResourcePropertiesClassification interface for type ServiceResourceProperties. -func (s *ServiceResourceProperties) GetServiceResourceProperties() *ServiceResourceProperties { - return s -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type ServiceResourceProperties. -func (s *ServiceResourceProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - return s.unmarshalInternal(rawMsg) -} - -func (s ServiceResourceProperties) marshalInternal(objectMap map[string]interface{}, discValue ServiceType) { - populate(objectMap, "creationTime", (*timeRFC3339)(s.CreationTime)) - populate(objectMap, "instanceCount", s.InstanceCount) - populate(objectMap, "instanceSize", s.InstanceSize) - s.ServiceType = &discValue - objectMap["serviceType"] = s.ServiceType - populate(objectMap, "status", s.Status) - if s.AdditionalProperties != nil { - for key, val := range s.AdditionalProperties { - objectMap[key] = val - } - } -} - -func (s *ServiceResourceProperties) unmarshalInternal(rawMsg map[string]json.RawMessage) error { - for key, val := range rawMsg { - var err error - switch key { - case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreationTime = (*time.Time)(&aux) - delete(rawMsg, key) - case "instanceCount": - err = unpopulate(val, &s.InstanceCount) - delete(rawMsg, key) - case "instanceSize": - err = unpopulate(val, &s.InstanceSize) - delete(rawMsg, key) - case "serviceType": - err = unpopulate(val, &s.ServiceType) - delete(rawMsg, key) - case "status": - err = unpopulate(val, &s.Status) - delete(rawMsg, key) - default: - if s.AdditionalProperties == nil { - s.AdditionalProperties = map[string]map[string]interface{}{} - } - if val != nil { - var aux map[string]interface{} - err = json.Unmarshal(val, &aux) - s.AdditionalProperties[key] = aux - } - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - type SpatialSpec struct { // The path for which the indexing behavior applies to. Index paths typically start with root and end with wildcard (/path/*) Path *string `json:"path,omitempty"` @@ -5923,10 +5246,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -5942,9 +5265,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -5953,9 +5274,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_mongodbresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_mongodbresources_client.go index 7a5b8c376176..b4547d85e3f4 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_mongodbresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_mongodbresources_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // MongoDBResourcesClient contains the methods for the MongoDBResources group. @@ -31,8 +31,15 @@ type MongoDBResourcesClient struct { } // NewMongoDBResourcesClient creates a new instance of MongoDBResourcesClient with the specified values. -func NewMongoDBResourcesClient(con *arm.Connection, subscriptionID string) *MongoDBResourcesClient { - return &MongoDBResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewMongoDBResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *MongoDBResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MongoDBResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateUpdateMongoDBCollection - Create or update an Azure Cosmos DB MongoDB Collection @@ -100,7 +107,7 @@ func (client *MongoDBResourcesClient) createUpdateMongoDBCollectionCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, createUpdateMongoDBCollectionParameters) @@ -179,7 +186,7 @@ func (client *MongoDBResourcesClient) createUpdateMongoDBDatabaseCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, createUpdateMongoDBDatabaseParameters) @@ -262,7 +269,7 @@ func (client *MongoDBResourcesClient) deleteMongoDBCollectionCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -340,7 +347,7 @@ func (client *MongoDBResourcesClient) deleteMongoDBDatabaseCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -402,7 +409,7 @@ func (client *MongoDBResourcesClient) getMongoDBCollectionCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -412,7 +419,7 @@ func (client *MongoDBResourcesClient) getMongoDBCollectionCreateRequest(ctx cont func (client *MongoDBResourcesClient) getMongoDBCollectionHandleResponse(resp *http.Response) (MongoDBResourcesGetMongoDBCollectionResponse, error) { result := MongoDBResourcesGetMongoDBCollectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MongoDBCollectionGetResults); err != nil { - return MongoDBResourcesGetMongoDBCollectionResponse{}, err + return MongoDBResourcesGetMongoDBCollectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -475,7 +482,7 @@ func (client *MongoDBResourcesClient) getMongoDBCollectionThroughputCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -485,7 +492,7 @@ func (client *MongoDBResourcesClient) getMongoDBCollectionThroughputCreateReques func (client *MongoDBResourcesClient) getMongoDBCollectionThroughputHandleResponse(resp *http.Response) (MongoDBResourcesGetMongoDBCollectionThroughputResponse, error) { result := MongoDBResourcesGetMongoDBCollectionThroughputResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ThroughputSettingsGetResults); err != nil { - return MongoDBResourcesGetMongoDBCollectionThroughputResponse{}, err + return MongoDBResourcesGetMongoDBCollectionThroughputResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -543,7 +550,7 @@ func (client *MongoDBResourcesClient) getMongoDBDatabaseCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -553,7 +560,7 @@ func (client *MongoDBResourcesClient) getMongoDBDatabaseCreateRequest(ctx contex func (client *MongoDBResourcesClient) getMongoDBDatabaseHandleResponse(resp *http.Response) (MongoDBResourcesGetMongoDBDatabaseResponse, error) { result := MongoDBResourcesGetMongoDBDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MongoDBDatabaseGetResults); err != nil { - return MongoDBResourcesGetMongoDBDatabaseResponse{}, err + return MongoDBResourcesGetMongoDBDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -611,7 +618,7 @@ func (client *MongoDBResourcesClient) getMongoDBDatabaseThroughputCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -621,7 +628,7 @@ func (client *MongoDBResourcesClient) getMongoDBDatabaseThroughputCreateRequest( func (client *MongoDBResourcesClient) getMongoDBDatabaseThroughputHandleResponse(resp *http.Response) (MongoDBResourcesGetMongoDBDatabaseThroughputResponse, error) { result := MongoDBResourcesGetMongoDBDatabaseThroughputResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ThroughputSettingsGetResults); err != nil { - return MongoDBResourcesGetMongoDBDatabaseThroughputResponse{}, err + return MongoDBResourcesGetMongoDBDatabaseThroughputResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -679,7 +686,7 @@ func (client *MongoDBResourcesClient) listMongoDBCollectionsCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -689,7 +696,7 @@ func (client *MongoDBResourcesClient) listMongoDBCollectionsCreateRequest(ctx co func (client *MongoDBResourcesClient) listMongoDBCollectionsHandleResponse(resp *http.Response) (MongoDBResourcesListMongoDBCollectionsResponse, error) { result := MongoDBResourcesListMongoDBCollectionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MongoDBCollectionListResult); err != nil { - return MongoDBResourcesListMongoDBCollectionsResponse{}, err + return MongoDBResourcesListMongoDBCollectionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -743,7 +750,7 @@ func (client *MongoDBResourcesClient) listMongoDBDatabasesCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -753,7 +760,7 @@ func (client *MongoDBResourcesClient) listMongoDBDatabasesCreateRequest(ctx cont func (client *MongoDBResourcesClient) listMongoDBDatabasesHandleResponse(resp *http.Response) (MongoDBResourcesListMongoDBDatabasesResponse, error) { result := MongoDBResourcesListMongoDBDatabasesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MongoDBDatabaseListResult); err != nil { - return MongoDBResourcesListMongoDBDatabasesResponse{}, err + return MongoDBResourcesListMongoDBDatabasesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -835,7 +842,7 @@ func (client *MongoDBResourcesClient) migrateMongoDBCollectionToAutoscaleCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -919,7 +926,7 @@ func (client *MongoDBResourcesClient) migrateMongoDBCollectionToManualThroughput return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -999,7 +1006,7 @@ func (client *MongoDBResourcesClient) migrateMongoDBDatabaseToAutoscaleCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1079,7 +1086,7 @@ func (client *MongoDBResourcesClient) migrateMongoDBDatabaseToManualThroughputCr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1098,6 +1105,90 @@ func (client *MongoDBResourcesClient) migrateMongoDBDatabaseToManualThroughputHa return runtime.NewResponseError(&errType, resp) } +// BeginRetrieveContinuousBackupInformation - Retrieves continuous backup information for a Mongodb collection. +// If the operation fails it returns the *CloudError error type. +func (client *MongoDBResourcesClient) BeginRetrieveContinuousBackupInformation(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, location ContinuousBackupRestoreLocation, options *MongoDBResourcesBeginRetrieveContinuousBackupInformationOptions) (MongoDBResourcesRetrieveContinuousBackupInformationPollerResponse, error) { + resp, err := client.retrieveContinuousBackupInformation(ctx, resourceGroupName, accountName, databaseName, collectionName, location, options) + if err != nil { + return MongoDBResourcesRetrieveContinuousBackupInformationPollerResponse{}, err + } + result := MongoDBResourcesRetrieveContinuousBackupInformationPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("MongoDBResourcesClient.RetrieveContinuousBackupInformation", "location", resp, client.pl, client.retrieveContinuousBackupInformationHandleError) + if err != nil { + return MongoDBResourcesRetrieveContinuousBackupInformationPollerResponse{}, err + } + result.Poller = &MongoDBResourcesRetrieveContinuousBackupInformationPoller{ + pt: pt, + } + return result, nil +} + +// RetrieveContinuousBackupInformation - Retrieves continuous backup information for a Mongodb collection. +// If the operation fails it returns the *CloudError error type. +func (client *MongoDBResourcesClient) retrieveContinuousBackupInformation(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, location ContinuousBackupRestoreLocation, options *MongoDBResourcesBeginRetrieveContinuousBackupInformationOptions) (*http.Response, error) { + req, err := client.retrieveContinuousBackupInformationCreateRequest(ctx, resourceGroupName, accountName, databaseName, collectionName, location, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.retrieveContinuousBackupInformationHandleError(resp) + } + return resp, nil +} + +// retrieveContinuousBackupInformationCreateRequest creates the RetrieveContinuousBackupInformation request. +func (client *MongoDBResourcesClient) retrieveContinuousBackupInformationCreateRequest(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, location ContinuousBackupRestoreLocation, options *MongoDBResourcesBeginRetrieveContinuousBackupInformationOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.DocumentDB/databaseAccounts/{accountName}/mongodbDatabases/{databaseName}/collections/{collectionName}/retrieveContinuousBackupInformation" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if accountName == "" { + return nil, errors.New("parameter accountName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{accountName}", url.PathEscape(accountName)) + if databaseName == "" { + return nil, errors.New("parameter databaseName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{databaseName}", url.PathEscape(databaseName)) + if collectionName == "" { + return nil, errors.New("parameter collectionName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{collectionName}", url.PathEscape(collectionName)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-15") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, location) +} + +// retrieveContinuousBackupInformationHandleError handles the RetrieveContinuousBackupInformation error response. +func (client *MongoDBResourcesClient) retrieveContinuousBackupInformationHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + // BeginUpdateMongoDBCollectionThroughput - Update the RUs per second of an Azure Cosmos DB MongoDB collection // If the operation fails it returns a generic error. func (client *MongoDBResourcesClient) BeginUpdateMongoDBCollectionThroughput(ctx context.Context, resourceGroupName string, accountName string, databaseName string, collectionName string, updateThroughputParameters ThroughputSettingsUpdateParameters, options *MongoDBResourcesBeginUpdateMongoDBCollectionThroughputOptions) (MongoDBResourcesUpdateMongoDBCollectionThroughputPollerResponse, error) { @@ -1163,7 +1254,7 @@ func (client *MongoDBResourcesClient) updateMongoDBCollectionThroughputCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, updateThroughputParameters) @@ -1242,7 +1333,7 @@ func (client *MongoDBResourcesClient) updateMongoDBDatabaseThroughputCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, updateThroughputParameters) diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_notebookworkspaces_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_notebookworkspaces_client.go index 585b4183eff1..6e46636937d4 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_notebookworkspaces_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_notebookworkspaces_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NotebookWorkspacesClient contains the methods for the NotebookWorkspaces group. @@ -31,8 +31,15 @@ type NotebookWorkspacesClient struct { } // NewNotebookWorkspacesClient creates a new instance of NotebookWorkspacesClient with the specified values. -func NewNotebookWorkspacesClient(con *arm.Connection, subscriptionID string) *NotebookWorkspacesClient { - return &NotebookWorkspacesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNotebookWorkspacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NotebookWorkspacesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NotebookWorkspacesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates the notebook workspace for a Cosmos DB account. @@ -96,7 +103,7 @@ func (client *NotebookWorkspacesClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, notebookCreateUpdateParameters) @@ -176,7 +183,7 @@ func (client *NotebookWorkspacesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *NotebookWorkspacesClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *NotebookWorkspacesClient) getCreateRequest(ctx context.Context, re func (client *NotebookWorkspacesClient) getHandleResponse(resp *http.Response) (NotebookWorkspacesGetResponse, error) { result := NotebookWorkspacesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NotebookWorkspace); err != nil { - return NotebookWorkspacesGetResponse{}, err + return NotebookWorkspacesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -301,7 +308,7 @@ func (client *NotebookWorkspacesClient) listByDatabaseAccountCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -311,7 +318,7 @@ func (client *NotebookWorkspacesClient) listByDatabaseAccountCreateRequest(ctx c func (client *NotebookWorkspacesClient) listByDatabaseAccountHandleResponse(resp *http.Response) (NotebookWorkspacesListByDatabaseAccountResponse, error) { result := NotebookWorkspacesListByDatabaseAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NotebookWorkspaceListResult); err != nil { - return NotebookWorkspacesListByDatabaseAccountResponse{}, err + return NotebookWorkspacesListByDatabaseAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -370,7 +377,7 @@ func (client *NotebookWorkspacesClient) listConnectionInfoCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -380,7 +387,7 @@ func (client *NotebookWorkspacesClient) listConnectionInfoCreateRequest(ctx cont func (client *NotebookWorkspacesClient) listConnectionInfoHandleResponse(resp *http.Response) (NotebookWorkspacesListConnectionInfoResponse, error) { result := NotebookWorkspacesListConnectionInfoResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NotebookWorkspaceConnectionInfoResult); err != nil { - return NotebookWorkspacesListConnectionInfoResponse{}, err + return NotebookWorkspacesListConnectionInfoResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -459,7 +466,7 @@ func (client *NotebookWorkspacesClient) regenerateAuthTokenCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -539,7 +546,7 @@ func (client *NotebookWorkspacesClient) startCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_operations_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_operations_client.go index 684eb90eb0c8..83c58a6bd991 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_operations_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armcosmos import ( "context" "errors" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available Cosmos DB Resource Provider operations. @@ -52,7 +60,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_pagers.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_pagers.go index f3c56b9abdc1..633d2e232e2f 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_pagers.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armcosmos import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // OperationsListPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_partitionkeyrangeid_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_partitionkeyrangeid_client.go index 5e4dde574102..8d1a2ec99084 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_partitionkeyrangeid_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_partitionkeyrangeid_client.go @@ -11,13 +11,14 @@ package armcosmos import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PartitionKeyRangeIDClient contains the methods for the PartitionKeyRangeID group. @@ -29,8 +30,15 @@ type PartitionKeyRangeIDClient struct { } // NewPartitionKeyRangeIDClient creates a new instance of PartitionKeyRangeIDClient with the specified values. -func NewPartitionKeyRangeIDClient(con *arm.Connection, subscriptionID string) *PartitionKeyRangeIDClient { - return &PartitionKeyRangeIDClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPartitionKeyRangeIDClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PartitionKeyRangeIDClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PartitionKeyRangeIDClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListMetrics - Retrieves the metrics determined by the given filter for the given partition key range id. @@ -82,7 +90,7 @@ func (client *PartitionKeyRangeIDClient) listMetricsCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") @@ -93,7 +101,7 @@ func (client *PartitionKeyRangeIDClient) listMetricsCreateRequest(ctx context.Co func (client *PartitionKeyRangeIDClient) listMetricsHandleResponse(resp *http.Response) (PartitionKeyRangeIDListMetricsResponse, error) { result := PartitionKeyRangeIDListMetricsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PartitionMetricListResult); err != nil { - return PartitionKeyRangeIDListMetricsResponse{}, err + return PartitionKeyRangeIDListMetricsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_partitionkeyrangeidregion_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_partitionkeyrangeidregion_client.go index afe06206a4cb..c3a2b2f5e8d6 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_partitionkeyrangeidregion_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_partitionkeyrangeidregion_client.go @@ -11,13 +11,14 @@ package armcosmos import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PartitionKeyRangeIDRegionClient contains the methods for the PartitionKeyRangeIDRegion group. @@ -29,8 +30,15 @@ type PartitionKeyRangeIDRegionClient struct { } // NewPartitionKeyRangeIDRegionClient creates a new instance of PartitionKeyRangeIDRegionClient with the specified values. -func NewPartitionKeyRangeIDRegionClient(con *arm.Connection, subscriptionID string) *PartitionKeyRangeIDRegionClient { - return &PartitionKeyRangeIDRegionClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPartitionKeyRangeIDRegionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PartitionKeyRangeIDRegionClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PartitionKeyRangeIDRegionClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListMetrics - Retrieves the metrics determined by the given filter for the given partition key range id and region. @@ -86,7 +94,7 @@ func (client *PartitionKeyRangeIDRegionClient) listMetricsCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") @@ -97,7 +105,7 @@ func (client *PartitionKeyRangeIDRegionClient) listMetricsCreateRequest(ctx cont func (client *PartitionKeyRangeIDRegionClient) listMetricsHandleResponse(resp *http.Response) (PartitionKeyRangeIDRegionListMetricsResponse, error) { result := PartitionKeyRangeIDRegionListMetricsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PartitionMetricListResult); err != nil { - return PartitionKeyRangeIDRegionListMetricsResponse{}, err + return PartitionKeyRangeIDRegionListMetricsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_percentile_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_percentile_client.go index b2a821f6d9f1..0f69d82bfa8e 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_percentile_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_percentile_client.go @@ -11,13 +11,14 @@ package armcosmos import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PercentileClient contains the methods for the Percentile group. @@ -29,8 +30,15 @@ type PercentileClient struct { } // NewPercentileClient creates a new instance of PercentileClient with the specified values. -func NewPercentileClient(con *arm.Connection, subscriptionID string) *PercentileClient { - return &PercentileClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPercentileClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PercentileClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PercentileClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListMetrics - Retrieves the metrics determined by the given filter for the given database account. This url is only for PBS and Replication Latency data @@ -70,7 +78,7 @@ func (client *PercentileClient) listMetricsCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") @@ -81,7 +89,7 @@ func (client *PercentileClient) listMetricsCreateRequest(ctx context.Context, re func (client *PercentileClient) listMetricsHandleResponse(resp *http.Response) (PercentileListMetricsResponse, error) { result := PercentileListMetricsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PercentileMetricListResult); err != nil { - return PercentileListMetricsResponse{}, err + return PercentileListMetricsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_percentilesourcetarget_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_percentilesourcetarget_client.go index 57ec975814e1..689f071b1e0e 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_percentilesourcetarget_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_percentilesourcetarget_client.go @@ -11,13 +11,14 @@ package armcosmos import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PercentileSourceTargetClient contains the methods for the PercentileSourceTarget group. @@ -29,8 +30,15 @@ type PercentileSourceTargetClient struct { } // NewPercentileSourceTargetClient creates a new instance of PercentileSourceTargetClient with the specified values. -func NewPercentileSourceTargetClient(con *arm.Connection, subscriptionID string) *PercentileSourceTargetClient { - return &PercentileSourceTargetClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPercentileSourceTargetClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PercentileSourceTargetClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PercentileSourceTargetClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListMetrics - Retrieves the metrics determined by the given filter for the given account, source and target region. This url is only for PBS and Replication @@ -79,7 +87,7 @@ func (client *PercentileSourceTargetClient) listMetricsCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") @@ -90,7 +98,7 @@ func (client *PercentileSourceTargetClient) listMetricsCreateRequest(ctx context func (client *PercentileSourceTargetClient) listMetricsHandleResponse(resp *http.Response) (PercentileSourceTargetListMetricsResponse, error) { result := PercentileSourceTargetListMetricsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PercentileMetricListResult); err != nil { - return PercentileSourceTargetListMetricsResponse{}, err + return PercentileSourceTargetListMetricsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_percentiletarget_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_percentiletarget_client.go index 160db23a1b82..4c60e0245831 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_percentiletarget_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_percentiletarget_client.go @@ -11,13 +11,14 @@ package armcosmos import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PercentileTargetClient contains the methods for the PercentileTarget group. @@ -29,8 +30,15 @@ type PercentileTargetClient struct { } // NewPercentileTargetClient creates a new instance of PercentileTargetClient with the specified values. -func NewPercentileTargetClient(con *arm.Connection, subscriptionID string) *PercentileTargetClient { - return &PercentileTargetClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPercentileTargetClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PercentileTargetClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PercentileTargetClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListMetrics - Retrieves the metrics determined by the given filter for the given account target region. This url is only for PBS and Replication Latency @@ -75,7 +83,7 @@ func (client *PercentileTargetClient) listMetricsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") reqQP.Set("$filter", filter) req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") @@ -86,7 +94,7 @@ func (client *PercentileTargetClient) listMetricsCreateRequest(ctx context.Conte func (client *PercentileTargetClient) listMetricsHandleResponse(resp *http.Response) (PercentileTargetListMetricsResponse, error) { result := PercentileTargetListMetricsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PercentileMetricListResult); err != nil { - return PercentileTargetListMetricsResponse{}, err + return PercentileTargetListMetricsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_pollers.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_pollers.go index 4d93fde16b49..44fb2bf163cf 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_pollers.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armcosmos import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // CassandraClustersCreateUpdatePoller provides polling facilities until the operation reaches a terminal state. @@ -58,6 +57,49 @@ func (p *CassandraClustersCreateUpdatePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } +// CassandraClustersDeallocatePoller provides polling facilities until the operation reaches a terminal state. +type CassandraClustersDeallocatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *CassandraClustersDeallocatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *CassandraClustersDeallocatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final CassandraClustersDeallocateResponse will be returned. +func (p *CassandraClustersDeallocatePoller) FinalResponse(ctx context.Context) (CassandraClustersDeallocateResponse, error) { + respType := CassandraClustersDeallocateResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return CassandraClustersDeallocateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *CassandraClustersDeallocatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + // CassandraClustersDeletePoller provides polling facilities until the operation reaches a terminal state. type CassandraClustersDeletePoller struct { pt *azcore.Poller @@ -101,13 +143,13 @@ func (p *CassandraClustersDeletePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -// CassandraClustersFetchNodeStatusPoller provides polling facilities until the operation reaches a terminal state. -type CassandraClustersFetchNodeStatusPoller struct { +// CassandraClustersInvokeCommandPoller provides polling facilities until the operation reaches a terminal state. +type CassandraClustersInvokeCommandPoller struct { pt *azcore.Poller } // Done returns true if the LRO has reached a terminal state. -func (p *CassandraClustersFetchNodeStatusPoller) Done() bool { +func (p *CassandraClustersInvokeCommandPoller) Done() bool { return p.pt.Done() } @@ -121,18 +163,18 @@ func (p *CassandraClustersFetchNodeStatusPoller) Done() bool { // If Poll fails, the poller's state is unmodified and the error is returned. // Calling Poll on an LRO that has reached a terminal state will return the final // HTTP response or error. -func (p *CassandraClustersFetchNodeStatusPoller) Poll(ctx context.Context) (*http.Response, error) { +func (p *CassandraClustersInvokeCommandPoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } // FinalResponse performs a final GET to the service and returns the final response // for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final CassandraClustersFetchNodeStatusResponse will be returned. -func (p *CassandraClustersFetchNodeStatusPoller) FinalResponse(ctx context.Context) (CassandraClustersFetchNodeStatusResponse, error) { - respType := CassandraClustersFetchNodeStatusResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.ClusterNodeStatus) +// If the final GET succeeded then the final CassandraClustersInvokeCommandResponse will be returned. +func (p *CassandraClustersInvokeCommandPoller) FinalResponse(ctx context.Context) (CassandraClustersInvokeCommandResponse, error) { + respType := CassandraClustersInvokeCommandResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.CommandOutput) if err != nil { - return CassandraClustersFetchNodeStatusResponse{}, err + return CassandraClustersInvokeCommandResponse{}, err } respType.RawResponse = resp return respType, nil @@ -140,17 +182,17 @@ func (p *CassandraClustersFetchNodeStatusPoller) FinalResponse(ctx context.Conte // ResumeToken returns a value representing the poller that can be used to resume // the LRO at a later time. ResumeTokens are unique per service operation. -func (p *CassandraClustersFetchNodeStatusPoller) ResumeToken() (string, error) { +func (p *CassandraClustersInvokeCommandPoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -// CassandraClustersRequestRepairPoller provides polling facilities until the operation reaches a terminal state. -type CassandraClustersRequestRepairPoller struct { +// CassandraClustersStartPoller provides polling facilities until the operation reaches a terminal state. +type CassandraClustersStartPoller struct { pt *azcore.Poller } // Done returns true if the LRO has reached a terminal state. -func (p *CassandraClustersRequestRepairPoller) Done() bool { +func (p *CassandraClustersStartPoller) Done() bool { return p.pt.Done() } @@ -164,18 +206,18 @@ func (p *CassandraClustersRequestRepairPoller) Done() bool { // If Poll fails, the poller's state is unmodified and the error is returned. // Calling Poll on an LRO that has reached a terminal state will return the final // HTTP response or error. -func (p *CassandraClustersRequestRepairPoller) Poll(ctx context.Context) (*http.Response, error) { +func (p *CassandraClustersStartPoller) Poll(ctx context.Context) (*http.Response, error) { return p.pt.Poll(ctx) } // FinalResponse performs a final GET to the service and returns the final response // for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final CassandraClustersRequestRepairResponse will be returned. -func (p *CassandraClustersRequestRepairPoller) FinalResponse(ctx context.Context) (CassandraClustersRequestRepairResponse, error) { - respType := CassandraClustersRequestRepairResponse{} +// If the final GET succeeded then the final CassandraClustersStartResponse will be returned. +func (p *CassandraClustersStartPoller) FinalResponse(ctx context.Context) (CassandraClustersStartResponse, error) { + respType := CassandraClustersStartResponse{} resp, err := p.pt.FinalResponse(ctx, nil) if err != nil { - return CassandraClustersRequestRepairResponse{}, err + return CassandraClustersStartResponse{}, err } respType.RawResponse = resp return respType, nil @@ -183,7 +225,7 @@ func (p *CassandraClustersRequestRepairPoller) FinalResponse(ctx context.Context // ResumeToken returns a value representing the poller that can be used to resume // the LRO at a later time. ResumeTokens are unique per service operation. -func (p *CassandraClustersRequestRepairPoller) ResumeToken() (string, error) { +func (p *CassandraClustersStartPoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } @@ -445,49 +487,6 @@ func (p *CassandraResourcesCreateUpdateCassandraTablePoller) ResumeToken() (stri return p.pt.ResumeToken() } -// CassandraResourcesCreateUpdateCassandraViewPoller provides polling facilities until the operation reaches a terminal state. -type CassandraResourcesCreateUpdateCassandraViewPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *CassandraResourcesCreateUpdateCassandraViewPoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *CassandraResourcesCreateUpdateCassandraViewPoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final CassandraResourcesCreateUpdateCassandraViewResponse will be returned. -func (p *CassandraResourcesCreateUpdateCassandraViewPoller) FinalResponse(ctx context.Context) (CassandraResourcesCreateUpdateCassandraViewResponse, error) { - respType := CassandraResourcesCreateUpdateCassandraViewResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.CassandraViewGetResults) - if err != nil { - return CassandraResourcesCreateUpdateCassandraViewResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *CassandraResourcesCreateUpdateCassandraViewPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - // CassandraResourcesDeleteCassandraKeyspacePoller provides polling facilities until the operation reaches a terminal state. type CassandraResourcesDeleteCassandraKeyspacePoller struct { pt *azcore.Poller @@ -574,49 +573,6 @@ func (p *CassandraResourcesDeleteCassandraTablePoller) ResumeToken() (string, er return p.pt.ResumeToken() } -// CassandraResourcesDeleteCassandraViewPoller provides polling facilities until the operation reaches a terminal state. -type CassandraResourcesDeleteCassandraViewPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *CassandraResourcesDeleteCassandraViewPoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *CassandraResourcesDeleteCassandraViewPoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final CassandraResourcesDeleteCassandraViewResponse will be returned. -func (p *CassandraResourcesDeleteCassandraViewPoller) FinalResponse(ctx context.Context) (CassandraResourcesDeleteCassandraViewResponse, error) { - respType := CassandraResourcesDeleteCassandraViewResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return CassandraResourcesDeleteCassandraViewResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *CassandraResourcesDeleteCassandraViewPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - // CassandraResourcesMigrateCassandraKeyspaceToAutoscalePoller provides polling facilities until the operation reaches a terminal state. type CassandraResourcesMigrateCassandraKeyspaceToAutoscalePoller struct { pt *azcore.Poller @@ -789,92 +745,6 @@ func (p *CassandraResourcesMigrateCassandraTableToManualThroughputPoller) Resume return p.pt.ResumeToken() } -// CassandraResourcesMigrateCassandraViewToAutoscalePoller provides polling facilities until the operation reaches a terminal state. -type CassandraResourcesMigrateCassandraViewToAutoscalePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *CassandraResourcesMigrateCassandraViewToAutoscalePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *CassandraResourcesMigrateCassandraViewToAutoscalePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final CassandraResourcesMigrateCassandraViewToAutoscaleResponse will be returned. -func (p *CassandraResourcesMigrateCassandraViewToAutoscalePoller) FinalResponse(ctx context.Context) (CassandraResourcesMigrateCassandraViewToAutoscaleResponse, error) { - respType := CassandraResourcesMigrateCassandraViewToAutoscaleResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.ThroughputSettingsGetResults) - if err != nil { - return CassandraResourcesMigrateCassandraViewToAutoscaleResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *CassandraResourcesMigrateCassandraViewToAutoscalePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// CassandraResourcesMigrateCassandraViewToManualThroughputPoller provides polling facilities until the operation reaches a terminal state. -type CassandraResourcesMigrateCassandraViewToManualThroughputPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *CassandraResourcesMigrateCassandraViewToManualThroughputPoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *CassandraResourcesMigrateCassandraViewToManualThroughputPoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final CassandraResourcesMigrateCassandraViewToManualThroughputResponse will be returned. -func (p *CassandraResourcesMigrateCassandraViewToManualThroughputPoller) FinalResponse(ctx context.Context) (CassandraResourcesMigrateCassandraViewToManualThroughputResponse, error) { - respType := CassandraResourcesMigrateCassandraViewToManualThroughputResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.ThroughputSettingsGetResults) - if err != nil { - return CassandraResourcesMigrateCassandraViewToManualThroughputResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *CassandraResourcesMigrateCassandraViewToManualThroughputPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - // CassandraResourcesUpdateCassandraKeyspaceThroughputPoller provides polling facilities until the operation reaches a terminal state. type CassandraResourcesUpdateCassandraKeyspaceThroughputPoller struct { pt *azcore.Poller @@ -961,49 +831,6 @@ func (p *CassandraResourcesUpdateCassandraTableThroughputPoller) ResumeToken() ( return p.pt.ResumeToken() } -// CassandraResourcesUpdateCassandraViewThroughputPoller provides polling facilities until the operation reaches a terminal state. -type CassandraResourcesUpdateCassandraViewThroughputPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *CassandraResourcesUpdateCassandraViewThroughputPoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *CassandraResourcesUpdateCassandraViewThroughputPoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final CassandraResourcesUpdateCassandraViewThroughputResponse will be returned. -func (p *CassandraResourcesUpdateCassandraViewThroughputPoller) FinalResponse(ctx context.Context) (CassandraResourcesUpdateCassandraViewThroughputResponse, error) { - respType := CassandraResourcesUpdateCassandraViewThroughputResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.ThroughputSettingsGetResults) - if err != nil { - return CassandraResourcesUpdateCassandraViewThroughputResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *CassandraResourcesUpdateCassandraViewThroughputPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - // DatabaseAccountsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. type DatabaseAccountsCreateOrUpdatePoller struct { pt *azcore.Poller @@ -1305,92 +1132,6 @@ func (p *DatabaseAccountsUpdatePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -// GraphResourcesCreateUpdateGraphPoller provides polling facilities until the operation reaches a terminal state. -type GraphResourcesCreateUpdateGraphPoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *GraphResourcesCreateUpdateGraphPoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *GraphResourcesCreateUpdateGraphPoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final GraphResourcesCreateUpdateGraphResponse will be returned. -func (p *GraphResourcesCreateUpdateGraphPoller) FinalResponse(ctx context.Context) (GraphResourcesCreateUpdateGraphResponse, error) { - respType := GraphResourcesCreateUpdateGraphResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.GraphResourceGetResults) - if err != nil { - return GraphResourcesCreateUpdateGraphResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *GraphResourcesCreateUpdateGraphPoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// GraphResourcesDeleteGraphResourcePoller provides polling facilities until the operation reaches a terminal state. -type GraphResourcesDeleteGraphResourcePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *GraphResourcesDeleteGraphResourcePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *GraphResourcesDeleteGraphResourcePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final GraphResourcesDeleteGraphResourceResponse will be returned. -func (p *GraphResourcesDeleteGraphResourcePoller) FinalResponse(ctx context.Context) (GraphResourcesDeleteGraphResourceResponse, error) { - respType := GraphResourcesDeleteGraphResourceResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return GraphResourcesDeleteGraphResourceResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *GraphResourcesDeleteGraphResourcePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - // GremlinResourcesCreateUpdateGremlinDatabasePoller provides polling facilities until the operation reaches a terminal state. type GremlinResourcesCreateUpdateGremlinDatabasePoller struct { pt *azcore.Poller @@ -2165,6 +1906,49 @@ func (p *MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputPoller) ResumeT return p.pt.ResumeToken() } +// MongoDBResourcesRetrieveContinuousBackupInformationPoller provides polling facilities until the operation reaches a terminal state. +type MongoDBResourcesRetrieveContinuousBackupInformationPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *MongoDBResourcesRetrieveContinuousBackupInformationPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *MongoDBResourcesRetrieveContinuousBackupInformationPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final MongoDBResourcesRetrieveContinuousBackupInformationResponse will be returned. +func (p *MongoDBResourcesRetrieveContinuousBackupInformationPoller) FinalResponse(ctx context.Context) (MongoDBResourcesRetrieveContinuousBackupInformationResponse, error) { + respType := MongoDBResourcesRetrieveContinuousBackupInformationResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.BackupInformation) + if err != nil { + return MongoDBResourcesRetrieveContinuousBackupInformationResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *MongoDBResourcesRetrieveContinuousBackupInformationPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + // MongoDBResourcesUpdateMongoDBCollectionThroughputPoller provides polling facilities until the operation reaches a terminal state. type MongoDBResourcesUpdateMongoDBCollectionThroughputPoller struct { pt *azcore.Poller @@ -3412,92 +3196,6 @@ func (p *SQLResourcesUpdateSQLDatabaseThroughputPoller) ResumeToken() (string, e return p.pt.ResumeToken() } -// ServiceCreatePoller provides polling facilities until the operation reaches a terminal state. -type ServiceCreatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ServiceCreatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *ServiceCreatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final ServiceCreateResponse will be returned. -func (p *ServiceCreatePoller) FinalResponse(ctx context.Context) (ServiceCreateResponse, error) { - respType := ServiceCreateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.ServiceResource) - if err != nil { - return ServiceCreateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *ServiceCreatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// ServiceDeletePoller provides polling facilities until the operation reaches a terminal state. -type ServiceDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *ServiceDeletePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *ServiceDeletePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final ServiceDeleteResponse will be returned. -func (p *ServiceDeletePoller) FinalResponse(ctx context.Context) (ServiceDeleteResponse, error) { - respType := ServiceDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return ServiceDeleteResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *ServiceDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - // TableResourcesCreateUpdateTablePoller provides polling facilities until the operation reaches a terminal state. type TableResourcesCreateUpdateTablePoller struct { pt *azcore.Poller diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_polymorphic_helpers.go index ea0aceefd4da..9b58722addcf 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_polymorphic_helpers.go @@ -49,43 +49,21 @@ func unmarshalBackupPolicyClassificationArray(rawMsg json.RawMessage) ([]BackupP return fArray, nil } -func unmarshalServiceResourcePropertiesClassification(rawMsg json.RawMessage) (ServiceResourcePropertiesClassification, error) { +func unmarshalBackupPolicyClassificationMap(rawMsg json.RawMessage) (map[string]BackupPolicyClassification, error) { if rawMsg == nil { return nil, nil } - var m map[string]interface{} - if err := json.Unmarshal(rawMsg, &m); err != nil { - return nil, err - } - var b ServiceResourcePropertiesClassification - switch m["serviceType"] { - case string(ServiceTypeDataTransfer): - b = &DataTransferServiceResourceProperties{} - case string(ServiceTypeGraphAPICompute): - b = &GraphAPIComputeServiceResourceProperties{} - case string(ServiceTypeSQLDedicatedGateway): - b = &SQLDedicatedGatewayServiceResourceProperties{} - default: - b = &ServiceResourceProperties{} - } - return b, json.Unmarshal(rawMsg, b) -} - -func unmarshalServiceResourcePropertiesClassificationArray(rawMsg json.RawMessage) ([]ServiceResourcePropertiesClassification, error) { - if rawMsg == nil { - return nil, nil - } - var rawMessages []json.RawMessage + var rawMessages map[string]json.RawMessage if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { return nil, err } - fArray := make([]ServiceResourcePropertiesClassification, len(rawMessages)) - for index, rawMessage := range rawMessages { - f, err := unmarshalServiceResourcePropertiesClassification(rawMessage) + fMap := make(map[string]BackupPolicyClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalBackupPolicyClassification(rawMessage) if err != nil { return nil, err } - fArray[index] = f + fMap[key] = f } - return fArray, nil + return fMap, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_privateendpointconnections_client.go index 4de0952843e6..b351a3945e21 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_privateendpointconnections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. @@ -31,8 +31,15 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { - return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. @@ -96,7 +103,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -176,7 +183,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsGetResponse{}, err + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -300,7 +307,7 @@ func (client *PrivateEndpointConnectionsClient) listByDatabaseAccountCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -310,7 +317,7 @@ func (client *PrivateEndpointConnectionsClient) listByDatabaseAccountCreateReque func (client *PrivateEndpointConnectionsClient) listByDatabaseAccountHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListByDatabaseAccountResponse, error) { result := PrivateEndpointConnectionsListByDatabaseAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionsListByDatabaseAccountResponse{}, err + return PrivateEndpointConnectionsListByDatabaseAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_privatelinkresources_client.go index 59d63a32a347..ac8837c801ba 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_privatelinkresources_client.go @@ -11,13 +11,14 @@ package armcosmos import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. @@ -29,8 +30,15 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { - return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the private link resources that need to be created for a Cosmos DB account. @@ -74,7 +82,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -84,7 +92,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesGetResponse, error) { result := PrivateLinkResourcesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { - return PrivateLinkResourcesGetResponse{}, err + return PrivateLinkResourcesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -138,7 +146,7 @@ func (client *PrivateLinkResourcesClient) listByDatabaseAccountCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -148,7 +156,7 @@ func (client *PrivateLinkResourcesClient) listByDatabaseAccountCreateRequest(ctx func (client *PrivateLinkResourcesClient) listByDatabaseAccountHandleResponse(resp *http.Response) (PrivateLinkResourcesListByDatabaseAccountResponse, error) { result := PrivateLinkResourcesListByDatabaseAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { - return PrivateLinkResourcesListByDatabaseAccountResponse{}, err + return PrivateLinkResourcesListByDatabaseAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_response_types.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_response_types.go index f9a67fb3c9ac..3e3ab2751d95 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_response_types.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armcosmos import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // CassandraClustersCreateUpdatePollerResponse contains the response from method CassandraClusters.CreateUpdate. @@ -26,6 +25,8 @@ type CassandraClustersCreateUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CassandraClustersCreateUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraClustersCreateUpdateResponse, error) { respType := CassandraClustersCreateUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ClusterResource) @@ -66,18 +67,20 @@ type CassandraClustersCreateUpdateResult struct { ClusterResource } -// CassandraClustersDeletePollerResponse contains the response from method CassandraClusters.Delete. -type CassandraClustersDeletePollerResponse struct { +// CassandraClustersDeallocatePollerResponse contains the response from method CassandraClusters.Deallocate. +type CassandraClustersDeallocatePollerResponse struct { // Poller contains an initialized poller. - Poller *CassandraClustersDeletePoller + Poller *CassandraClustersDeallocatePoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l CassandraClustersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraClustersDeleteResponse, error) { - respType := CassandraClustersDeleteResponse{} +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l CassandraClustersDeallocatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraClustersDeallocateResponse, error) { + respType := CassandraClustersDeallocateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) if err != nil { return respType, err @@ -86,13 +89,13 @@ func (l CassandraClustersDeletePollerResponse) PollUntilDone(ctx context.Context return respType, nil } -// Resume rehydrates a CassandraClustersDeletePollerResponse from the provided client and resume token. -func (l *CassandraClustersDeletePollerResponse) Resume(ctx context.Context, client *CassandraClustersClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("CassandraClustersClient.Delete", token, client.pl, client.deleteHandleError) +// Resume rehydrates a CassandraClustersDeallocatePollerResponse from the provided client and resume token. +func (l *CassandraClustersDeallocatePollerResponse) Resume(ctx context.Context, client *CassandraClustersClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CassandraClustersClient.Deallocate", token, client.pl, client.deallocateHandleError) if err != nil { return err } - poller := &CassandraClustersDeletePoller{ + poller := &CassandraClustersDeallocatePoller{ pt: pt, } resp, err := poller.Poll(ctx) @@ -104,25 +107,27 @@ func (l *CassandraClustersDeletePollerResponse) Resume(ctx context.Context, clie return nil } -// CassandraClustersDeleteResponse contains the response from method CassandraClusters.Delete. -type CassandraClustersDeleteResponse struct { +// CassandraClustersDeallocateResponse contains the response from method CassandraClusters.Deallocate. +type CassandraClustersDeallocateResponse struct { // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// CassandraClustersFetchNodeStatusPollerResponse contains the response from method CassandraClusters.FetchNodeStatus. -type CassandraClustersFetchNodeStatusPollerResponse struct { +// CassandraClustersDeletePollerResponse contains the response from method CassandraClusters.Delete. +type CassandraClustersDeletePollerResponse struct { // Poller contains an initialized poller. - Poller *CassandraClustersFetchNodeStatusPoller + Poller *CassandraClustersDeletePoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l CassandraClustersFetchNodeStatusPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraClustersFetchNodeStatusResponse, error) { - respType := CassandraClustersFetchNodeStatusResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ClusterNodeStatus) +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l CassandraClustersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraClustersDeleteResponse, error) { + respType := CassandraClustersDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) if err != nil { return respType, err } @@ -130,13 +135,13 @@ func (l CassandraClustersFetchNodeStatusPollerResponse) PollUntilDone(ctx contex return respType, nil } -// Resume rehydrates a CassandraClustersFetchNodeStatusPollerResponse from the provided client and resume token. -func (l *CassandraClustersFetchNodeStatusPollerResponse) Resume(ctx context.Context, client *CassandraClustersClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("CassandraClustersClient.FetchNodeStatus", token, client.pl, client.fetchNodeStatusHandleError) +// Resume rehydrates a CassandraClustersDeletePollerResponse from the provided client and resume token. +func (l *CassandraClustersDeletePollerResponse) Resume(ctx context.Context, client *CassandraClustersClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CassandraClustersClient.Delete", token, client.pl, client.deleteHandleError) if err != nil { return err } - poller := &CassandraClustersFetchNodeStatusPoller{ + poller := &CassandraClustersDeletePoller{ pt: pt, } resp, err := poller.Poll(ctx) @@ -148,30 +153,12 @@ func (l *CassandraClustersFetchNodeStatusPollerResponse) Resume(ctx context.Cont return nil } -// CassandraClustersFetchNodeStatusResponse contains the response from method CassandraClusters.FetchNodeStatus. -type CassandraClustersFetchNodeStatusResponse struct { - CassandraClustersFetchNodeStatusResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// CassandraClustersFetchNodeStatusResult contains the result from method CassandraClusters.FetchNodeStatus. -type CassandraClustersFetchNodeStatusResult struct { - ClusterNodeStatus -} - -// CassandraClustersGetBackupResponse contains the response from method CassandraClusters.GetBackup. -type CassandraClustersGetBackupResponse struct { - CassandraClustersGetBackupResult +// CassandraClustersDeleteResponse contains the response from method CassandraClusters.Delete. +type CassandraClustersDeleteResponse struct { // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// CassandraClustersGetBackupResult contains the result from method CassandraClusters.GetBackup. -type CassandraClustersGetBackupResult struct { - BackupResource -} - // CassandraClustersGetResponse contains the response from method CassandraClusters.Get. type CassandraClustersGetResponse struct { CassandraClustersGetResult @@ -184,16 +171,56 @@ type CassandraClustersGetResult struct { ClusterResource } -// CassandraClustersListBackupsResponse contains the response from method CassandraClusters.ListBackups. -type CassandraClustersListBackupsResponse struct { - CassandraClustersListBackupsResult +// CassandraClustersInvokeCommandPollerResponse contains the response from method CassandraClusters.InvokeCommand. +type CassandraClustersInvokeCommandPollerResponse struct { + // Poller contains an initialized poller. + Poller *CassandraClustersInvokeCommandPoller + // RawResponse contains the underlying HTTP response. RawResponse *http.Response } -// CassandraClustersListBackupsResult contains the result from method CassandraClusters.ListBackups. -type CassandraClustersListBackupsResult struct { - ListBackups +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l CassandraClustersInvokeCommandPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraClustersInvokeCommandResponse, error) { + respType := CassandraClustersInvokeCommandResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CommandOutput) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a CassandraClustersInvokeCommandPollerResponse from the provided client and resume token. +func (l *CassandraClustersInvokeCommandPollerResponse) Resume(ctx context.Context, client *CassandraClustersClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CassandraClustersClient.InvokeCommand", token, client.pl, client.invokeCommandHandleError) + if err != nil { + return err + } + poller := &CassandraClustersInvokeCommandPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// CassandraClustersInvokeCommandResponse contains the response from method CassandraClusters.InvokeCommand. +type CassandraClustersInvokeCommandResponse struct { + CassandraClustersInvokeCommandResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// CassandraClustersInvokeCommandResult contains the result from method CassandraClusters.InvokeCommand. +type CassandraClustersInvokeCommandResult struct { + CommandOutput } // CassandraClustersListByResourceGroupResponse contains the response from method CassandraClusters.ListByResourceGroup. @@ -220,18 +247,20 @@ type CassandraClustersListBySubscriptionResult struct { ListClusters } -// CassandraClustersRequestRepairPollerResponse contains the response from method CassandraClusters.RequestRepair. -type CassandraClustersRequestRepairPollerResponse struct { +// CassandraClustersStartPollerResponse contains the response from method CassandraClusters.Start. +type CassandraClustersStartPollerResponse struct { // Poller contains an initialized poller. - Poller *CassandraClustersRequestRepairPoller + Poller *CassandraClustersStartPoller // RawResponse contains the underlying HTTP response. RawResponse *http.Response } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l CassandraClustersRequestRepairPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraClustersRequestRepairResponse, error) { - respType := CassandraClustersRequestRepairResponse{} +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l CassandraClustersStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraClustersStartResponse, error) { + respType := CassandraClustersStartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) if err != nil { return respType, err @@ -240,13 +269,13 @@ func (l CassandraClustersRequestRepairPollerResponse) PollUntilDone(ctx context. return respType, nil } -// Resume rehydrates a CassandraClustersRequestRepairPollerResponse from the provided client and resume token. -func (l *CassandraClustersRequestRepairPollerResponse) Resume(ctx context.Context, client *CassandraClustersClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("CassandraClustersClient.RequestRepair", token, client.pl, client.requestRepairHandleError) +// Resume rehydrates a CassandraClustersStartPollerResponse from the provided client and resume token. +func (l *CassandraClustersStartPollerResponse) Resume(ctx context.Context, client *CassandraClustersClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("CassandraClustersClient.Start", token, client.pl, client.startHandleError) if err != nil { return err } - poller := &CassandraClustersRequestRepairPoller{ + poller := &CassandraClustersStartPoller{ pt: pt, } resp, err := poller.Poll(ctx) @@ -258,12 +287,24 @@ func (l *CassandraClustersRequestRepairPollerResponse) Resume(ctx context.Contex return nil } -// CassandraClustersRequestRepairResponse contains the response from method CassandraClusters.RequestRepair. -type CassandraClustersRequestRepairResponse struct { +// CassandraClustersStartResponse contains the response from method CassandraClusters.Start. +type CassandraClustersStartResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// CassandraClustersStatusResponse contains the response from method CassandraClusters.Status. +type CassandraClustersStatusResponse struct { + CassandraClustersStatusResult // RawResponse contains the underlying HTTP response. RawResponse *http.Response } +// CassandraClustersStatusResult contains the result from method CassandraClusters.Status. +type CassandraClustersStatusResult struct { + CassandraClusterPublicStatus +} + // CassandraClustersUpdatePollerResponse contains the response from method CassandraClusters.Update. type CassandraClustersUpdatePollerResponse struct { // Poller contains an initialized poller. @@ -274,6 +315,8 @@ type CassandraClustersUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CassandraClustersUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraClustersUpdateResponse, error) { respType := CassandraClustersUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ClusterResource) @@ -324,6 +367,8 @@ type CassandraDataCentersCreateUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CassandraDataCentersCreateUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraDataCentersCreateUpdateResponse, error) { respType := CassandraDataCentersCreateUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DataCenterResource) @@ -374,6 +419,8 @@ type CassandraDataCentersDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CassandraDataCentersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraDataCentersDeleteResponse, error) { respType := CassandraDataCentersDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -442,6 +489,8 @@ type CassandraDataCentersUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CassandraDataCentersUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraDataCentersUpdateResponse, error) { respType := CassandraDataCentersUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DataCenterResource) @@ -492,6 +541,8 @@ type CassandraResourcesCreateUpdateCassandraKeyspacePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CassandraResourcesCreateUpdateCassandraKeyspacePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesCreateUpdateCassandraKeyspaceResponse, error) { respType := CassandraResourcesCreateUpdateCassandraKeyspaceResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CassandraKeyspaceGetResults) @@ -542,6 +593,8 @@ type CassandraResourcesCreateUpdateCassandraTablePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CassandraResourcesCreateUpdateCassandraTablePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesCreateUpdateCassandraTableResponse, error) { respType := CassandraResourcesCreateUpdateCassandraTableResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CassandraTableGetResults) @@ -582,56 +635,6 @@ type CassandraResourcesCreateUpdateCassandraTableResult struct { CassandraTableGetResults } -// CassandraResourcesCreateUpdateCassandraViewPollerResponse contains the response from method CassandraResources.CreateUpdateCassandraView. -type CassandraResourcesCreateUpdateCassandraViewPollerResponse struct { - // Poller contains an initialized poller. - Poller *CassandraResourcesCreateUpdateCassandraViewPoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l CassandraResourcesCreateUpdateCassandraViewPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesCreateUpdateCassandraViewResponse, error) { - respType := CassandraResourcesCreateUpdateCassandraViewResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CassandraViewGetResults) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a CassandraResourcesCreateUpdateCassandraViewPollerResponse from the provided client and resume token. -func (l *CassandraResourcesCreateUpdateCassandraViewPollerResponse) Resume(ctx context.Context, client *CassandraResourcesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("CassandraResourcesClient.CreateUpdateCassandraView", token, client.pl, client.createUpdateCassandraViewHandleError) - if err != nil { - return err - } - poller := &CassandraResourcesCreateUpdateCassandraViewPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - -// CassandraResourcesCreateUpdateCassandraViewResponse contains the response from method CassandraResources.CreateUpdateCassandraView. -type CassandraResourcesCreateUpdateCassandraViewResponse struct { - CassandraResourcesCreateUpdateCassandraViewResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// CassandraResourcesCreateUpdateCassandraViewResult contains the result from method CassandraResources.CreateUpdateCassandraView. -type CassandraResourcesCreateUpdateCassandraViewResult struct { - CassandraViewGetResults -} - // CassandraResourcesDeleteCassandraKeyspacePollerResponse contains the response from method CassandraResources.DeleteCassandraKeyspace. type CassandraResourcesDeleteCassandraKeyspacePollerResponse struct { // Poller contains an initialized poller. @@ -642,6 +645,8 @@ type CassandraResourcesDeleteCassandraKeyspacePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CassandraResourcesDeleteCassandraKeyspacePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesDeleteCassandraKeyspaceResponse, error) { respType := CassandraResourcesDeleteCassandraKeyspaceResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -686,6 +691,8 @@ type CassandraResourcesDeleteCassandraTablePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CassandraResourcesDeleteCassandraTablePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesDeleteCassandraTableResponse, error) { respType := CassandraResourcesDeleteCassandraTableResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -720,50 +727,6 @@ type CassandraResourcesDeleteCassandraTableResponse struct { RawResponse *http.Response } -// CassandraResourcesDeleteCassandraViewPollerResponse contains the response from method CassandraResources.DeleteCassandraView. -type CassandraResourcesDeleteCassandraViewPollerResponse struct { - // Poller contains an initialized poller. - Poller *CassandraResourcesDeleteCassandraViewPoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l CassandraResourcesDeleteCassandraViewPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesDeleteCassandraViewResponse, error) { - respType := CassandraResourcesDeleteCassandraViewResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a CassandraResourcesDeleteCassandraViewPollerResponse from the provided client and resume token. -func (l *CassandraResourcesDeleteCassandraViewPollerResponse) Resume(ctx context.Context, client *CassandraResourcesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("CassandraResourcesClient.DeleteCassandraView", token, client.pl, client.deleteCassandraViewHandleError) - if err != nil { - return err - } - poller := &CassandraResourcesDeleteCassandraViewPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - -// CassandraResourcesDeleteCassandraViewResponse contains the response from method CassandraResources.DeleteCassandraView. -type CassandraResourcesDeleteCassandraViewResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - // CassandraResourcesGetCassandraKeyspaceResponse contains the response from method CassandraResources.GetCassandraKeyspace. type CassandraResourcesGetCassandraKeyspaceResponse struct { CassandraResourcesGetCassandraKeyspaceResult @@ -812,30 +775,6 @@ type CassandraResourcesGetCassandraTableThroughputResult struct { ThroughputSettingsGetResults } -// CassandraResourcesGetCassandraViewResponse contains the response from method CassandraResources.GetCassandraView. -type CassandraResourcesGetCassandraViewResponse struct { - CassandraResourcesGetCassandraViewResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// CassandraResourcesGetCassandraViewResult contains the result from method CassandraResources.GetCassandraView. -type CassandraResourcesGetCassandraViewResult struct { - CassandraViewGetResults -} - -// CassandraResourcesGetCassandraViewThroughputResponse contains the response from method CassandraResources.GetCassandraViewThroughput. -type CassandraResourcesGetCassandraViewThroughputResponse struct { - CassandraResourcesGetCassandraViewThroughputResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// CassandraResourcesGetCassandraViewThroughputResult contains the result from method CassandraResources.GetCassandraViewThroughput. -type CassandraResourcesGetCassandraViewThroughputResult struct { - ThroughputSettingsGetResults -} - // CassandraResourcesListCassandraKeyspacesResponse contains the response from method CassandraResources.ListCassandraKeyspaces. type CassandraResourcesListCassandraKeyspacesResponse struct { CassandraResourcesListCassandraKeyspacesResult @@ -860,18 +799,6 @@ type CassandraResourcesListCassandraTablesResult struct { CassandraTableListResult } -// CassandraResourcesListCassandraViewsResponse contains the response from method CassandraResources.ListCassandraViews. -type CassandraResourcesListCassandraViewsResponse struct { - CassandraResourcesListCassandraViewsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// CassandraResourcesListCassandraViewsResult contains the result from method CassandraResources.ListCassandraViews. -type CassandraResourcesListCassandraViewsResult struct { - CassandraViewListResult -} - // CassandraResourcesMigrateCassandraKeyspaceToAutoscalePollerResponse contains the response from method CassandraResources.MigrateCassandraKeyspaceToAutoscale. type CassandraResourcesMigrateCassandraKeyspaceToAutoscalePollerResponse struct { // Poller contains an initialized poller. @@ -882,6 +809,8 @@ type CassandraResourcesMigrateCassandraKeyspaceToAutoscalePollerResponse struct } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CassandraResourcesMigrateCassandraKeyspaceToAutoscalePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesMigrateCassandraKeyspaceToAutoscaleResponse, error) { respType := CassandraResourcesMigrateCassandraKeyspaceToAutoscaleResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -932,6 +861,8 @@ type CassandraResourcesMigrateCassandraKeyspaceToManualThroughputPollerResponse } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CassandraResourcesMigrateCassandraKeyspaceToManualThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesMigrateCassandraKeyspaceToManualThroughputResponse, error) { respType := CassandraResourcesMigrateCassandraKeyspaceToManualThroughputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -982,6 +913,8 @@ type CassandraResourcesMigrateCassandraTableToAutoscalePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CassandraResourcesMigrateCassandraTableToAutoscalePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesMigrateCassandraTableToAutoscaleResponse, error) { respType := CassandraResourcesMigrateCassandraTableToAutoscaleResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -1032,6 +965,8 @@ type CassandraResourcesMigrateCassandraTableToManualThroughputPollerResponse str } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CassandraResourcesMigrateCassandraTableToManualThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesMigrateCassandraTableToManualThroughputResponse, error) { respType := CassandraResourcesMigrateCassandraTableToManualThroughputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -1072,106 +1007,6 @@ type CassandraResourcesMigrateCassandraTableToManualThroughputResult struct { ThroughputSettingsGetResults } -// CassandraResourcesMigrateCassandraViewToAutoscalePollerResponse contains the response from method CassandraResources.MigrateCassandraViewToAutoscale. -type CassandraResourcesMigrateCassandraViewToAutoscalePollerResponse struct { - // Poller contains an initialized poller. - Poller *CassandraResourcesMigrateCassandraViewToAutoscalePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l CassandraResourcesMigrateCassandraViewToAutoscalePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesMigrateCassandraViewToAutoscaleResponse, error) { - respType := CassandraResourcesMigrateCassandraViewToAutoscaleResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a CassandraResourcesMigrateCassandraViewToAutoscalePollerResponse from the provided client and resume token. -func (l *CassandraResourcesMigrateCassandraViewToAutoscalePollerResponse) Resume(ctx context.Context, client *CassandraResourcesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("CassandraResourcesClient.MigrateCassandraViewToAutoscale", token, client.pl, client.migrateCassandraViewToAutoscaleHandleError) - if err != nil { - return err - } - poller := &CassandraResourcesMigrateCassandraViewToAutoscalePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - -// CassandraResourcesMigrateCassandraViewToAutoscaleResponse contains the response from method CassandraResources.MigrateCassandraViewToAutoscale. -type CassandraResourcesMigrateCassandraViewToAutoscaleResponse struct { - CassandraResourcesMigrateCassandraViewToAutoscaleResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// CassandraResourcesMigrateCassandraViewToAutoscaleResult contains the result from method CassandraResources.MigrateCassandraViewToAutoscale. -type CassandraResourcesMigrateCassandraViewToAutoscaleResult struct { - ThroughputSettingsGetResults -} - -// CassandraResourcesMigrateCassandraViewToManualThroughputPollerResponse contains the response from method CassandraResources.MigrateCassandraViewToManualThroughput. -type CassandraResourcesMigrateCassandraViewToManualThroughputPollerResponse struct { - // Poller contains an initialized poller. - Poller *CassandraResourcesMigrateCassandraViewToManualThroughputPoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l CassandraResourcesMigrateCassandraViewToManualThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesMigrateCassandraViewToManualThroughputResponse, error) { - respType := CassandraResourcesMigrateCassandraViewToManualThroughputResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a CassandraResourcesMigrateCassandraViewToManualThroughputPollerResponse from the provided client and resume token. -func (l *CassandraResourcesMigrateCassandraViewToManualThroughputPollerResponse) Resume(ctx context.Context, client *CassandraResourcesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("CassandraResourcesClient.MigrateCassandraViewToManualThroughput", token, client.pl, client.migrateCassandraViewToManualThroughputHandleError) - if err != nil { - return err - } - poller := &CassandraResourcesMigrateCassandraViewToManualThroughputPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - -// CassandraResourcesMigrateCassandraViewToManualThroughputResponse contains the response from method CassandraResources.MigrateCassandraViewToManualThroughput. -type CassandraResourcesMigrateCassandraViewToManualThroughputResponse struct { - CassandraResourcesMigrateCassandraViewToManualThroughputResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// CassandraResourcesMigrateCassandraViewToManualThroughputResult contains the result from method CassandraResources.MigrateCassandraViewToManualThroughput. -type CassandraResourcesMigrateCassandraViewToManualThroughputResult struct { - ThroughputSettingsGetResults -} - // CassandraResourcesUpdateCassandraKeyspaceThroughputPollerResponse contains the response from method CassandraResources.UpdateCassandraKeyspaceThroughput. type CassandraResourcesUpdateCassandraKeyspaceThroughputPollerResponse struct { // Poller contains an initialized poller. @@ -1182,6 +1017,8 @@ type CassandraResourcesUpdateCassandraKeyspaceThroughputPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CassandraResourcesUpdateCassandraKeyspaceThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesUpdateCassandraKeyspaceThroughputResponse, error) { respType := CassandraResourcesUpdateCassandraKeyspaceThroughputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -1232,6 +1069,8 @@ type CassandraResourcesUpdateCassandraTableThroughputPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CassandraResourcesUpdateCassandraTableThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesUpdateCassandraTableThroughputResponse, error) { respType := CassandraResourcesUpdateCassandraTableThroughputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -1272,56 +1111,6 @@ type CassandraResourcesUpdateCassandraTableThroughputResult struct { ThroughputSettingsGetResults } -// CassandraResourcesUpdateCassandraViewThroughputPollerResponse contains the response from method CassandraResources.UpdateCassandraViewThroughput. -type CassandraResourcesUpdateCassandraViewThroughputPollerResponse struct { - // Poller contains an initialized poller. - Poller *CassandraResourcesUpdateCassandraViewThroughputPoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l CassandraResourcesUpdateCassandraViewThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CassandraResourcesUpdateCassandraViewThroughputResponse, error) { - respType := CassandraResourcesUpdateCassandraViewThroughputResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a CassandraResourcesUpdateCassandraViewThroughputPollerResponse from the provided client and resume token. -func (l *CassandraResourcesUpdateCassandraViewThroughputPollerResponse) Resume(ctx context.Context, client *CassandraResourcesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("CassandraResourcesClient.UpdateCassandraViewThroughput", token, client.pl, client.updateCassandraViewThroughputHandleError) - if err != nil { - return err - } - poller := &CassandraResourcesUpdateCassandraViewThroughputPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - -// CassandraResourcesUpdateCassandraViewThroughputResponse contains the response from method CassandraResources.UpdateCassandraViewThroughput. -type CassandraResourcesUpdateCassandraViewThroughputResponse struct { - CassandraResourcesUpdateCassandraViewThroughputResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// CassandraResourcesUpdateCassandraViewThroughputResult contains the result from method CassandraResources.UpdateCassandraViewThroughput. -type CassandraResourcesUpdateCassandraViewThroughputResult struct { - ThroughputSettingsGetResults -} - // CollectionListMetricDefinitionsResponse contains the response from method Collection.ListMetricDefinitions. type CollectionListMetricDefinitionsResponse struct { CollectionListMetricDefinitionsResult @@ -1406,30 +1195,6 @@ type CollectionRegionListMetricsResult struct { MetricListResult } -// CosmosDBManagementClientLocationGetResponse contains the response from method CosmosDBManagementClient.LocationGet. -type CosmosDBManagementClientLocationGetResponse struct { - CosmosDBManagementClientLocationGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// CosmosDBManagementClientLocationGetResult contains the result from method CosmosDBManagementClient.LocationGet. -type CosmosDBManagementClientLocationGetResult struct { - LocationGetResult -} - -// CosmosDBManagementClientLocationListResponse contains the response from method CosmosDBManagementClient.LocationList. -type CosmosDBManagementClientLocationListResponse struct { - CosmosDBManagementClientLocationListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// CosmosDBManagementClientLocationListResult contains the result from method CosmosDBManagementClient.LocationList. -type CosmosDBManagementClientLocationListResult struct { - LocationListResult -} - // DatabaseAccountRegionListMetricsResponse contains the response from method DatabaseAccountRegion.ListMetrics. type DatabaseAccountRegionListMetricsResponse struct { DatabaseAccountRegionListMetricsResult @@ -1465,6 +1230,8 @@ type DatabaseAccountsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabaseAccountsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabaseAccountsCreateOrUpdateResponse, error) { respType := DatabaseAccountsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DatabaseAccountGetResults) @@ -1515,6 +1282,8 @@ type DatabaseAccountsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabaseAccountsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabaseAccountsDeleteResponse, error) { respType := DatabaseAccountsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1559,6 +1328,8 @@ type DatabaseAccountsFailoverPriorityChangePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabaseAccountsFailoverPriorityChangePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabaseAccountsFailoverPriorityChangeResponse, error) { respType := DatabaseAccountsFailoverPriorityChangeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1723,6 +1494,8 @@ type DatabaseAccountsOfflineRegionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabaseAccountsOfflineRegionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabaseAccountsOfflineRegionResponse, error) { respType := DatabaseAccountsOfflineRegionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1767,6 +1540,8 @@ type DatabaseAccountsOnlineRegionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabaseAccountsOnlineRegionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabaseAccountsOnlineRegionResponse, error) { respType := DatabaseAccountsOnlineRegionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1811,6 +1586,8 @@ type DatabaseAccountsRegenerateKeyPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabaseAccountsRegenerateKeyPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabaseAccountsRegenerateKeyResponse, error) { respType := DatabaseAccountsRegenerateKeyResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1855,6 +1632,8 @@ type DatabaseAccountsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabaseAccountsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabaseAccountsUpdateResponse, error) { respType := DatabaseAccountsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DatabaseAccountGetResults) @@ -1931,124 +1710,6 @@ type DatabaseListUsagesResult struct { UsagesResult } -// GraphResourcesCreateUpdateGraphPollerResponse contains the response from method GraphResources.CreateUpdateGraph. -type GraphResourcesCreateUpdateGraphPollerResponse struct { - // Poller contains an initialized poller. - Poller *GraphResourcesCreateUpdateGraphPoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l GraphResourcesCreateUpdateGraphPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GraphResourcesCreateUpdateGraphResponse, error) { - respType := GraphResourcesCreateUpdateGraphResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GraphResourceGetResults) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a GraphResourcesCreateUpdateGraphPollerResponse from the provided client and resume token. -func (l *GraphResourcesCreateUpdateGraphPollerResponse) Resume(ctx context.Context, client *GraphResourcesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("GraphResourcesClient.CreateUpdateGraph", token, client.pl, client.createUpdateGraphHandleError) - if err != nil { - return err - } - poller := &GraphResourcesCreateUpdateGraphPoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - -// GraphResourcesCreateUpdateGraphResponse contains the response from method GraphResources.CreateUpdateGraph. -type GraphResourcesCreateUpdateGraphResponse struct { - GraphResourcesCreateUpdateGraphResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// GraphResourcesCreateUpdateGraphResult contains the result from method GraphResources.CreateUpdateGraph. -type GraphResourcesCreateUpdateGraphResult struct { - GraphResourceGetResults -} - -// GraphResourcesDeleteGraphResourcePollerResponse contains the response from method GraphResources.DeleteGraphResource. -type GraphResourcesDeleteGraphResourcePollerResponse struct { - // Poller contains an initialized poller. - Poller *GraphResourcesDeleteGraphResourcePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l GraphResourcesDeleteGraphResourcePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GraphResourcesDeleteGraphResourceResponse, error) { - respType := GraphResourcesDeleteGraphResourceResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a GraphResourcesDeleteGraphResourcePollerResponse from the provided client and resume token. -func (l *GraphResourcesDeleteGraphResourcePollerResponse) Resume(ctx context.Context, client *GraphResourcesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("GraphResourcesClient.DeleteGraphResource", token, client.pl, client.deleteGraphResourceHandleError) - if err != nil { - return err - } - poller := &GraphResourcesDeleteGraphResourcePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - -// GraphResourcesDeleteGraphResourceResponse contains the response from method GraphResources.DeleteGraphResource. -type GraphResourcesDeleteGraphResourceResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// GraphResourcesGetGraphResponse contains the response from method GraphResources.GetGraph. -type GraphResourcesGetGraphResponse struct { - GraphResourcesGetGraphResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// GraphResourcesGetGraphResult contains the result from method GraphResources.GetGraph. -type GraphResourcesGetGraphResult struct { - GraphResourceGetResults -} - -// GraphResourcesListGraphsResponse contains the response from method GraphResources.ListGraphs. -type GraphResourcesListGraphsResponse struct { - GraphResourcesListGraphsResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// GraphResourcesListGraphsResult contains the result from method GraphResources.ListGraphs. -type GraphResourcesListGraphsResult struct { - GraphResourcesListResult -} - // GremlinResourcesCreateUpdateGremlinDatabasePollerResponse contains the response from method GremlinResources.CreateUpdateGremlinDatabase. type GremlinResourcesCreateUpdateGremlinDatabasePollerResponse struct { // Poller contains an initialized poller. @@ -2059,6 +1720,8 @@ type GremlinResourcesCreateUpdateGremlinDatabasePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GremlinResourcesCreateUpdateGremlinDatabasePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GremlinResourcesCreateUpdateGremlinDatabaseResponse, error) { respType := GremlinResourcesCreateUpdateGremlinDatabaseResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GremlinDatabaseGetResults) @@ -2109,6 +1772,8 @@ type GremlinResourcesCreateUpdateGremlinGraphPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GremlinResourcesCreateUpdateGremlinGraphPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GremlinResourcesCreateUpdateGremlinGraphResponse, error) { respType := GremlinResourcesCreateUpdateGremlinGraphResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GremlinGraphGetResults) @@ -2159,6 +1824,8 @@ type GremlinResourcesDeleteGremlinDatabasePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GremlinResourcesDeleteGremlinDatabasePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GremlinResourcesDeleteGremlinDatabaseResponse, error) { respType := GremlinResourcesDeleteGremlinDatabaseResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2203,6 +1870,8 @@ type GremlinResourcesDeleteGremlinGraphPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GremlinResourcesDeleteGremlinGraphPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GremlinResourcesDeleteGremlinGraphResponse, error) { respType := GremlinResourcesDeleteGremlinGraphResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2319,6 +1988,8 @@ type GremlinResourcesMigrateGremlinDatabaseToAutoscalePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GremlinResourcesMigrateGremlinDatabaseToAutoscalePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GremlinResourcesMigrateGremlinDatabaseToAutoscaleResponse, error) { respType := GremlinResourcesMigrateGremlinDatabaseToAutoscaleResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -2369,6 +2040,8 @@ type GremlinResourcesMigrateGremlinDatabaseToManualThroughputPollerResponse stru } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GremlinResourcesMigrateGremlinDatabaseToManualThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GremlinResourcesMigrateGremlinDatabaseToManualThroughputResponse, error) { respType := GremlinResourcesMigrateGremlinDatabaseToManualThroughputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -2419,6 +2092,8 @@ type GremlinResourcesMigrateGremlinGraphToAutoscalePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GremlinResourcesMigrateGremlinGraphToAutoscalePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GremlinResourcesMigrateGremlinGraphToAutoscaleResponse, error) { respType := GremlinResourcesMigrateGremlinGraphToAutoscaleResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -2469,6 +2144,8 @@ type GremlinResourcesMigrateGremlinGraphToManualThroughputPollerResponse struct } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GremlinResourcesMigrateGremlinGraphToManualThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GremlinResourcesMigrateGremlinGraphToManualThroughputResponse, error) { respType := GremlinResourcesMigrateGremlinGraphToManualThroughputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -2519,6 +2196,8 @@ type GremlinResourcesUpdateGremlinDatabaseThroughputPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GremlinResourcesUpdateGremlinDatabaseThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GremlinResourcesUpdateGremlinDatabaseThroughputResponse, error) { respType := GremlinResourcesUpdateGremlinDatabaseThroughputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -2569,6 +2248,8 @@ type GremlinResourcesUpdateGremlinGraphThroughputPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l GremlinResourcesUpdateGremlinGraphThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (GremlinResourcesUpdateGremlinGraphThroughputResponse, error) { respType := GremlinResourcesUpdateGremlinGraphThroughputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -2609,6 +2290,30 @@ type GremlinResourcesUpdateGremlinGraphThroughputResult struct { ThroughputSettingsGetResults } +// LocationsGetResponse contains the response from method Locations.Get. +type LocationsGetResponse struct { + LocationsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LocationsGetResult contains the result from method Locations.Get. +type LocationsGetResult struct { + LocationGetResult +} + +// LocationsListResponse contains the response from method Locations.List. +type LocationsListResponse struct { + LocationsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LocationsListResult contains the result from method Locations.List. +type LocationsListResult struct { + LocationListResult +} + // MongoDBResourcesCreateUpdateMongoDBCollectionPollerResponse contains the response from method MongoDBResources.CreateUpdateMongoDBCollection. type MongoDBResourcesCreateUpdateMongoDBCollectionPollerResponse struct { // Poller contains an initialized poller. @@ -2619,6 +2324,8 @@ type MongoDBResourcesCreateUpdateMongoDBCollectionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l MongoDBResourcesCreateUpdateMongoDBCollectionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MongoDBResourcesCreateUpdateMongoDBCollectionResponse, error) { respType := MongoDBResourcesCreateUpdateMongoDBCollectionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.MongoDBCollectionGetResults) @@ -2669,6 +2376,8 @@ type MongoDBResourcesCreateUpdateMongoDBDatabasePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l MongoDBResourcesCreateUpdateMongoDBDatabasePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MongoDBResourcesCreateUpdateMongoDBDatabaseResponse, error) { respType := MongoDBResourcesCreateUpdateMongoDBDatabaseResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.MongoDBDatabaseGetResults) @@ -2719,6 +2428,8 @@ type MongoDBResourcesDeleteMongoDBCollectionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l MongoDBResourcesDeleteMongoDBCollectionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MongoDBResourcesDeleteMongoDBCollectionResponse, error) { respType := MongoDBResourcesDeleteMongoDBCollectionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2763,6 +2474,8 @@ type MongoDBResourcesDeleteMongoDBDatabasePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l MongoDBResourcesDeleteMongoDBDatabasePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MongoDBResourcesDeleteMongoDBDatabaseResponse, error) { respType := MongoDBResourcesDeleteMongoDBDatabaseResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2879,6 +2592,8 @@ type MongoDBResourcesMigrateMongoDBCollectionToAutoscalePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l MongoDBResourcesMigrateMongoDBCollectionToAutoscalePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MongoDBResourcesMigrateMongoDBCollectionToAutoscaleResponse, error) { respType := MongoDBResourcesMigrateMongoDBCollectionToAutoscaleResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -2929,6 +2644,8 @@ type MongoDBResourcesMigrateMongoDBCollectionToManualThroughputPollerResponse st } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l MongoDBResourcesMigrateMongoDBCollectionToManualThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MongoDBResourcesMigrateMongoDBCollectionToManualThroughputResponse, error) { respType := MongoDBResourcesMigrateMongoDBCollectionToManualThroughputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -2979,6 +2696,8 @@ type MongoDBResourcesMigrateMongoDBDatabaseToAutoscalePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l MongoDBResourcesMigrateMongoDBDatabaseToAutoscalePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleResponse, error) { respType := MongoDBResourcesMigrateMongoDBDatabaseToAutoscaleResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -3029,6 +2748,8 @@ type MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputPollerResponse stru } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputResponse, error) { respType := MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -3069,6 +2790,58 @@ type MongoDBResourcesMigrateMongoDBDatabaseToManualThroughputResult struct { ThroughputSettingsGetResults } +// MongoDBResourcesRetrieveContinuousBackupInformationPollerResponse contains the response from method MongoDBResources.RetrieveContinuousBackupInformation. +type MongoDBResourcesRetrieveContinuousBackupInformationPollerResponse struct { + // Poller contains an initialized poller. + Poller *MongoDBResourcesRetrieveContinuousBackupInformationPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l MongoDBResourcesRetrieveContinuousBackupInformationPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MongoDBResourcesRetrieveContinuousBackupInformationResponse, error) { + respType := MongoDBResourcesRetrieveContinuousBackupInformationResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.BackupInformation) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a MongoDBResourcesRetrieveContinuousBackupInformationPollerResponse from the provided client and resume token. +func (l *MongoDBResourcesRetrieveContinuousBackupInformationPollerResponse) Resume(ctx context.Context, client *MongoDBResourcesClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("MongoDBResourcesClient.RetrieveContinuousBackupInformation", token, client.pl, client.retrieveContinuousBackupInformationHandleError) + if err != nil { + return err + } + poller := &MongoDBResourcesRetrieveContinuousBackupInformationPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// MongoDBResourcesRetrieveContinuousBackupInformationResponse contains the response from method MongoDBResources.RetrieveContinuousBackupInformation. +type MongoDBResourcesRetrieveContinuousBackupInformationResponse struct { + MongoDBResourcesRetrieveContinuousBackupInformationResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MongoDBResourcesRetrieveContinuousBackupInformationResult contains the result from method MongoDBResources.RetrieveContinuousBackupInformation. +type MongoDBResourcesRetrieveContinuousBackupInformationResult struct { + BackupInformation +} + // MongoDBResourcesUpdateMongoDBCollectionThroughputPollerResponse contains the response from method MongoDBResources.UpdateMongoDBCollectionThroughput. type MongoDBResourcesUpdateMongoDBCollectionThroughputPollerResponse struct { // Poller contains an initialized poller. @@ -3079,6 +2852,8 @@ type MongoDBResourcesUpdateMongoDBCollectionThroughputPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l MongoDBResourcesUpdateMongoDBCollectionThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MongoDBResourcesUpdateMongoDBCollectionThroughputResponse, error) { respType := MongoDBResourcesUpdateMongoDBCollectionThroughputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -3129,6 +2904,8 @@ type MongoDBResourcesUpdateMongoDBDatabaseThroughputPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l MongoDBResourcesUpdateMongoDBDatabaseThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MongoDBResourcesUpdateMongoDBDatabaseThroughputResponse, error) { respType := MongoDBResourcesUpdateMongoDBDatabaseThroughputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -3179,6 +2956,8 @@ type NotebookWorkspacesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NotebookWorkspacesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NotebookWorkspacesCreateOrUpdateResponse, error) { respType := NotebookWorkspacesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.NotebookWorkspace) @@ -3229,6 +3008,8 @@ type NotebookWorkspacesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NotebookWorkspacesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NotebookWorkspacesDeleteResponse, error) { respType := NotebookWorkspacesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3309,6 +3090,8 @@ type NotebookWorkspacesRegenerateAuthTokenPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NotebookWorkspacesRegenerateAuthTokenPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NotebookWorkspacesRegenerateAuthTokenResponse, error) { respType := NotebookWorkspacesRegenerateAuthTokenResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3353,6 +3136,8 @@ type NotebookWorkspacesStartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NotebookWorkspacesStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NotebookWorkspacesStartResponse, error) { respType := NotebookWorkspacesStartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3469,6 +3254,8 @@ type PrivateEndpointConnectionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsCreateOrUpdateResponse, error) { respType := PrivateEndpointConnectionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) @@ -3519,6 +3306,8 @@ type PrivateEndpointConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsDeleteResponse, error) { respType := PrivateEndpointConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3719,6 +3508,8 @@ type SQLResourcesCreateUpdateSQLContainerPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesCreateUpdateSQLContainerPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesCreateUpdateSQLContainerResponse, error) { respType := SQLResourcesCreateUpdateSQLContainerResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SQLContainerGetResults) @@ -3769,6 +3560,8 @@ type SQLResourcesCreateUpdateSQLDatabasePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesCreateUpdateSQLDatabasePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesCreateUpdateSQLDatabaseResponse, error) { respType := SQLResourcesCreateUpdateSQLDatabaseResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SQLDatabaseGetResults) @@ -3819,6 +3612,8 @@ type SQLResourcesCreateUpdateSQLRoleAssignmentPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesCreateUpdateSQLRoleAssignmentPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesCreateUpdateSQLRoleAssignmentResponse, error) { respType := SQLResourcesCreateUpdateSQLRoleAssignmentResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SQLRoleAssignmentGetResults) @@ -3869,6 +3664,8 @@ type SQLResourcesCreateUpdateSQLRoleDefinitionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesCreateUpdateSQLRoleDefinitionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesCreateUpdateSQLRoleDefinitionResponse, error) { respType := SQLResourcesCreateUpdateSQLRoleDefinitionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SQLRoleDefinitionGetResults) @@ -3919,6 +3716,8 @@ type SQLResourcesCreateUpdateSQLStoredProcedurePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesCreateUpdateSQLStoredProcedurePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesCreateUpdateSQLStoredProcedureResponse, error) { respType := SQLResourcesCreateUpdateSQLStoredProcedureResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SQLStoredProcedureGetResults) @@ -3969,6 +3768,8 @@ type SQLResourcesCreateUpdateSQLTriggerPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesCreateUpdateSQLTriggerPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesCreateUpdateSQLTriggerResponse, error) { respType := SQLResourcesCreateUpdateSQLTriggerResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SQLTriggerGetResults) @@ -4019,6 +3820,8 @@ type SQLResourcesCreateUpdateSQLUserDefinedFunctionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesCreateUpdateSQLUserDefinedFunctionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesCreateUpdateSQLUserDefinedFunctionResponse, error) { respType := SQLResourcesCreateUpdateSQLUserDefinedFunctionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SQLUserDefinedFunctionGetResults) @@ -4069,6 +3872,8 @@ type SQLResourcesDeleteSQLContainerPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesDeleteSQLContainerPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesDeleteSQLContainerResponse, error) { respType := SQLResourcesDeleteSQLContainerResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4113,6 +3918,8 @@ type SQLResourcesDeleteSQLDatabasePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesDeleteSQLDatabasePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesDeleteSQLDatabaseResponse, error) { respType := SQLResourcesDeleteSQLDatabaseResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4157,6 +3964,8 @@ type SQLResourcesDeleteSQLRoleAssignmentPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesDeleteSQLRoleAssignmentPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesDeleteSQLRoleAssignmentResponse, error) { respType := SQLResourcesDeleteSQLRoleAssignmentResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4201,6 +4010,8 @@ type SQLResourcesDeleteSQLRoleDefinitionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesDeleteSQLRoleDefinitionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesDeleteSQLRoleDefinitionResponse, error) { respType := SQLResourcesDeleteSQLRoleDefinitionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4245,6 +4056,8 @@ type SQLResourcesDeleteSQLStoredProcedurePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesDeleteSQLStoredProcedurePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesDeleteSQLStoredProcedureResponse, error) { respType := SQLResourcesDeleteSQLStoredProcedureResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4289,6 +4102,8 @@ type SQLResourcesDeleteSQLTriggerPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesDeleteSQLTriggerPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesDeleteSQLTriggerResponse, error) { respType := SQLResourcesDeleteSQLTriggerResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4333,6 +4148,8 @@ type SQLResourcesDeleteSQLUserDefinedFunctionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesDeleteSQLUserDefinedFunctionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesDeleteSQLUserDefinedFunctionResponse, error) { respType := SQLResourcesDeleteSQLUserDefinedFunctionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4569,6 +4386,8 @@ type SQLResourcesMigrateSQLContainerToAutoscalePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesMigrateSQLContainerToAutoscalePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesMigrateSQLContainerToAutoscaleResponse, error) { respType := SQLResourcesMigrateSQLContainerToAutoscaleResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -4619,6 +4438,8 @@ type SQLResourcesMigrateSQLContainerToManualThroughputPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesMigrateSQLContainerToManualThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesMigrateSQLContainerToManualThroughputResponse, error) { respType := SQLResourcesMigrateSQLContainerToManualThroughputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -4669,6 +4490,8 @@ type SQLResourcesMigrateSQLDatabaseToAutoscalePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesMigrateSQLDatabaseToAutoscalePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesMigrateSQLDatabaseToAutoscaleResponse, error) { respType := SQLResourcesMigrateSQLDatabaseToAutoscaleResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -4719,6 +4542,8 @@ type SQLResourcesMigrateSQLDatabaseToManualThroughputPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesMigrateSQLDatabaseToManualThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesMigrateSQLDatabaseToManualThroughputResponse, error) { respType := SQLResourcesMigrateSQLDatabaseToManualThroughputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -4769,6 +4594,8 @@ type SQLResourcesRetrieveContinuousBackupInformationPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesRetrieveContinuousBackupInformationPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesRetrieveContinuousBackupInformationResponse, error) { respType := SQLResourcesRetrieveContinuousBackupInformationResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.BackupInformation) @@ -4819,6 +4646,8 @@ type SQLResourcesUpdateSQLContainerThroughputPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesUpdateSQLContainerThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesUpdateSQLContainerThroughputResponse, error) { respType := SQLResourcesUpdateSQLContainerThroughputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -4869,6 +4698,8 @@ type SQLResourcesUpdateSQLDatabaseThroughputPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SQLResourcesUpdateSQLDatabaseThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SQLResourcesUpdateSQLDatabaseThroughputResponse, error) { respType := SQLResourcesUpdateSQLDatabaseThroughputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -4909,124 +4740,6 @@ type SQLResourcesUpdateSQLDatabaseThroughputResult struct { ThroughputSettingsGetResults } -// ServiceCreatePollerResponse contains the response from method Service.Create. -type ServiceCreatePollerResponse struct { - // Poller contains an initialized poller. - Poller *ServiceCreatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l ServiceCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServiceCreateResponse, error) { - respType := ServiceCreateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServiceResource) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ServiceCreatePollerResponse from the provided client and resume token. -func (l *ServiceCreatePollerResponse) Resume(ctx context.Context, client *ServiceClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ServiceClient.Create", token, client.pl, client.createHandleError) - if err != nil { - return err - } - poller := &ServiceCreatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - -// ServiceCreateResponse contains the response from method Service.Create. -type ServiceCreateResponse struct { - ServiceCreateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServiceCreateResult contains the result from method Service.Create. -type ServiceCreateResult struct { - ServiceResource -} - -// ServiceDeletePollerResponse contains the response from method Service.Delete. -type ServiceDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *ServiceDeletePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l ServiceDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServiceDeleteResponse, error) { - respType := ServiceDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a ServiceDeletePollerResponse from the provided client and resume token. -func (l *ServiceDeletePollerResponse) Resume(ctx context.Context, client *ServiceClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("ServiceClient.Delete", token, client.pl, client.deleteHandleError) - if err != nil { - return err - } - poller := &ServiceDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - -// ServiceDeleteResponse contains the response from method Service.Delete. -type ServiceDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServiceGetResponse contains the response from method Service.Get. -type ServiceGetResponse struct { - ServiceGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServiceGetResult contains the result from method Service.Get. -type ServiceGetResult struct { - ServiceResource -} - -// ServiceListResponse contains the response from method Service.List. -type ServiceListResponse struct { - ServiceListResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// ServiceListResult contains the result from method Service.List. -type ServiceListResult struct { - ServiceResourceListResult -} - // TableResourcesCreateUpdateTablePollerResponse contains the response from method TableResources.CreateUpdateTable. type TableResourcesCreateUpdateTablePollerResponse struct { // Poller contains an initialized poller. @@ -5037,6 +4750,8 @@ type TableResourcesCreateUpdateTablePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TableResourcesCreateUpdateTablePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TableResourcesCreateUpdateTableResponse, error) { respType := TableResourcesCreateUpdateTableResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.TableGetResults) @@ -5087,6 +4802,8 @@ type TableResourcesDeleteTablePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TableResourcesDeleteTablePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TableResourcesDeleteTableResponse, error) { respType := TableResourcesDeleteTableResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5167,6 +4884,8 @@ type TableResourcesMigrateTableToAutoscalePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TableResourcesMigrateTableToAutoscalePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TableResourcesMigrateTableToAutoscaleResponse, error) { respType := TableResourcesMigrateTableToAutoscaleResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -5217,6 +4936,8 @@ type TableResourcesMigrateTableToManualThroughputPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TableResourcesMigrateTableToManualThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TableResourcesMigrateTableToManualThroughputResponse, error) { respType := TableResourcesMigrateTableToManualThroughputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) @@ -5267,6 +4988,8 @@ type TableResourcesUpdateTableThroughputPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TableResourcesUpdateTableThroughputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TableResourcesUpdateTableThroughputResponse, error) { respType := TableResourcesUpdateTableThroughputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ThroughputSettingsGetResults) diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorabledatabaseaccounts_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorabledatabaseaccounts_client.go index 75081264597e..5c0f3f02359a 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorabledatabaseaccounts_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorabledatabaseaccounts_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RestorableDatabaseAccountsClient contains the methods for the RestorableDatabaseAccounts group. @@ -30,8 +31,15 @@ type RestorableDatabaseAccountsClient struct { } // NewRestorableDatabaseAccountsClient creates a new instance of RestorableDatabaseAccountsClient with the specified values. -func NewRestorableDatabaseAccountsClient(con *arm.Connection, subscriptionID string) *RestorableDatabaseAccountsClient { - return &RestorableDatabaseAccountsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRestorableDatabaseAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RestorableDatabaseAccountsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RestorableDatabaseAccountsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetByLocation - Retrieves the properties of an existing Azure Cosmos DB restorable database account. This call requires 'Microsoft.DocumentDB/locations/restorableDatabaseAccounts/read/*' @@ -72,7 +80,7 @@ func (client *RestorableDatabaseAccountsClient) getByLocationCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -82,7 +90,7 @@ func (client *RestorableDatabaseAccountsClient) getByLocationCreateRequest(ctx c func (client *RestorableDatabaseAccountsClient) getByLocationHandleResponse(resp *http.Response) (RestorableDatabaseAccountsGetByLocationResponse, error) { result := RestorableDatabaseAccountsGetByLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorableDatabaseAccountGetResult); err != nil { - return RestorableDatabaseAccountsGetByLocationResponse{}, err + return RestorableDatabaseAccountsGetByLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -130,7 +138,7 @@ func (client *RestorableDatabaseAccountsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -140,7 +148,7 @@ func (client *RestorableDatabaseAccountsClient) listCreateRequest(ctx context.Co func (client *RestorableDatabaseAccountsClient) listHandleResponse(resp *http.Response) (RestorableDatabaseAccountsListResponse, error) { result := RestorableDatabaseAccountsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorableDatabaseAccountsListResult); err != nil { - return RestorableDatabaseAccountsListResponse{}, err + return RestorableDatabaseAccountsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -192,7 +200,7 @@ func (client *RestorableDatabaseAccountsClient) listByLocationCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -202,7 +210,7 @@ func (client *RestorableDatabaseAccountsClient) listByLocationCreateRequest(ctx func (client *RestorableDatabaseAccountsClient) listByLocationHandleResponse(resp *http.Response) (RestorableDatabaseAccountsListByLocationResponse, error) { result := RestorableDatabaseAccountsListByLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorableDatabaseAccountsListResult); err != nil { - return RestorableDatabaseAccountsListByLocationResponse{}, err + return RestorableDatabaseAccountsListByLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablemongodbcollections_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablemongodbcollections_client.go index 00b7904f3a7b..b966497e09db 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablemongodbcollections_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablemongodbcollections_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RestorableMongodbCollectionsClient contains the methods for the RestorableMongodbCollections group. @@ -30,8 +31,15 @@ type RestorableMongodbCollectionsClient struct { } // NewRestorableMongodbCollectionsClient creates a new instance of RestorableMongodbCollectionsClient with the specified values. -func NewRestorableMongodbCollectionsClient(con *arm.Connection, subscriptionID string) *RestorableMongodbCollectionsClient { - return &RestorableMongodbCollectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRestorableMongodbCollectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RestorableMongodbCollectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RestorableMongodbCollectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB collections under a specific database. This helps in scenario where @@ -73,7 +81,7 @@ func (client *RestorableMongodbCollectionsClient) listCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") if options != nil && options.RestorableMongodbDatabaseRid != nil { reqQP.Set("restorableMongodbDatabaseRid", *options.RestorableMongodbDatabaseRid) } @@ -86,7 +94,7 @@ func (client *RestorableMongodbCollectionsClient) listCreateRequest(ctx context. func (client *RestorableMongodbCollectionsClient) listHandleResponse(resp *http.Response) (RestorableMongodbCollectionsListResponse, error) { result := RestorableMongodbCollectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorableMongodbCollectionsListResult); err != nil { - return RestorableMongodbCollectionsListResponse{}, err + return RestorableMongodbCollectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablemongodbdatabases_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablemongodbdatabases_client.go index 65f4e19f31d7..3461b7cbb099 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablemongodbdatabases_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablemongodbdatabases_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RestorableMongodbDatabasesClient contains the methods for the RestorableMongodbDatabases group. @@ -30,8 +31,15 @@ type RestorableMongodbDatabasesClient struct { } // NewRestorableMongodbDatabasesClient creates a new instance of RestorableMongodbDatabasesClient with the specified values. -func NewRestorableMongodbDatabasesClient(con *arm.Connection, subscriptionID string) *RestorableMongodbDatabasesClient { - return &RestorableMongodbDatabasesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRestorableMongodbDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RestorableMongodbDatabasesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RestorableMongodbDatabasesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Show the event feed of all mutations done on all the Azure Cosmos DB MongoDB databases under the restorable account. This helps in scenario where @@ -73,7 +81,7 @@ func (client *RestorableMongodbDatabasesClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -83,7 +91,7 @@ func (client *RestorableMongodbDatabasesClient) listCreateRequest(ctx context.Co func (client *RestorableMongodbDatabasesClient) listHandleResponse(resp *http.Response) (RestorableMongodbDatabasesListResponse, error) { result := RestorableMongodbDatabasesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorableMongodbDatabasesListResult); err != nil { - return RestorableMongodbDatabasesListResponse{}, err + return RestorableMongodbDatabasesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablemongodbresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablemongodbresources_client.go index ba7a70610ec9..e3606230343b 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablemongodbresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablemongodbresources_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RestorableMongodbResourcesClient contains the methods for the RestorableMongodbResources group. @@ -30,8 +31,15 @@ type RestorableMongodbResourcesClient struct { } // NewRestorableMongodbResourcesClient creates a new instance of RestorableMongodbResourcesClient with the specified values. -func NewRestorableMongodbResourcesClient(con *arm.Connection, subscriptionID string) *RestorableMongodbResourcesClient { - return &RestorableMongodbResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRestorableMongodbResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RestorableMongodbResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RestorableMongodbResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Return a list of database and collection combo that exist on the account at the given timestamp and location. This helps in scenarios to validate @@ -73,7 +81,7 @@ func (client *RestorableMongodbResourcesClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") if options != nil && options.RestoreLocation != nil { reqQP.Set("restoreLocation", *options.RestoreLocation) } @@ -89,7 +97,7 @@ func (client *RestorableMongodbResourcesClient) listCreateRequest(ctx context.Co func (client *RestorableMongodbResourcesClient) listHandleResponse(resp *http.Response) (RestorableMongodbResourcesListResponse, error) { result := RestorableMongodbResourcesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorableMongodbResourcesListResult); err != nil { - return RestorableMongodbResourcesListResponse{}, err + return RestorableMongodbResourcesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablesqlcontainers_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablesqlcontainers_client.go index d4b7530e8422..f6cfee4337cf 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablesqlcontainers_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablesqlcontainers_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RestorableSQLContainersClient contains the methods for the RestorableSQLContainers group. @@ -30,8 +31,15 @@ type RestorableSQLContainersClient struct { } // NewRestorableSQLContainersClient creates a new instance of RestorableSQLContainersClient with the specified values. -func NewRestorableSQLContainersClient(con *arm.Connection, subscriptionID string) *RestorableSQLContainersClient { - return &RestorableSQLContainersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRestorableSQLContainersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RestorableSQLContainersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RestorableSQLContainersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Show the event feed of all mutations done on all the Azure Cosmos DB SQL containers under a specific database. This helps in scenario where container @@ -73,7 +81,7 @@ func (client *RestorableSQLContainersClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") if options != nil && options.RestorableSQLDatabaseRid != nil { reqQP.Set("restorableSqlDatabaseRid", *options.RestorableSQLDatabaseRid) } @@ -92,7 +100,7 @@ func (client *RestorableSQLContainersClient) listCreateRequest(ctx context.Conte func (client *RestorableSQLContainersClient) listHandleResponse(resp *http.Response) (RestorableSQLContainersListResponse, error) { result := RestorableSQLContainersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorableSQLContainersListResult); err != nil { - return RestorableSQLContainersListResponse{}, err + return RestorableSQLContainersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablesqldatabases_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablesqldatabases_client.go index 028e00eced74..8c1f8245d5f4 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablesqldatabases_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablesqldatabases_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RestorableSQLDatabasesClient contains the methods for the RestorableSQLDatabases group. @@ -30,8 +31,15 @@ type RestorableSQLDatabasesClient struct { } // NewRestorableSQLDatabasesClient creates a new instance of RestorableSQLDatabasesClient with the specified values. -func NewRestorableSQLDatabasesClient(con *arm.Connection, subscriptionID string) *RestorableSQLDatabasesClient { - return &RestorableSQLDatabasesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRestorableSQLDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RestorableSQLDatabasesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RestorableSQLDatabasesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Show the event feed of all mutations done on all the Azure Cosmos DB SQL databases under the restorable account. This helps in scenario where @@ -73,7 +81,7 @@ func (client *RestorableSQLDatabasesClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -83,7 +91,7 @@ func (client *RestorableSQLDatabasesClient) listCreateRequest(ctx context.Contex func (client *RestorableSQLDatabasesClient) listHandleResponse(resp *http.Response) (RestorableSQLDatabasesListResponse, error) { result := RestorableSQLDatabasesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorableSQLDatabasesListResult); err != nil { - return RestorableSQLDatabasesListResponse{}, err + return RestorableSQLDatabasesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablesqlresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablesqlresources_client.go index 927891a8d4bc..afdc4ae0d808 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablesqlresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_restorablesqlresources_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RestorableSQLResourcesClient contains the methods for the RestorableSQLResources group. @@ -30,8 +31,15 @@ type RestorableSQLResourcesClient struct { } // NewRestorableSQLResourcesClient creates a new instance of RestorableSQLResourcesClient with the specified values. -func NewRestorableSQLResourcesClient(con *arm.Connection, subscriptionID string) *RestorableSQLResourcesClient { - return &RestorableSQLResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRestorableSQLResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RestorableSQLResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RestorableSQLResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Return a list of database and container combo that exist on the account at the given timestamp and location. This helps in scenarios to validate @@ -73,7 +81,7 @@ func (client *RestorableSQLResourcesClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") if options != nil && options.RestoreLocation != nil { reqQP.Set("restoreLocation", *options.RestoreLocation) } @@ -89,7 +97,7 @@ func (client *RestorableSQLResourcesClient) listCreateRequest(ctx context.Contex func (client *RestorableSQLResourcesClient) listHandleResponse(resp *http.Response) (RestorableSQLResourcesListResponse, error) { result := RestorableSQLResourcesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorableSQLResourcesListResult); err != nil { - return RestorableSQLResourcesListResponse{}, err + return RestorableSQLResourcesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_sqlresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_sqlresources_client.go index 9c736bddc0f9..1d6db5cba4a4 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_sqlresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_sqlresources_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SQLResourcesClient contains the methods for the SQLResources group. @@ -31,8 +31,15 @@ type SQLResourcesClient struct { } // NewSQLResourcesClient creates a new instance of SQLResourcesClient with the specified values. -func NewSQLResourcesClient(con *arm.Connection, subscriptionID string) *SQLResourcesClient { - return &SQLResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSQLResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SQLResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SQLResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateUpdateSQLContainer - Create or update an Azure Cosmos DB SQL container @@ -100,7 +107,7 @@ func (client *SQLResourcesClient) createUpdateSQLContainerCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, createUpdateSQLContainerParameters) @@ -179,7 +186,7 @@ func (client *SQLResourcesClient) createUpdateSQLDatabaseCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, createUpdateSQLDatabaseParameters) @@ -258,7 +265,7 @@ func (client *SQLResourcesClient) createUpdateSQLRoleAssignmentCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, createUpdateSQLRoleAssignmentParameters) @@ -338,7 +345,7 @@ func (client *SQLResourcesClient) createUpdateSQLRoleDefinitionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, createUpdateSQLRoleDefinitionParameters) @@ -426,7 +433,7 @@ func (client *SQLResourcesClient) createUpdateSQLStoredProcedureCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, createUpdateSQLStoredProcedureParameters) @@ -513,7 +520,7 @@ func (client *SQLResourcesClient) createUpdateSQLTriggerCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, createUpdateSQLTriggerParameters) @@ -600,7 +607,7 @@ func (client *SQLResourcesClient) createUpdateSQLUserDefinedFunctionCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, createUpdateSQLUserDefinedFunctionParameters) @@ -683,7 +690,7 @@ func (client *SQLResourcesClient) deleteSQLContainerCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -761,7 +768,7 @@ func (client *SQLResourcesClient) deleteSQLDatabaseCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -839,7 +846,7 @@ func (client *SQLResourcesClient) deleteSQLRoleAssignmentCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -919,7 +926,7 @@ func (client *SQLResourcesClient) deleteSQLRoleDefinitionCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1007,7 +1014,7 @@ func (client *SQLResourcesClient) deleteSQLStoredProcedureCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -1093,7 +1100,7 @@ func (client *SQLResourcesClient) deleteSQLTriggerCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -1179,7 +1186,7 @@ func (client *SQLResourcesClient) deleteSQLUserDefinedFunctionCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -1241,7 +1248,7 @@ func (client *SQLResourcesClient) getSQLContainerCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1251,7 +1258,7 @@ func (client *SQLResourcesClient) getSQLContainerCreateRequest(ctx context.Conte func (client *SQLResourcesClient) getSQLContainerHandleResponse(resp *http.Response) (SQLResourcesGetSQLContainerResponse, error) { result := SQLResourcesGetSQLContainerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SQLContainerGetResults); err != nil { - return SQLResourcesGetSQLContainerResponse{}, err + return SQLResourcesGetSQLContainerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1313,7 +1320,7 @@ func (client *SQLResourcesClient) getSQLContainerThroughputCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1323,7 +1330,7 @@ func (client *SQLResourcesClient) getSQLContainerThroughputCreateRequest(ctx con func (client *SQLResourcesClient) getSQLContainerThroughputHandleResponse(resp *http.Response) (SQLResourcesGetSQLContainerThroughputResponse, error) { result := SQLResourcesGetSQLContainerThroughputResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ThroughputSettingsGetResults); err != nil { - return SQLResourcesGetSQLContainerThroughputResponse{}, err + return SQLResourcesGetSQLContainerThroughputResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1381,7 +1388,7 @@ func (client *SQLResourcesClient) getSQLDatabaseCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1391,7 +1398,7 @@ func (client *SQLResourcesClient) getSQLDatabaseCreateRequest(ctx context.Contex func (client *SQLResourcesClient) getSQLDatabaseHandleResponse(resp *http.Response) (SQLResourcesGetSQLDatabaseResponse, error) { result := SQLResourcesGetSQLDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SQLDatabaseGetResults); err != nil { - return SQLResourcesGetSQLDatabaseResponse{}, err + return SQLResourcesGetSQLDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1449,7 +1456,7 @@ func (client *SQLResourcesClient) getSQLDatabaseThroughputCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1459,7 +1466,7 @@ func (client *SQLResourcesClient) getSQLDatabaseThroughputCreateRequest(ctx cont func (client *SQLResourcesClient) getSQLDatabaseThroughputHandleResponse(resp *http.Response) (SQLResourcesGetSQLDatabaseThroughputResponse, error) { result := SQLResourcesGetSQLDatabaseThroughputResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ThroughputSettingsGetResults); err != nil { - return SQLResourcesGetSQLDatabaseThroughputResponse{}, err + return SQLResourcesGetSQLDatabaseThroughputResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1517,7 +1524,7 @@ func (client *SQLResourcesClient) getSQLRoleAssignmentCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1527,7 +1534,7 @@ func (client *SQLResourcesClient) getSQLRoleAssignmentCreateRequest(ctx context. func (client *SQLResourcesClient) getSQLRoleAssignmentHandleResponse(resp *http.Response) (SQLResourcesGetSQLRoleAssignmentResponse, error) { result := SQLResourcesGetSQLRoleAssignmentResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SQLRoleAssignmentGetResults); err != nil { - return SQLResourcesGetSQLRoleAssignmentResponse{}, err + return SQLResourcesGetSQLRoleAssignmentResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1586,7 +1593,7 @@ func (client *SQLResourcesClient) getSQLRoleDefinitionCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1596,7 +1603,7 @@ func (client *SQLResourcesClient) getSQLRoleDefinitionCreateRequest(ctx context. func (client *SQLResourcesClient) getSQLRoleDefinitionHandleResponse(resp *http.Response) (SQLResourcesGetSQLRoleDefinitionResponse, error) { result := SQLResourcesGetSQLRoleDefinitionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SQLRoleDefinitionGetResults); err != nil { - return SQLResourcesGetSQLRoleDefinitionResponse{}, err + return SQLResourcesGetSQLRoleDefinitionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1663,7 +1670,7 @@ func (client *SQLResourcesClient) getSQLStoredProcedureCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1673,7 +1680,7 @@ func (client *SQLResourcesClient) getSQLStoredProcedureCreateRequest(ctx context func (client *SQLResourcesClient) getSQLStoredProcedureHandleResponse(resp *http.Response) (SQLResourcesGetSQLStoredProcedureResponse, error) { result := SQLResourcesGetSQLStoredProcedureResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SQLStoredProcedureGetResults); err != nil { - return SQLResourcesGetSQLStoredProcedureResponse{}, err + return SQLResourcesGetSQLStoredProcedureResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1739,7 +1746,7 @@ func (client *SQLResourcesClient) getSQLTriggerCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1749,7 +1756,7 @@ func (client *SQLResourcesClient) getSQLTriggerCreateRequest(ctx context.Context func (client *SQLResourcesClient) getSQLTriggerHandleResponse(resp *http.Response) (SQLResourcesGetSQLTriggerResponse, error) { result := SQLResourcesGetSQLTriggerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SQLTriggerGetResults); err != nil { - return SQLResourcesGetSQLTriggerResponse{}, err + return SQLResourcesGetSQLTriggerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1815,7 +1822,7 @@ func (client *SQLResourcesClient) getSQLUserDefinedFunctionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1825,7 +1832,7 @@ func (client *SQLResourcesClient) getSQLUserDefinedFunctionCreateRequest(ctx con func (client *SQLResourcesClient) getSQLUserDefinedFunctionHandleResponse(resp *http.Response) (SQLResourcesGetSQLUserDefinedFunctionResponse, error) { result := SQLResourcesGetSQLUserDefinedFunctionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SQLUserDefinedFunctionGetResults); err != nil { - return SQLResourcesGetSQLUserDefinedFunctionResponse{}, err + return SQLResourcesGetSQLUserDefinedFunctionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1883,7 +1890,7 @@ func (client *SQLResourcesClient) listSQLContainersCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1893,7 +1900,7 @@ func (client *SQLResourcesClient) listSQLContainersCreateRequest(ctx context.Con func (client *SQLResourcesClient) listSQLContainersHandleResponse(resp *http.Response) (SQLResourcesListSQLContainersResponse, error) { result := SQLResourcesListSQLContainersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SQLContainerListResult); err != nil { - return SQLResourcesListSQLContainersResponse{}, err + return SQLResourcesListSQLContainersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1947,7 +1954,7 @@ func (client *SQLResourcesClient) listSQLDatabasesCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1957,7 +1964,7 @@ func (client *SQLResourcesClient) listSQLDatabasesCreateRequest(ctx context.Cont func (client *SQLResourcesClient) listSQLDatabasesHandleResponse(resp *http.Response) (SQLResourcesListSQLDatabasesResponse, error) { result := SQLResourcesListSQLDatabasesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SQLDatabaseListResult); err != nil { - return SQLResourcesListSQLDatabasesResponse{}, err + return SQLResourcesListSQLDatabasesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2011,7 +2018,7 @@ func (client *SQLResourcesClient) listSQLRoleAssignmentsCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -2021,7 +2028,7 @@ func (client *SQLResourcesClient) listSQLRoleAssignmentsCreateRequest(ctx contex func (client *SQLResourcesClient) listSQLRoleAssignmentsHandleResponse(resp *http.Response) (SQLResourcesListSQLRoleAssignmentsResponse, error) { result := SQLResourcesListSQLRoleAssignmentsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SQLRoleAssignmentListResult); err != nil { - return SQLResourcesListSQLRoleAssignmentsResponse{}, err + return SQLResourcesListSQLRoleAssignmentsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2076,7 +2083,7 @@ func (client *SQLResourcesClient) listSQLRoleDefinitionsCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -2086,7 +2093,7 @@ func (client *SQLResourcesClient) listSQLRoleDefinitionsCreateRequest(ctx contex func (client *SQLResourcesClient) listSQLRoleDefinitionsHandleResponse(resp *http.Response) (SQLResourcesListSQLRoleDefinitionsResponse, error) { result := SQLResourcesListSQLRoleDefinitionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SQLRoleDefinitionListResult); err != nil { - return SQLResourcesListSQLRoleDefinitionsResponse{}, err + return SQLResourcesListSQLRoleDefinitionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2149,7 +2156,7 @@ func (client *SQLResourcesClient) listSQLStoredProceduresCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -2159,7 +2166,7 @@ func (client *SQLResourcesClient) listSQLStoredProceduresCreateRequest(ctx conte func (client *SQLResourcesClient) listSQLStoredProceduresHandleResponse(resp *http.Response) (SQLResourcesListSQLStoredProceduresResponse, error) { result := SQLResourcesListSQLStoredProceduresResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SQLStoredProcedureListResult); err != nil { - return SQLResourcesListSQLStoredProceduresResponse{}, err + return SQLResourcesListSQLStoredProceduresResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2222,7 +2229,7 @@ func (client *SQLResourcesClient) listSQLTriggersCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -2232,7 +2239,7 @@ func (client *SQLResourcesClient) listSQLTriggersCreateRequest(ctx context.Conte func (client *SQLResourcesClient) listSQLTriggersHandleResponse(resp *http.Response) (SQLResourcesListSQLTriggersResponse, error) { result := SQLResourcesListSQLTriggersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SQLTriggerListResult); err != nil { - return SQLResourcesListSQLTriggersResponse{}, err + return SQLResourcesListSQLTriggersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2294,7 +2301,7 @@ func (client *SQLResourcesClient) listSQLUserDefinedFunctionsCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -2304,7 +2311,7 @@ func (client *SQLResourcesClient) listSQLUserDefinedFunctionsCreateRequest(ctx c func (client *SQLResourcesClient) listSQLUserDefinedFunctionsHandleResponse(resp *http.Response) (SQLResourcesListSQLUserDefinedFunctionsResponse, error) { result := SQLResourcesListSQLUserDefinedFunctionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SQLUserDefinedFunctionListResult); err != nil { - return SQLResourcesListSQLUserDefinedFunctionsResponse{}, err + return SQLResourcesListSQLUserDefinedFunctionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2386,7 +2393,7 @@ func (client *SQLResourcesClient) migrateSQLContainerToAutoscaleCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -2470,7 +2477,7 @@ func (client *SQLResourcesClient) migrateSQLContainerToManualThroughputCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -2550,7 +2557,7 @@ func (client *SQLResourcesClient) migrateSQLDatabaseToAutoscaleCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -2630,7 +2637,7 @@ func (client *SQLResourcesClient) migrateSQLDatabaseToManualThroughputCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -2714,7 +2721,7 @@ func (client *SQLResourcesClient) retrieveContinuousBackupInformationCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, location) @@ -2798,7 +2805,7 @@ func (client *SQLResourcesClient) updateSQLContainerThroughputCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, updateThroughputParameters) @@ -2877,7 +2884,7 @@ func (client *SQLResourcesClient) updateSQLDatabaseThroughputCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, updateThroughputParameters) diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_tableresources_client.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_tableresources_client.go index 9f7132dca663..29c2b14f0db3 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_tableresources_client.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_tableresources_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TableResourcesClient contains the methods for the TableResources group. @@ -31,8 +31,15 @@ type TableResourcesClient struct { } // NewTableResourcesClient creates a new instance of TableResourcesClient with the specified values. -func NewTableResourcesClient(con *arm.Connection, subscriptionID string) *TableResourcesClient { - return &TableResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTableResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TableResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TableResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateUpdateTable - Create or update an Azure Cosmos DB Table @@ -96,7 +103,7 @@ func (client *TableResourcesClient) createUpdateTableCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, createUpdateTableParameters) @@ -175,7 +182,7 @@ func (client *TableResourcesClient) deleteTableCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -233,7 +240,7 @@ func (client *TableResourcesClient) getTableCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -243,7 +250,7 @@ func (client *TableResourcesClient) getTableCreateRequest(ctx context.Context, r func (client *TableResourcesClient) getTableHandleResponse(resp *http.Response) (TableResourcesGetTableResponse, error) { result := TableResourcesGetTableResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TableGetResults); err != nil { - return TableResourcesGetTableResponse{}, err + return TableResourcesGetTableResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -301,7 +308,7 @@ func (client *TableResourcesClient) getTableThroughputCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -311,7 +318,7 @@ func (client *TableResourcesClient) getTableThroughputCreateRequest(ctx context. func (client *TableResourcesClient) getTableThroughputHandleResponse(resp *http.Response) (TableResourcesGetTableThroughputResponse, error) { result := TableResourcesGetTableThroughputResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ThroughputSettingsGetResults); err != nil { - return TableResourcesGetTableThroughputResponse{}, err + return TableResourcesGetTableThroughputResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -365,7 +372,7 @@ func (client *TableResourcesClient) listTablesCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -375,7 +382,7 @@ func (client *TableResourcesClient) listTablesCreateRequest(ctx context.Context, func (client *TableResourcesClient) listTablesHandleResponse(resp *http.Response) (TableResourcesListTablesResponse, error) { result := TableResourcesListTablesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TableListResult); err != nil { - return TableResourcesListTablesResponse{}, err + return TableResourcesListTablesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -453,7 +460,7 @@ func (client *TableResourcesClient) migrateTableToAutoscaleCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -533,7 +540,7 @@ func (client *TableResourcesClient) migrateTableToManualThroughputCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -613,7 +620,7 @@ func (client *TableResourcesClient) updateTableThroughputCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-07-01-preview") + reqQP.Set("api-version", "2021-10-15") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, updateThroughputParameters) diff --git a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_time_rfc3339.go b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_time_rfc3339.go index c3bdca1381df..285b822b2323 100644 --- a/sdk/resourcemanager/cosmos/armcosmos/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/cosmos/armcosmos/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armcosmos import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/databricks/armdatabricks/CHANGELOG.md b/sdk/resourcemanager/databricks/armdatabricks/CHANGELOG.md index e4f3d9f035c1..6ee9f3587c1a 100644 --- a/sdk/resourcemanager/databricks/armdatabricks/CHANGELOG.md +++ b/sdk/resourcemanager/databricks/armdatabricks/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-26) diff --git a/sdk/resourcemanager/databricks/armdatabricks/README.md b/sdk/resourcemanager/databricks/armdatabricks/README.md index 7d53c9de891e..85ad1288dadd 100644 --- a/sdk/resourcemanager/databricks/armdatabricks/README.md +++ b/sdk/resourcemanager/databricks/armdatabricks/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Databricks +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Databricks modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armdatabricks.NewWorkspacesClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Databricks modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armdatabricks.NewWorkspacesClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armdatabricks.NewWorkspacesClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/databricks/armdatabricks/autorest.md b/sdk/resourcemanager/databricks/armdatabricks/autorest.md index 0dc9df444ac5..9cc952da2c54 100644 --- a/sdk/resourcemanager/databricks/armdatabricks/autorest.md +++ b/sdk/resourcemanager/databricks/armdatabricks/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/3c16aae50c7110e1aad241ac93995621d4093d46/specification/databricks/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/3c16aae50c7110e1aad241ac93995621d4093d46/specification/databricks/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/databricks/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/databricks/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/databricks/armdatabricks/go.mod b/sdk/resourcemanager/databricks/armdatabricks/go.mod index 416ec90638d6..3199b0b8fb2e 100644 --- a/sdk/resourcemanager/databricks/armdatabricks/go.mod +++ b/sdk/resourcemanager/databricks/armdatabricks/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/databricks/armdatab go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.2.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/databricks/armdatabricks/go.sum b/sdk/resourcemanager/databricks/armdatabricks/go.sum index c8ff7a2143ad..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/databricks/armdatabricks/go.sum +++ b/sdk/resourcemanager/databricks/armdatabricks/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible h1:iCb2tuoEm3N7ZpUDOvu1Yxl1B3iOVDmaD6weaRuIPzs= -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_constants.go b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_constants.go index 3b84791f428b..82a6d6c4fa9e 100644 --- a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_constants.go +++ b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_constants.go @@ -10,7 +10,7 @@ package armdatabricks const ( module = "armdatabricks" - version = "v0.1.1" + version = "v0.2.0" ) // CreatedByType - The type of identity that created the resource. diff --git a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_models.go b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_models.go index bc05e96058d6..e17587d79533 100644 --- a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_models.go +++ b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_models.go @@ -10,10 +10,9 @@ package armdatabricks import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // AddressSpace contains an array of IP address ranges that can be used by subnets of the virtual network. @@ -447,10 +446,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -466,9 +465,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -477,9 +474,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) @@ -800,7 +795,7 @@ func (w WorkspaceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "authorizations", w.Authorizations) populate(objectMap, "createdBy", w.CreatedBy) - populate(objectMap, "createdDateTime", (*timeRFC3339)(w.CreatedDateTime)) + populateTimeRFC3339(objectMap, "createdDateTime", w.CreatedDateTime) populate(objectMap, "encryption", w.Encryption) populate(objectMap, "managedResourceGroupId", w.ManagedResourceGroupID) populate(objectMap, "parameters", w.Parameters) @@ -832,9 +827,7 @@ func (w *WorkspaceProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.CreatedBy) delete(rawMsg, key) case "createdDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.CreatedDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.CreatedDateTime) delete(rawMsg, key) case "encryption": err = unpopulate(val, &w.Encryption) diff --git a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_operations_client.go b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_operations_client.go index 8f5e5c842f57..ca5e5fa8005d 100644 --- a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_operations_client.go +++ b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armdatabricks import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available RP operations. @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_outboundnetworkdependenciesendpoints_client.go b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_outboundnetworkdependenciesendpoints_client.go index 807bb2ca41d5..e91772f18424 100644 --- a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_outboundnetworkdependenciesendpoints_client.go +++ b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_outboundnetworkdependenciesendpoints_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // OutboundNetworkDependenciesEndpointsClient contains the methods for the OutboundNetworkDependenciesEndpoints group. @@ -30,8 +31,15 @@ type OutboundNetworkDependenciesEndpointsClient struct { } // NewOutboundNetworkDependenciesEndpointsClient creates a new instance of OutboundNetworkDependenciesEndpointsClient with the specified values. -func NewOutboundNetworkDependenciesEndpointsClient(con *arm.Connection, subscriptionID string) *OutboundNetworkDependenciesEndpointsClient { - return &OutboundNetworkDependenciesEndpointsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewOutboundNetworkDependenciesEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OutboundNetworkDependenciesEndpointsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OutboundNetworkDependenciesEndpointsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets the list of endpoints that VNET Injected Workspace calls Azure Databricks Control Plane. You must configure outbound access with these endpoints. @@ -83,7 +91,7 @@ func (client *OutboundNetworkDependenciesEndpointsClient) listCreateRequest(ctx func (client *OutboundNetworkDependenciesEndpointsClient) listHandleResponse(resp *http.Response) (OutboundNetworkDependenciesEndpointsListResponse, error) { result := OutboundNetworkDependenciesEndpointsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OutboundEnvironmentEndpointArray); err != nil { - return OutboundNetworkDependenciesEndpointsListResponse{}, err + return OutboundNetworkDependenciesEndpointsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_pagers.go b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_pagers.go index c783ce251255..c94e407d29c1 100644 --- a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_pagers.go +++ b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armdatabricks import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // OperationsListPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_pollers.go b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_pollers.go index 1197e7a22405..2e3e92dafc5f 100644 --- a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_pollers.go +++ b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armdatabricks import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // PrivateEndpointConnectionsCreatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_privateendpointconnections_client.go index c1c3e8f7cfc8..5e05de44cb3b 100644 --- a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_privateendpointconnections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. @@ -31,8 +31,15 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { - return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Update the status of a private endpoint connection with the specified name @@ -246,7 +253,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsGetResponse{}, err + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -308,7 +315,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListResponse, error) { result := PrivateEndpointConnectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionsList); err != nil { - return PrivateEndpointConnectionsListResponse{}, err + return PrivateEndpointConnectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_privatelinkresources_client.go index c8bcaa084233..e8114ad0c528 100644 --- a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_privatelinkresources_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. @@ -30,8 +31,15 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { - return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get the specified private link resource for the given group id (sub-resource) @@ -85,7 +93,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesGetResponse, error) { result := PrivateLinkResourcesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GroupIDInformation); err != nil { - return PrivateLinkResourcesGetResponse{}, err + return PrivateLinkResourcesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -147,7 +155,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, func (client *PrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (PrivateLinkResourcesListResponse, error) { result := PrivateLinkResourcesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourcesList); err != nil { - return PrivateLinkResourcesListResponse{}, err + return PrivateLinkResourcesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_response_types.go b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_response_types.go index 2b6e999ab47e..2488c2034793 100644 --- a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_response_types.go +++ b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armdatabricks import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // OperationsListResponse contains the response from method Operations.List. @@ -51,6 +50,8 @@ type PrivateEndpointConnectionsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsCreateResponse, error) { respType := PrivateEndpointConnectionsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) @@ -101,6 +102,8 @@ type PrivateEndpointConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsDeleteResponse, error) { respType := PrivateEndpointConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -193,6 +196,8 @@ type VNetPeeringCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VNetPeeringCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VNetPeeringCreateOrUpdateResponse, error) { respType := VNetPeeringCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualNetworkPeering) @@ -243,6 +248,8 @@ type VNetPeeringDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VNetPeeringDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VNetPeeringDeleteResponse, error) { respType := VNetPeeringDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -311,6 +318,8 @@ type WorkspacesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WorkspacesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WorkspacesCreateOrUpdateResponse, error) { respType := WorkspacesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Workspace) @@ -361,6 +370,8 @@ type WorkspacesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WorkspacesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WorkspacesDeleteResponse, error) { respType := WorkspacesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -441,6 +452,8 @@ type WorkspacesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WorkspacesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WorkspacesUpdateResponse, error) { respType := WorkspacesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Workspace) diff --git a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_time_rfc3339.go b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_time_rfc3339.go index 436b9c34723f..1d84ee160073 100644 --- a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armdatabricks import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_vnetpeering_client.go b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_vnetpeering_client.go index a0132e0324b9..06ff0c1ed496 100644 --- a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_vnetpeering_client.go +++ b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_vnetpeering_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VNetPeeringClient contains the methods for the VNetPeering group. @@ -31,8 +31,15 @@ type VNetPeeringClient struct { } // NewVNetPeeringClient creates a new instance of VNetPeeringClient with the specified values. -func NewVNetPeeringClient(con *arm.Connection, subscriptionID string) *VNetPeeringClient { - return &VNetPeeringClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVNetPeeringClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VNetPeeringClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VNetPeeringClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates vNet Peering for workspace. @@ -246,7 +253,7 @@ func (client *VNetPeeringClient) getCreateRequest(ctx context.Context, resourceG func (client *VNetPeeringClient) getHandleResponse(resp *http.Response) (VNetPeeringGetResponse, error) { result := VNetPeeringGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkPeering); err != nil { - return VNetPeeringGetResponse{}, err + return VNetPeeringGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -308,7 +315,7 @@ func (client *VNetPeeringClient) listByWorkspaceCreateRequest(ctx context.Contex func (client *VNetPeeringClient) listByWorkspaceHandleResponse(resp *http.Response) (VNetPeeringListByWorkspaceResponse, error) { result := VNetPeeringListByWorkspaceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkPeeringList); err != nil { - return VNetPeeringListByWorkspaceResponse{}, err + return VNetPeeringListByWorkspaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_workspaces_client.go b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_workspaces_client.go index e8e53422e820..f5cf9d5acab9 100644 --- a/sdk/resourcemanager/databricks/armdatabricks/zz_generated_workspaces_client.go +++ b/sdk/resourcemanager/databricks/armdatabricks/zz_generated_workspaces_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // WorkspacesClient contains the methods for the Workspaces group. @@ -31,8 +31,15 @@ type WorkspacesClient struct { } // NewWorkspacesClient creates a new instance of WorkspacesClient with the specified values. -func NewWorkspacesClient(con *arm.Connection, subscriptionID string) *WorkspacesClient { - return &WorkspacesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWorkspacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkspacesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WorkspacesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a new workspace. @@ -234,7 +241,7 @@ func (client *WorkspacesClient) getCreateRequest(ctx context.Context, resourceGr func (client *WorkspacesClient) getHandleResponse(resp *http.Response) (WorkspacesGetResponse, error) { result := WorkspacesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Workspace); err != nil { - return WorkspacesGetResponse{}, err + return WorkspacesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -292,7 +299,7 @@ func (client *WorkspacesClient) listByResourceGroupCreateRequest(ctx context.Con func (client *WorkspacesClient) listByResourceGroupHandleResponse(resp *http.Response) (WorkspacesListByResourceGroupResponse, error) { result := WorkspacesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceListResult); err != nil { - return WorkspacesListByResourceGroupResponse{}, err + return WorkspacesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -346,7 +353,7 @@ func (client *WorkspacesClient) listBySubscriptionCreateRequest(ctx context.Cont func (client *WorkspacesClient) listBySubscriptionHandleResponse(resp *http.Response) (WorkspacesListBySubscriptionResponse, error) { result := WorkspacesListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceListResult); err != nil { - return WorkspacesListBySubscriptionResponse{}, err + return WorkspacesListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/CHANGELOG.md b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/CHANGELOG.md index 2020c499e6f2..25bcb000cbce 100644 --- a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/CHANGELOG.md +++ b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-27) diff --git a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/README.md b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/README.md index 6a28a58020fc..07a7beb3d5f6 100644 --- a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/README.md +++ b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Data Lake Analytics +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Data Lake Analytics modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armdatalakeanalytics.NewDataLakeStoreAccountsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Data Lake Analytics modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armdatalakeanalytics.NewDataLakeStoreAccountsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armdatalakeanalytics.NewDataLakeStoreAccountsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/autorest.md b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/autorest.md index 278242687b6d..31562fe27250 100644 --- a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/autorest.md +++ b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/348665d474283df6a73d6a2ec6defef271251f13/specification/datalake-analytics/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/348665d474283df6a73d6a2ec6defef271251f13/specification/datalake-analytics/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/datalake-analytics/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/datalake-analytics/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/go.mod b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/go.mod index 9f96f134c50f..ad50883f7945 100644 --- a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/go.mod +++ b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/datalake-analytics/ go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.3.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/go.sum b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/go.sum index af10d0f1292e..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/go.sum +++ b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.3.0+incompatible h1:lb9OWePNuJMiibdxg9XvdbiOldR0Yifge37L4LoOxIs= -github.com/Azure/azure-sdk-for-go v58.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_accounts_client.go b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_accounts_client.go index 51ce5349e954..f41755f6171c 100644 --- a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_accounts_client.go +++ b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_accounts_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // AccountsClient contains the methods for the Accounts group. @@ -32,8 +32,15 @@ type AccountsClient struct { } // NewAccountsClient creates a new instance of AccountsClient with the specified values. -func NewAccountsClient(con *arm.Connection, subscriptionID string) *AccountsClient { - return &AccountsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AccountsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AccountsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNameAvailability - Checks whether the specified account name is available or taken. @@ -79,7 +86,7 @@ func (client *AccountsClient) checkNameAvailabilityCreateRequest(ctx context.Con func (client *AccountsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (AccountsCheckNameAvailabilityResponse, error) { result := AccountsCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NameAvailabilityInformation); err != nil { - return AccountsCheckNameAvailabilityResponse{}, err + return AccountsCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -296,7 +303,7 @@ func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGrou func (client *AccountsClient) getHandleResponse(resp *http.Response) (AccountsGetResponse, error) { result := AccountsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataLakeAnalyticsAccount); err != nil { - return AccountsGetResponse{}, err + return AccountsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -368,7 +375,7 @@ func (client *AccountsClient) listCreateRequest(ctx context.Context, options *Ac func (client *AccountsClient) listHandleResponse(resp *http.Response) (AccountsListResponse, error) { result := AccountsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataLakeAnalyticsAccountListResult); err != nil { - return AccountsListResponse{}, err + return AccountsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -445,7 +452,7 @@ func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Conte func (client *AccountsClient) listByResourceGroupHandleResponse(resp *http.Response) (AccountsListByResourceGroupResponse, error) { result := AccountsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataLakeAnalyticsAccountListResult); err != nil { - return AccountsListByResourceGroupResponse{}, err + return AccountsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_computepolicies_client.go b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_computepolicies_client.go index 28798c8646d6..9959be0b32d9 100644 --- a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_computepolicies_client.go +++ b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_computepolicies_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ComputePoliciesClient contains the methods for the ComputePolicies group. @@ -30,8 +31,15 @@ type ComputePoliciesClient struct { } // NewComputePoliciesClient creates a new instance of ComputePoliciesClient with the specified values. -func NewComputePoliciesClient(con *arm.Connection, subscriptionID string) *ComputePoliciesClient { - return &ComputePoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewComputePoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ComputePoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ComputePoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the specified compute policy. During update, the compute policy with the specified name will be replaced with this @@ -86,7 +94,7 @@ func (client *ComputePoliciesClient) createOrUpdateCreateRequest(ctx context.Con func (client *ComputePoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (ComputePoliciesCreateOrUpdateResponse, error) { result := ComputePoliciesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ComputePolicy); err != nil { - return ComputePoliciesCreateOrUpdateResponse{}, err + return ComputePoliciesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -215,7 +223,7 @@ func (client *ComputePoliciesClient) getCreateRequest(ctx context.Context, resou func (client *ComputePoliciesClient) getHandleResponse(resp *http.Response) (ComputePoliciesGetResponse, error) { result := ComputePoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ComputePolicy); err != nil { - return ComputePoliciesGetResponse{}, err + return ComputePoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -277,7 +285,7 @@ func (client *ComputePoliciesClient) listByAccountCreateRequest(ctx context.Cont func (client *ComputePoliciesClient) listByAccountHandleResponse(resp *http.Response) (ComputePoliciesListByAccountResponse, error) { result := ComputePoliciesListByAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ComputePolicyListResult); err != nil { - return ComputePoliciesListByAccountResponse{}, err + return ComputePoliciesListByAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -349,7 +357,7 @@ func (client *ComputePoliciesClient) updateCreateRequest(ctx context.Context, re func (client *ComputePoliciesClient) updateHandleResponse(resp *http.Response) (ComputePoliciesUpdateResponse, error) { result := ComputePoliciesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ComputePolicy); err != nil { - return ComputePoliciesUpdateResponse{}, err + return ComputePoliciesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_constants.go b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_constants.go index 4f1af617a259..e3c1f3c76a08 100644 --- a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_constants.go +++ b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_constants.go @@ -10,7 +10,7 @@ package armdatalakeanalytics const ( module = "armdatalakeanalytics" - version = "v0.1.1" + version = "v0.2.0" ) // AADObjectType - The type of AAD object the object identifier refers to. diff --git a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_datalakestoreaccounts_client.go b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_datalakestoreaccounts_client.go index 820d59116c28..c78bfacfee2a 100644 --- a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_datalakestoreaccounts_client.go +++ b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_datalakestoreaccounts_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // DataLakeStoreAccountsClient contains the methods for the DataLakeStoreAccounts group. @@ -31,8 +32,15 @@ type DataLakeStoreAccountsClient struct { } // NewDataLakeStoreAccountsClient creates a new instance of DataLakeStoreAccountsClient with the specified values. -func NewDataLakeStoreAccountsClient(con *arm.Connection, subscriptionID string) *DataLakeStoreAccountsClient { - return &DataLakeStoreAccountsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDataLakeStoreAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DataLakeStoreAccountsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DataLakeStoreAccountsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Add - Updates the specified Data Lake Analytics account to include the additional Data Lake Store account. @@ -209,7 +217,7 @@ func (client *DataLakeStoreAccountsClient) getCreateRequest(ctx context.Context, func (client *DataLakeStoreAccountsClient) getHandleResponse(resp *http.Response) (DataLakeStoreAccountsGetResponse, error) { result := DataLakeStoreAccountsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataLakeStoreAccountInformation); err != nil { - return DataLakeStoreAccountsGetResponse{}, err + return DataLakeStoreAccountsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -290,7 +298,7 @@ func (client *DataLakeStoreAccountsClient) listByAccountCreateRequest(ctx contex func (client *DataLakeStoreAccountsClient) listByAccountHandleResponse(resp *http.Response) (DataLakeStoreAccountsListByAccountResponse, error) { result := DataLakeStoreAccountsListByAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataLakeStoreAccountInformationListResult); err != nil { - return DataLakeStoreAccountsListByAccountResponse{}, err + return DataLakeStoreAccountsListByAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_firewallrules_client.go b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_firewallrules_client.go index 1e452be17ecc..88e300ba7e87 100644 --- a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_firewallrules_client.go +++ b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_firewallrules_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // FirewallRulesClient contains the methods for the FirewallRules group. @@ -30,8 +31,15 @@ type FirewallRulesClient struct { } // NewFirewallRulesClient creates a new instance of FirewallRulesClient with the specified values. -func NewFirewallRulesClient(con *arm.Connection, subscriptionID string) *FirewallRulesClient { - return &FirewallRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FirewallRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FirewallRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the specified firewall rule. During update, the firewall rule with the specified name will be replaced with this @@ -86,7 +94,7 @@ func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Conte func (client *FirewallRulesClient) createOrUpdateHandleResponse(resp *http.Response) (FirewallRulesCreateOrUpdateResponse, error) { result := FirewallRulesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRule); err != nil { - return FirewallRulesCreateOrUpdateResponse{}, err + return FirewallRulesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -215,7 +223,7 @@ func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourc func (client *FirewallRulesClient) getHandleResponse(resp *http.Response) (FirewallRulesGetResponse, error) { result := FirewallRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRule); err != nil { - return FirewallRulesGetResponse{}, err + return FirewallRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -277,7 +285,7 @@ func (client *FirewallRulesClient) listByAccountCreateRequest(ctx context.Contex func (client *FirewallRulesClient) listByAccountHandleResponse(resp *http.Response) (FirewallRulesListByAccountResponse, error) { result := FirewallRulesListByAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRuleListResult); err != nil { - return FirewallRulesListByAccountResponse{}, err + return FirewallRulesListByAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -349,7 +357,7 @@ func (client *FirewallRulesClient) updateCreateRequest(ctx context.Context, reso func (client *FirewallRulesClient) updateHandleResponse(resp *http.Response) (FirewallRulesUpdateResponse, error) { result := FirewallRulesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRule); err != nil { - return FirewallRulesUpdateResponse{}, err + return FirewallRulesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_locations_client.go b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_locations_client.go index 844ec826533d..f5fca5b8313d 100644 --- a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_locations_client.go +++ b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_locations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LocationsClient contains the methods for the Locations group. @@ -30,8 +31,15 @@ type LocationsClient struct { } // NewLocationsClient creates a new instance of LocationsClient with the specified values. -func NewLocationsClient(con *arm.Connection, subscriptionID string) *LocationsClient { - return &LocationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LocationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LocationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetCapability - Gets subscription-level properties and limits for Data Lake Analytics specified by resource location. @@ -77,7 +85,7 @@ func (client *LocationsClient) getCapabilityCreateRequest(ctx context.Context, l func (client *LocationsClient) getCapabilityHandleResponse(resp *http.Response) (LocationsGetCapabilityResponse, error) { result := LocationsGetCapabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CapabilityInformation); err != nil { - return LocationsGetCapabilityResponse{}, err + return LocationsGetCapabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_models.go b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_models.go index 4a907545bb62..b38bfd929bd1 100644 --- a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_models.go +++ b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_models.go @@ -10,10 +10,9 @@ package armdatalakeanalytics import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // AccountsBeginCreateOptions contains the optional parameters for the Accounts.BeginCreate method. @@ -642,9 +641,9 @@ func (d *DataLakeAnalyticsAccountPropertiesBasic) UnmarshalJSON(data []byte) err func (d DataLakeAnalyticsAccountPropertiesBasic) marshalInternal(objectMap map[string]interface{}) { populate(objectMap, "accountId", d.AccountID) - populate(objectMap, "creationTime", (*timeRFC3339)(d.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", d.CreationTime) populate(objectMap, "endpoint", d.Endpoint) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(d.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", d.LastModifiedTime) populate(objectMap, "provisioningState", d.ProvisioningState) populate(objectMap, "state", d.State) } @@ -657,17 +656,13 @@ func (d *DataLakeAnalyticsAccountPropertiesBasic) unmarshalInternal(rawMsg map[s err = unpopulate(val, &d.AccountID) delete(rawMsg, key) case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.CreationTime) delete(rawMsg, key) case "endpoint": err = unpopulate(val, &d.Endpoint) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.LastModifiedTime) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, &d.ProvisioningState) @@ -1217,7 +1212,7 @@ type StorageContainerProperties struct { // MarshalJSON implements the json.Marshaller interface for type StorageContainerProperties. func (s StorageContainerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(s.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", s.LastModifiedTime) return json.Marshal(objectMap) } @@ -1231,9 +1226,7 @@ func (s *StorageContainerProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedTime) delete(rawMsg, key) } if err != nil { diff --git a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_operations_client.go b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_operations_client.go index 31367720a412..5bfe29562385 100644 --- a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_operations_client.go +++ b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armdatalakeanalytics import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available Data Lake Analytics REST API operations. @@ -65,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_pagers.go b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_pagers.go index 914c4731a853..4d009713db1c 100644 --- a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_pagers.go +++ b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armdatalakeanalytics import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // AccountsListByResourceGroupPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_pollers.go b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_pollers.go index 28b75d90dffa..bf7336e22fba 100644 --- a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_pollers.go +++ b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armdatalakeanalytics import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // AccountsCreatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_response_types.go b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_response_types.go index d2850eebf94c..993af487b17b 100644 --- a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_response_types.go +++ b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armdatalakeanalytics import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // AccountsCheckNameAvailabilityResponse contains the response from method Accounts.CheckNameAvailability. @@ -38,6 +37,8 @@ type AccountsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AccountsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountsCreateResponse, error) { respType := AccountsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DataLakeAnalyticsAccount) @@ -88,6 +89,8 @@ type AccountsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AccountsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountsDeleteResponse, error) { respType := AccountsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -168,6 +171,8 @@ type AccountsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AccountsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountsUpdateResponse, error) { respType := AccountsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DataLakeAnalyticsAccount) diff --git a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_storageaccounts_client.go b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_storageaccounts_client.go index be4b56f7d51e..24b5570958f7 100644 --- a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_storageaccounts_client.go +++ b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_storageaccounts_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // StorageAccountsClient contains the methods for the StorageAccounts group. @@ -31,8 +32,15 @@ type StorageAccountsClient struct { } // NewStorageAccountsClient creates a new instance of StorageAccountsClient with the specified values. -func NewStorageAccountsClient(con *arm.Connection, subscriptionID string) *StorageAccountsClient { - return &StorageAccountsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewStorageAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *StorageAccountsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &StorageAccountsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Add - Updates the specified Data Lake Analytics account to add an Azure Storage account. @@ -206,7 +214,7 @@ func (client *StorageAccountsClient) getCreateRequest(ctx context.Context, resou func (client *StorageAccountsClient) getHandleResponse(resp *http.Response) (StorageAccountsGetResponse, error) { result := StorageAccountsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StorageAccountInformation); err != nil { - return StorageAccountsGetResponse{}, err + return StorageAccountsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -279,7 +287,7 @@ func (client *StorageAccountsClient) getStorageContainerCreateRequest(ctx contex func (client *StorageAccountsClient) getStorageContainerHandleResponse(resp *http.Response) (StorageAccountsGetStorageContainerResponse, error) { result := StorageAccountsGetStorageContainerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StorageContainer); err != nil { - return StorageAccountsGetStorageContainerResponse{}, err + return StorageAccountsGetStorageContainerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -360,7 +368,7 @@ func (client *StorageAccountsClient) listByAccountCreateRequest(ctx context.Cont func (client *StorageAccountsClient) listByAccountHandleResponse(resp *http.Response) (StorageAccountsListByAccountResponse, error) { result := StorageAccountsListByAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StorageAccountInformationListResult); err != nil { - return StorageAccountsListByAccountResponse{}, err + return StorageAccountsListByAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -430,7 +438,7 @@ func (client *StorageAccountsClient) listSasTokensCreateRequest(ctx context.Cont func (client *StorageAccountsClient) listSasTokensHandleResponse(resp *http.Response) (StorageAccountsListSasTokensResponse, error) { result := StorageAccountsListSasTokensResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SasTokenInformationListResult); err != nil { - return StorageAccountsListSasTokensResponse{}, err + return StorageAccountsListSasTokensResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -497,7 +505,7 @@ func (client *StorageAccountsClient) listStorageContainersCreateRequest(ctx cont func (client *StorageAccountsClient) listStorageContainersHandleResponse(resp *http.Response) (StorageAccountsListStorageContainersResponse, error) { result := StorageAccountsListStorageContainersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StorageContainerListResult); err != nil { - return StorageAccountsListStorageContainersResponse{}, err + return StorageAccountsListStorageContainersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_time_rfc3339.go b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_time_rfc3339.go index 096825079f28..7d48ee31cb1e 100644 --- a/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/datalake-analytics/armdatalakeanalytics/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armdatalakeanalytics import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/datalake-store/armdatalakestore/CHANGELOG.md b/sdk/resourcemanager/datalake-store/armdatalakestore/CHANGELOG.md index 2276a757fdd8..626bf7231e27 100644 --- a/sdk/resourcemanager/datalake-store/armdatalakestore/CHANGELOG.md +++ b/sdk/resourcemanager/datalake-store/armdatalakestore/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-20) diff --git a/sdk/resourcemanager/datalake-store/armdatalakestore/README.md b/sdk/resourcemanager/datalake-store/armdatalakestore/README.md index 2e88698a05ea..1f5a80f8424d 100644 --- a/sdk/resourcemanager/datalake-store/armdatalakestore/README.md +++ b/sdk/resourcemanager/datalake-store/armdatalakestore/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Data Lake Storage +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Data Lake Storage modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armdatalakestore.NewLocationsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Data Lake Storage modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armdatalakestore.NewLocationsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armdatalakestore.NewLocationsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/datalake-store/armdatalakestore/autorest.md b/sdk/resourcemanager/datalake-store/armdatalakestore/autorest.md index 30debe7ff121..219c2df9a226 100644 --- a/sdk/resourcemanager/datalake-store/armdatalakestore/autorest.md +++ b/sdk/resourcemanager/datalake-store/armdatalakestore/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/3eaa729b3686f20817145e771a8ab707c739dbbd/specification/datalake-store/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/3eaa729b3686f20817145e771a8ab707c739dbbd/specification/datalake-store/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/datalake-store/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/datalake-store/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/datalake-store/armdatalakestore/go.mod b/sdk/resourcemanager/datalake-store/armdatalakestore/go.mod index 1a868374a1e6..dc3f142494e6 100644 --- a/sdk/resourcemanager/datalake-store/armdatalakestore/go.mod +++ b/sdk/resourcemanager/datalake-store/armdatalakestore/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/datalake-store/armd go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.1.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/datalake-store/armdatalakestore/go.sum b/sdk/resourcemanager/datalake-store/armdatalakestore/go.sum index f37ba2aef08b..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/datalake-store/armdatalakestore/go.sum +++ b/sdk/resourcemanager/datalake-store/armdatalakestore/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible h1:WFsr3Efy7uweykOAEfOHO3ACtuwIv+rrFmSn9K48VnA= -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_accounts_client.go b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_accounts_client.go index 67de7a715ba3..d0411b3cda3e 100644 --- a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_accounts_client.go +++ b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_accounts_client.go @@ -11,15 +11,15 @@ package armdatalakestore import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // AccountsClient contains the methods for the Accounts group. @@ -31,8 +31,15 @@ type AccountsClient struct { } // NewAccountsClient creates a new instance of AccountsClient with the specified values. -func NewAccountsClient(con *arm.Connection, subscriptionID string) *AccountsClient { - return &AccountsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AccountsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AccountsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNameAvailability - Checks whether the specified account name is available or taken. @@ -78,7 +85,7 @@ func (client *AccountsClient) checkNameAvailabilityCreateRequest(ctx context.Con func (client *AccountsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (AccountsCheckNameAvailabilityResponse, error) { result := AccountsCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NameAvailabilityInformation); err != nil { - return AccountsCheckNameAvailabilityResponse{}, err + return AccountsCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -345,7 +352,7 @@ func (client *AccountsClient) getCreateRequest(ctx context.Context, resourceGrou func (client *AccountsClient) getHandleResponse(resp *http.Response) (AccountsGetResponse, error) { result := AccountsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataLakeStoreAccount); err != nil { - return AccountsGetResponse{}, err + return AccountsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -416,7 +423,7 @@ func (client *AccountsClient) listCreateRequest(ctx context.Context, options *Ac func (client *AccountsClient) listHandleResponse(resp *http.Response) (AccountsListResponse, error) { result := AccountsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataLakeStoreAccountListResult); err != nil { - return AccountsListResponse{}, err + return AccountsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -492,7 +499,7 @@ func (client *AccountsClient) listByResourceGroupCreateRequest(ctx context.Conte func (client *AccountsClient) listByResourceGroupHandleResponse(resp *http.Response) (AccountsListByResourceGroupResponse, error) { result := AccountsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataLakeStoreAccountListResult); err != nil { - return AccountsListByResourceGroupResponse{}, err + return AccountsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_constants.go b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_constants.go index 6337d2872129..0d248755e224 100644 --- a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_constants.go +++ b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_constants.go @@ -10,7 +10,7 @@ package armdatalakestore const ( module = "armdatalakestore" - version = "v0.1.1" + version = "v0.2.0" ) // CheckNameAvailabilityParametersType - The resource type. Note: This should not be set by the user, as the constant value is Microsoft.DataLakeStore/accounts diff --git a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_firewallrules_client.go b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_firewallrules_client.go index a4660056ab39..f0a87d964d02 100644 --- a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_firewallrules_client.go +++ b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_firewallrules_client.go @@ -11,13 +11,14 @@ package armdatalakestore import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // FirewallRulesClient contains the methods for the FirewallRules group. @@ -29,8 +30,15 @@ type FirewallRulesClient struct { } // NewFirewallRulesClient creates a new instance of FirewallRulesClient with the specified values. -func NewFirewallRulesClient(con *arm.Connection, subscriptionID string) *FirewallRulesClient { - return &FirewallRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FirewallRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FirewallRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the specified firewall rule. During update, the firewall rule with the specified name will be replaced with this @@ -85,7 +93,7 @@ func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Conte func (client *FirewallRulesClient) createOrUpdateHandleResponse(resp *http.Response) (FirewallRulesCreateOrUpdateResponse, error) { result := FirewallRulesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRule); err != nil { - return FirewallRulesCreateOrUpdateResponse{}, err + return FirewallRulesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -211,7 +219,7 @@ func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourc func (client *FirewallRulesClient) getHandleResponse(resp *http.Response) (FirewallRulesGetResponse, error) { result := FirewallRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRule); err != nil { - return FirewallRulesGetResponse{}, err + return FirewallRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -272,7 +280,7 @@ func (client *FirewallRulesClient) listByAccountCreateRequest(ctx context.Contex func (client *FirewallRulesClient) listByAccountHandleResponse(resp *http.Response) (FirewallRulesListByAccountResponse, error) { result := FirewallRulesListByAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRuleListResult); err != nil { - return FirewallRulesListByAccountResponse{}, err + return FirewallRulesListByAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -343,7 +351,7 @@ func (client *FirewallRulesClient) updateCreateRequest(ctx context.Context, reso func (client *FirewallRulesClient) updateHandleResponse(resp *http.Response) (FirewallRulesUpdateResponse, error) { result := FirewallRulesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRule); err != nil { - return FirewallRulesUpdateResponse{}, err + return FirewallRulesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_locations_client.go b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_locations_client.go index 216beabd61f4..2cce251816bd 100644 --- a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_locations_client.go +++ b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_locations_client.go @@ -11,13 +11,14 @@ package armdatalakestore import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LocationsClient contains the methods for the Locations group. @@ -29,8 +30,15 @@ type LocationsClient struct { } // NewLocationsClient creates a new instance of LocationsClient with the specified values. -func NewLocationsClient(con *arm.Connection, subscriptionID string) *LocationsClient { - return &LocationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LocationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LocationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetCapability - Gets subscription-level properties and limits for Data Lake Store specified by resource location. @@ -76,7 +84,7 @@ func (client *LocationsClient) getCapabilityCreateRequest(ctx context.Context, l func (client *LocationsClient) getCapabilityHandleResponse(resp *http.Response) (LocationsGetCapabilityResponse, error) { result := LocationsGetCapabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CapabilityInformation); err != nil { - return LocationsGetCapabilityResponse{}, err + return LocationsGetCapabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -136,7 +144,7 @@ func (client *LocationsClient) getUsageCreateRequest(ctx context.Context, locati func (client *LocationsClient) getUsageHandleResponse(resp *http.Response) (LocationsGetUsageResponse, error) { result := LocationsGetUsageResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UsageListResult); err != nil { - return LocationsGetUsageResponse{}, err + return LocationsGetUsageResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_models.go b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_models.go index d923c27ab585..ff83a8d99e5f 100644 --- a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_models.go +++ b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_models.go @@ -10,10 +10,9 @@ package armdatalakestore import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // AccountsBeginCreateOptions contains the optional parameters for the Accounts.BeginCreate method. @@ -452,9 +451,9 @@ func (d *DataLakeStoreAccountPropertiesBasic) UnmarshalJSON(data []byte) error { func (d DataLakeStoreAccountPropertiesBasic) marshalInternal(objectMap map[string]interface{}) { populate(objectMap, "accountId", d.AccountID) - populate(objectMap, "creationTime", (*timeRFC3339)(d.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", d.CreationTime) populate(objectMap, "endpoint", d.Endpoint) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(d.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", d.LastModifiedTime) populate(objectMap, "provisioningState", d.ProvisioningState) populate(objectMap, "state", d.State) } @@ -467,17 +466,13 @@ func (d *DataLakeStoreAccountPropertiesBasic) unmarshalInternal(rawMsg map[strin err = unpopulate(val, &d.AccountID) delete(rawMsg, key) case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.CreationTime) delete(rawMsg, key) case "endpoint": err = unpopulate(val, &d.Endpoint) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.LastModifiedTime) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, &d.ProvisioningState) diff --git a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_operations_client.go b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_operations_client.go index 8a082f910326..f357993e8292 100644 --- a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_operations_client.go +++ b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armdatalakestore import ( "context" "errors" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available Data Lake Store REST API operations. @@ -65,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_pagers.go b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_pagers.go index e7c44b4dff97..b5fec9c359b8 100644 --- a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_pagers.go +++ b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armdatalakestore import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // AccountsListByResourceGroupPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_pollers.go b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_pollers.go index dbf9a8297129..37a1ee1ad19d 100644 --- a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_pollers.go +++ b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armdatalakestore import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // AccountsCreatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_response_types.go b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_response_types.go index 9de4104a8b51..a8dfd8050adc 100644 --- a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_response_types.go +++ b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armdatalakestore import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // AccountsCheckNameAvailabilityResponse contains the response from method Accounts.CheckNameAvailability. @@ -38,6 +37,8 @@ type AccountsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AccountsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountsCreateResponse, error) { respType := AccountsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DataLakeStoreAccount) @@ -88,6 +89,8 @@ type AccountsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AccountsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountsDeleteResponse, error) { respType := AccountsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -174,6 +177,8 @@ type AccountsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AccountsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AccountsUpdateResponse, error) { respType := AccountsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DataLakeStoreAccount) diff --git a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_time_rfc3339.go b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_time_rfc3339.go index 0fae64270e86..6735949c6df9 100644 --- a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armdatalakestore import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_trustedidproviders_client.go b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_trustedidproviders_client.go index f98ef94e1dc4..51ac21bd032a 100644 --- a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_trustedidproviders_client.go +++ b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_trustedidproviders_client.go @@ -11,13 +11,14 @@ package armdatalakestore import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TrustedIDProvidersClient contains the methods for the TrustedIDProviders group. @@ -29,8 +30,15 @@ type TrustedIDProvidersClient struct { } // NewTrustedIDProvidersClient creates a new instance of TrustedIDProvidersClient with the specified values. -func NewTrustedIDProvidersClient(con *arm.Connection, subscriptionID string) *TrustedIDProvidersClient { - return &TrustedIDProvidersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTrustedIDProvidersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TrustedIDProvidersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TrustedIDProvidersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the specified trusted identity provider. During update, the trusted identity provider with the specified name will @@ -85,7 +93,7 @@ func (client *TrustedIDProvidersClient) createOrUpdateCreateRequest(ctx context. func (client *TrustedIDProvidersClient) createOrUpdateHandleResponse(resp *http.Response) (TrustedIDProvidersCreateOrUpdateResponse, error) { result := TrustedIDProvidersCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TrustedIDProvider); err != nil { - return TrustedIDProvidersCreateOrUpdateResponse{}, err + return TrustedIDProvidersCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -211,7 +219,7 @@ func (client *TrustedIDProvidersClient) getCreateRequest(ctx context.Context, re func (client *TrustedIDProvidersClient) getHandleResponse(resp *http.Response) (TrustedIDProvidersGetResponse, error) { result := TrustedIDProvidersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TrustedIDProvider); err != nil { - return TrustedIDProvidersGetResponse{}, err + return TrustedIDProvidersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -272,7 +280,7 @@ func (client *TrustedIDProvidersClient) listByAccountCreateRequest(ctx context.C func (client *TrustedIDProvidersClient) listByAccountHandleResponse(resp *http.Response) (TrustedIDProvidersListByAccountResponse, error) { result := TrustedIDProvidersListByAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TrustedIDProviderListResult); err != nil { - return TrustedIDProvidersListByAccountResponse{}, err + return TrustedIDProvidersListByAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -343,7 +351,7 @@ func (client *TrustedIDProvidersClient) updateCreateRequest(ctx context.Context, func (client *TrustedIDProvidersClient) updateHandleResponse(resp *http.Response) (TrustedIDProvidersUpdateResponse, error) { result := TrustedIDProvidersUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TrustedIDProvider); err != nil { - return TrustedIDProvidersUpdateResponse{}, err + return TrustedIDProvidersUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_virtualnetworkrules_client.go b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_virtualnetworkrules_client.go index e4871c7c7006..217b55c1b115 100644 --- a/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_virtualnetworkrules_client.go +++ b/sdk/resourcemanager/datalake-store/armdatalakestore/zz_generated_virtualnetworkrules_client.go @@ -11,13 +11,14 @@ package armdatalakestore import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualNetworkRulesClient contains the methods for the VirtualNetworkRules group. @@ -29,8 +30,15 @@ type VirtualNetworkRulesClient struct { } // NewVirtualNetworkRulesClient creates a new instance of VirtualNetworkRulesClient with the specified values. -func NewVirtualNetworkRulesClient(con *arm.Connection, subscriptionID string) *VirtualNetworkRulesClient { - return &VirtualNetworkRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualNetworkRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualNetworkRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualNetworkRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the specified virtual network rule. During update, the virtual network rule with the specified name will be replaced @@ -85,7 +93,7 @@ func (client *VirtualNetworkRulesClient) createOrUpdateCreateRequest(ctx context func (client *VirtualNetworkRulesClient) createOrUpdateHandleResponse(resp *http.Response) (VirtualNetworkRulesCreateOrUpdateResponse, error) { result := VirtualNetworkRulesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkRule); err != nil { - return VirtualNetworkRulesCreateOrUpdateResponse{}, err + return VirtualNetworkRulesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -211,7 +219,7 @@ func (client *VirtualNetworkRulesClient) getCreateRequest(ctx context.Context, r func (client *VirtualNetworkRulesClient) getHandleResponse(resp *http.Response) (VirtualNetworkRulesGetResponse, error) { result := VirtualNetworkRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkRule); err != nil { - return VirtualNetworkRulesGetResponse{}, err + return VirtualNetworkRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -272,7 +280,7 @@ func (client *VirtualNetworkRulesClient) listByAccountCreateRequest(ctx context. func (client *VirtualNetworkRulesClient) listByAccountHandleResponse(resp *http.Response) (VirtualNetworkRulesListByAccountResponse, error) { result := VirtualNetworkRulesListByAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkRuleListResult); err != nil { - return VirtualNetworkRulesListByAccountResponse{}, err + return VirtualNetworkRulesListByAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -343,7 +351,7 @@ func (client *VirtualNetworkRulesClient) updateCreateRequest(ctx context.Context func (client *VirtualNetworkRulesClient) updateHandleResponse(resp *http.Response) (VirtualNetworkRulesUpdateResponse, error) { result := VirtualNetworkRulesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkRule); err != nil { - return VirtualNetworkRulesUpdateResponse{}, err + return VirtualNetworkRulesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/CHANGELOG.md b/sdk/resourcemanager/eventgrid/armeventgrid/CHANGELOG.md index 939429302be2..d780a2d5e5c0 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/CHANGELOG.md +++ b/sdk/resourcemanager/eventgrid/armeventgrid/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-10-08) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventgrid". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/eventgrid/armeventgrid") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/README.md b/sdk/resourcemanager/eventgrid/armeventgrid/README.md index 87c7f69cec3f..e1f2d6459fa8 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/README.md +++ b/sdk/resourcemanager/eventgrid/armeventgrid/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Event Grid +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Event Grid modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armeventgrid.NewPartnerNamespacesClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Event Grid modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armeventgrid.NewPartnerNamespacesClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armeventgrid.NewPartnerNamespacesClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/autorest.md b/sdk/resourcemanager/eventgrid/armeventgrid/autorest.md index 1d3b7b7747a9..9b15da19bfdf 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/autorest.md +++ b/sdk/resourcemanager/eventgrid/armeventgrid/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/eventgrid/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/eventgrid/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/eventgrid/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/eventgrid/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/go.mod b/sdk/resourcemanager/eventgrid/armeventgrid/go.mod index 5640107d728c..bef91b159e77 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/go.mod +++ b/sdk/resourcemanager/eventgrid/armeventgrid/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventgrid/armeventg go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/go.sum b/sdk/resourcemanager/eventgrid/armeventgrid/go.sum index 4f0fb709cf31..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/go.sum +++ b/sdk/resourcemanager/eventgrid/armeventgrid/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible h1:Cw16jiP4dI+CK761aq44ol4RV5dUiIIXky1+EKpoiVM= -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_constants.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_constants.go index 3d7230c7a80f..e57e4befc38a 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_constants.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_constants.go @@ -10,7 +10,7 @@ package armeventgrid const ( module = "armeventgrid" - version = "v0.1.0" + version = "v0.2.0" ) // AdvancedFilterOperatorType - The operator type used for filtering, e.g., NumberIn, StringContains, BoolEquals and others. @@ -18,23 +18,16 @@ type AdvancedFilterOperatorType string const ( AdvancedFilterOperatorTypeBoolEquals AdvancedFilterOperatorType = "BoolEquals" - AdvancedFilterOperatorTypeIsNotNull AdvancedFilterOperatorType = "IsNotNull" - AdvancedFilterOperatorTypeIsNullOrUndefined AdvancedFilterOperatorType = "IsNullOrUndefined" AdvancedFilterOperatorTypeNumberGreaterThan AdvancedFilterOperatorType = "NumberGreaterThan" AdvancedFilterOperatorTypeNumberGreaterThanOrEquals AdvancedFilterOperatorType = "NumberGreaterThanOrEquals" AdvancedFilterOperatorTypeNumberIn AdvancedFilterOperatorType = "NumberIn" - AdvancedFilterOperatorTypeNumberInRange AdvancedFilterOperatorType = "NumberInRange" AdvancedFilterOperatorTypeNumberLessThan AdvancedFilterOperatorType = "NumberLessThan" AdvancedFilterOperatorTypeNumberLessThanOrEquals AdvancedFilterOperatorType = "NumberLessThanOrEquals" AdvancedFilterOperatorTypeNumberNotIn AdvancedFilterOperatorType = "NumberNotIn" - AdvancedFilterOperatorTypeNumberNotInRange AdvancedFilterOperatorType = "NumberNotInRange" AdvancedFilterOperatorTypeStringBeginsWith AdvancedFilterOperatorType = "StringBeginsWith" AdvancedFilterOperatorTypeStringContains AdvancedFilterOperatorType = "StringContains" AdvancedFilterOperatorTypeStringEndsWith AdvancedFilterOperatorType = "StringEndsWith" AdvancedFilterOperatorTypeStringIn AdvancedFilterOperatorType = "StringIn" - AdvancedFilterOperatorTypeStringNotBeginsWith AdvancedFilterOperatorType = "StringNotBeginsWith" - AdvancedFilterOperatorTypeStringNotContains AdvancedFilterOperatorType = "StringNotContains" - AdvancedFilterOperatorTypeStringNotEndsWith AdvancedFilterOperatorType = "StringNotEndsWith" AdvancedFilterOperatorTypeStringNotIn AdvancedFilterOperatorType = "StringNotIn" ) @@ -42,23 +35,16 @@ const ( func PossibleAdvancedFilterOperatorTypeValues() []AdvancedFilterOperatorType { return []AdvancedFilterOperatorType{ AdvancedFilterOperatorTypeBoolEquals, - AdvancedFilterOperatorTypeIsNotNull, - AdvancedFilterOperatorTypeIsNullOrUndefined, AdvancedFilterOperatorTypeNumberGreaterThan, AdvancedFilterOperatorTypeNumberGreaterThanOrEquals, AdvancedFilterOperatorTypeNumberIn, - AdvancedFilterOperatorTypeNumberInRange, AdvancedFilterOperatorTypeNumberLessThan, AdvancedFilterOperatorTypeNumberLessThanOrEquals, AdvancedFilterOperatorTypeNumberNotIn, - AdvancedFilterOperatorTypeNumberNotInRange, AdvancedFilterOperatorTypeStringBeginsWith, AdvancedFilterOperatorTypeStringContains, AdvancedFilterOperatorTypeStringEndsWith, AdvancedFilterOperatorTypeStringIn, - AdvancedFilterOperatorTypeStringNotBeginsWith, - AdvancedFilterOperatorTypeStringNotContains, - AdvancedFilterOperatorTypeStringNotEndsWith, AdvancedFilterOperatorTypeStringNotIn, } } @@ -222,120 +208,83 @@ func (c EndpointType) ToPtr() *EndpointType { return &c } -type Enum25 string +type Enum18 string const ( - Enum25Domains Enum25 = "domains" - Enum25PartnerNamespaces Enum25 = "partnerNamespaces" - Enum25Topics Enum25 = "topics" + Enum18Domains Enum18 = "domains" + Enum18Topics Enum18 = "topics" ) -// PossibleEnum25Values returns the possible values for the Enum25 const type. -func PossibleEnum25Values() []Enum25 { - return []Enum25{ - Enum25Domains, - Enum25PartnerNamespaces, - Enum25Topics, +// PossibleEnum18Values returns the possible values for the Enum18 const type. +func PossibleEnum18Values() []Enum18 { + return []Enum18{ + Enum18Domains, + Enum18Topics, } } -// ToPtr returns a *Enum25 pointing to the current value. -func (c Enum25) ToPtr() *Enum25 { +// ToPtr returns a *Enum18 pointing to the current value. +func (c Enum18) ToPtr() *Enum18 { return &c } -type Enum26 string +type Enum19 string const ( - Enum26Domains Enum26 = "domains" - Enum26PartnerNamespaces Enum26 = "partnerNamespaces" - Enum26Topics Enum26 = "topics" + Enum19Domains Enum19 = "domains" + Enum19Topics Enum19 = "topics" ) -// PossibleEnum26Values returns the possible values for the Enum26 const type. -func PossibleEnum26Values() []Enum26 { - return []Enum26{ - Enum26Domains, - Enum26PartnerNamespaces, - Enum26Topics, +// PossibleEnum19Values returns the possible values for the Enum19 const type. +func PossibleEnum19Values() []Enum19 { + return []Enum19{ + Enum19Domains, + Enum19Topics, } } -// ToPtr returns a *Enum26 pointing to the current value. -func (c Enum26) ToPtr() *Enum26 { +// ToPtr returns a *Enum19 pointing to the current value. +func (c Enum19) ToPtr() *Enum19 { return &c } -type Enum27 string +type Enum20 string const ( - Enum27Domains Enum27 = "domains" - Enum27PartnerNamespaces Enum27 = "partnerNamespaces" - Enum27Topics Enum27 = "topics" + Enum20Domains Enum20 = "domains" + Enum20Topics Enum20 = "topics" ) -// PossibleEnum27Values returns the possible values for the Enum27 const type. -func PossibleEnum27Values() []Enum27 { - return []Enum27{ - Enum27Domains, - Enum27PartnerNamespaces, - Enum27Topics, +// PossibleEnum20Values returns the possible values for the Enum20 const type. +func PossibleEnum20Values() []Enum20 { + return []Enum20{ + Enum20Domains, + Enum20Topics, } } -// ToPtr returns a *Enum27 pointing to the current value. -func (c Enum27) ToPtr() *Enum27 { +// ToPtr returns a *Enum20 pointing to the current value. +func (c Enum20) ToPtr() *Enum20 { return &c } -type Enum28 string +type Enum21 string const ( - Enum28Domains Enum28 = "domains" - Enum28PartnerNamespaces Enum28 = "partnerNamespaces" - Enum28Topics Enum28 = "topics" + Enum21Domains Enum21 = "domains" + Enum21Topics Enum21 = "topics" ) -// PossibleEnum28Values returns the possible values for the Enum28 const type. -func PossibleEnum28Values() []Enum28 { - return []Enum28{ - Enum28Domains, - Enum28PartnerNamespaces, - Enum28Topics, +// PossibleEnum21Values returns the possible values for the Enum21 const type. +func PossibleEnum21Values() []Enum21 { + return []Enum21{ + Enum21Domains, + Enum21Topics, } } -// ToPtr returns a *Enum28 pointing to the current value. -func (c Enum28) ToPtr() *Enum28 { - return &c -} - -// EventChannelProvisioningState - Provisioning state of the event channel. -type EventChannelProvisioningState string - -const ( - EventChannelProvisioningStateCanceled EventChannelProvisioningState = "Canceled" - EventChannelProvisioningStateCreating EventChannelProvisioningState = "Creating" - EventChannelProvisioningStateDeleting EventChannelProvisioningState = "Deleting" - EventChannelProvisioningStateFailed EventChannelProvisioningState = "Failed" - EventChannelProvisioningStateSucceeded EventChannelProvisioningState = "Succeeded" - EventChannelProvisioningStateUpdating EventChannelProvisioningState = "Updating" -) - -// PossibleEventChannelProvisioningStateValues returns the possible values for the EventChannelProvisioningState const type. -func PossibleEventChannelProvisioningStateValues() []EventChannelProvisioningState { - return []EventChannelProvisioningState{ - EventChannelProvisioningStateCanceled, - EventChannelProvisioningStateCreating, - EventChannelProvisioningStateDeleting, - EventChannelProvisioningStateFailed, - EventChannelProvisioningStateSucceeded, - EventChannelProvisioningStateUpdating, - } -} - -// ToPtr returns a *EventChannelProvisioningState pointing to the current value. -func (c EventChannelProvisioningState) ToPtr() *EventChannelProvisioningState { +// ToPtr returns a *Enum21 pointing to the current value. +func (c Enum21) ToPtr() *Enum21 { return &c } @@ -460,7 +409,7 @@ func (c IdentityType) ToPtr() *IdentityType { return &c } -// InputSchema - This determines the format that Event Grid should expect for incoming events published to the Event Grid Domain Resource. +// InputSchema - This determines the format that Event Grid should expect for incoming events published to the domain. type InputSchema string const ( @@ -502,164 +451,6 @@ func (c InputSchemaMappingType) ToPtr() *InputSchemaMappingType { return &c } -// PartnerNamespaceProvisioningState - Provisioning state of the partner namespace. -type PartnerNamespaceProvisioningState string - -const ( - PartnerNamespaceProvisioningStateCanceled PartnerNamespaceProvisioningState = "Canceled" - PartnerNamespaceProvisioningStateCreating PartnerNamespaceProvisioningState = "Creating" - PartnerNamespaceProvisioningStateDeleting PartnerNamespaceProvisioningState = "Deleting" - PartnerNamespaceProvisioningStateFailed PartnerNamespaceProvisioningState = "Failed" - PartnerNamespaceProvisioningStateSucceeded PartnerNamespaceProvisioningState = "Succeeded" - PartnerNamespaceProvisioningStateUpdating PartnerNamespaceProvisioningState = "Updating" -) - -// PossiblePartnerNamespaceProvisioningStateValues returns the possible values for the PartnerNamespaceProvisioningState const type. -func PossiblePartnerNamespaceProvisioningStateValues() []PartnerNamespaceProvisioningState { - return []PartnerNamespaceProvisioningState{ - PartnerNamespaceProvisioningStateCanceled, - PartnerNamespaceProvisioningStateCreating, - PartnerNamespaceProvisioningStateDeleting, - PartnerNamespaceProvisioningStateFailed, - PartnerNamespaceProvisioningStateSucceeded, - PartnerNamespaceProvisioningStateUpdating, - } -} - -// ToPtr returns a *PartnerNamespaceProvisioningState pointing to the current value. -func (c PartnerNamespaceProvisioningState) ToPtr() *PartnerNamespaceProvisioningState { - return &c -} - -// PartnerRegistrationProvisioningState - Provisioning state of the partner registration. -type PartnerRegistrationProvisioningState string - -const ( - PartnerRegistrationProvisioningStateCanceled PartnerRegistrationProvisioningState = "Canceled" - PartnerRegistrationProvisioningStateCreating PartnerRegistrationProvisioningState = "Creating" - PartnerRegistrationProvisioningStateDeleting PartnerRegistrationProvisioningState = "Deleting" - PartnerRegistrationProvisioningStateFailed PartnerRegistrationProvisioningState = "Failed" - PartnerRegistrationProvisioningStateSucceeded PartnerRegistrationProvisioningState = "Succeeded" - PartnerRegistrationProvisioningStateUpdating PartnerRegistrationProvisioningState = "Updating" -) - -// PossiblePartnerRegistrationProvisioningStateValues returns the possible values for the PartnerRegistrationProvisioningState const type. -func PossiblePartnerRegistrationProvisioningStateValues() []PartnerRegistrationProvisioningState { - return []PartnerRegistrationProvisioningState{ - PartnerRegistrationProvisioningStateCanceled, - PartnerRegistrationProvisioningStateCreating, - PartnerRegistrationProvisioningStateDeleting, - PartnerRegistrationProvisioningStateFailed, - PartnerRegistrationProvisioningStateSucceeded, - PartnerRegistrationProvisioningStateUpdating, - } -} - -// ToPtr returns a *PartnerRegistrationProvisioningState pointing to the current value. -func (c PartnerRegistrationProvisioningState) ToPtr() *PartnerRegistrationProvisioningState { - return &c -} - -// PartnerRegistrationVisibilityState - Visibility state of the partner registration. -type PartnerRegistrationVisibilityState string - -const ( - PartnerRegistrationVisibilityStateGenerallyAvailable PartnerRegistrationVisibilityState = "GenerallyAvailable" - PartnerRegistrationVisibilityStateHidden PartnerRegistrationVisibilityState = "Hidden" - PartnerRegistrationVisibilityStatePublicPreview PartnerRegistrationVisibilityState = "PublicPreview" -) - -// PossiblePartnerRegistrationVisibilityStateValues returns the possible values for the PartnerRegistrationVisibilityState const type. -func PossiblePartnerRegistrationVisibilityStateValues() []PartnerRegistrationVisibilityState { - return []PartnerRegistrationVisibilityState{ - PartnerRegistrationVisibilityStateGenerallyAvailable, - PartnerRegistrationVisibilityStateHidden, - PartnerRegistrationVisibilityStatePublicPreview, - } -} - -// ToPtr returns a *PartnerRegistrationVisibilityState pointing to the current value. -func (c PartnerRegistrationVisibilityState) ToPtr() *PartnerRegistrationVisibilityState { - return &c -} - -// PartnerTopicActivationState - Activation state of the partner topic. -type PartnerTopicActivationState string - -const ( - PartnerTopicActivationStateActivated PartnerTopicActivationState = "Activated" - PartnerTopicActivationStateDeactivated PartnerTopicActivationState = "Deactivated" - PartnerTopicActivationStateNeverActivated PartnerTopicActivationState = "NeverActivated" -) - -// PossiblePartnerTopicActivationStateValues returns the possible values for the PartnerTopicActivationState const type. -func PossiblePartnerTopicActivationStateValues() []PartnerTopicActivationState { - return []PartnerTopicActivationState{ - PartnerTopicActivationStateActivated, - PartnerTopicActivationStateDeactivated, - PartnerTopicActivationStateNeverActivated, - } -} - -// ToPtr returns a *PartnerTopicActivationState pointing to the current value. -func (c PartnerTopicActivationState) ToPtr() *PartnerTopicActivationState { - return &c -} - -// PartnerTopicProvisioningState - Provisioning state of the partner topic. -type PartnerTopicProvisioningState string - -const ( - PartnerTopicProvisioningStateCanceled PartnerTopicProvisioningState = "Canceled" - PartnerTopicProvisioningStateCreating PartnerTopicProvisioningState = "Creating" - PartnerTopicProvisioningStateDeleting PartnerTopicProvisioningState = "Deleting" - PartnerTopicProvisioningStateFailed PartnerTopicProvisioningState = "Failed" - PartnerTopicProvisioningStateSucceeded PartnerTopicProvisioningState = "Succeeded" - PartnerTopicProvisioningStateUpdating PartnerTopicProvisioningState = "Updating" -) - -// PossiblePartnerTopicProvisioningStateValues returns the possible values for the PartnerTopicProvisioningState const type. -func PossiblePartnerTopicProvisioningStateValues() []PartnerTopicProvisioningState { - return []PartnerTopicProvisioningState{ - PartnerTopicProvisioningStateCanceled, - PartnerTopicProvisioningStateCreating, - PartnerTopicProvisioningStateDeleting, - PartnerTopicProvisioningStateFailed, - PartnerTopicProvisioningStateSucceeded, - PartnerTopicProvisioningStateUpdating, - } -} - -// ToPtr returns a *PartnerTopicProvisioningState pointing to the current value. -func (c PartnerTopicProvisioningState) ToPtr() *PartnerTopicProvisioningState { - return &c -} - -// PartnerTopicReadinessState - The readiness state of the corresponding partner topic. -type PartnerTopicReadinessState string - -const ( - PartnerTopicReadinessStateActivatedByUser PartnerTopicReadinessState = "ActivatedByUser" - PartnerTopicReadinessStateDeactivatedByUser PartnerTopicReadinessState = "DeactivatedByUser" - PartnerTopicReadinessStateDeletedByUser PartnerTopicReadinessState = "DeletedByUser" - PartnerTopicReadinessStateNotActivatedByUserYet PartnerTopicReadinessState = "NotActivatedByUserYet" -) - -// PossiblePartnerTopicReadinessStateValues returns the possible values for the PartnerTopicReadinessState const type. -func PossiblePartnerTopicReadinessStateValues() []PartnerTopicReadinessState { - return []PartnerTopicReadinessState{ - PartnerTopicReadinessStateActivatedByUser, - PartnerTopicReadinessStateDeactivatedByUser, - PartnerTopicReadinessStateDeletedByUser, - PartnerTopicReadinessStateNotActivatedByUserYet, - } -} - -// ToPtr returns a *PartnerTopicReadinessState pointing to the current value. -func (c PartnerTopicReadinessState) ToPtr() *PartnerTopicReadinessState { - return &c -} - // PersistedConnectionStatus - Status of the connection. type PersistedConnectionStatus string @@ -707,27 +498,6 @@ func (c PublicNetworkAccess) ToPtr() *PublicNetworkAccess { return &c } -// ResourceKind - Kind of the resource. -type ResourceKind string - -const ( - ResourceKindAzure ResourceKind = "Azure" - ResourceKindAzureArc ResourceKind = "AzureArc" -) - -// PossibleResourceKindValues returns the possible values for the ResourceKind const type. -func PossibleResourceKindValues() []ResourceKind { - return []ResourceKind{ - ResourceKindAzure, - ResourceKindAzureArc, - } -} - -// ToPtr returns a *ResourceKind pointing to the current value. -func (c ResourceKind) ToPtr() *ResourceKind { - return &c -} - // ResourceProvisioningState - Provisioning state of the Private Endpoint Connection. type ResourceProvisioningState string @@ -778,27 +548,6 @@ func (c ResourceRegionType) ToPtr() *ResourceRegionType { return &c } -// SKU - The Sku name of the resource. The possible values are: Basic or Premium. -type SKU string - -const ( - SKUBasic SKU = "Basic" - SKUPremium SKU = "Premium" -) - -// PossibleSKUValues returns the possible values for the SKU const type. -func PossibleSKUValues() []SKU { - return []SKU{ - SKUBasic, - SKUPremium, - } -} - -// ToPtr returns a *SKU pointing to the current value. -func (c SKU) ToPtr() *SKU { - return &c -} - // TopicProvisioningState - Provisioning state of the topic. type TopicProvisioningState string diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_domains_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_domains_client.go index 531ab35a0ce4..e6ef99e71ad2 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_domains_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_domains_client.go @@ -11,15 +11,15 @@ package armeventgrid import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // DomainsClient contains the methods for the Domains group. @@ -31,8 +31,15 @@ type DomainsClient struct { } // NewDomainsClient creates a new instance of DomainsClient with the specified values. -func NewDomainsClient(con *arm.Connection, subscriptionID string) *DomainsClient { - return &DomainsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDomainsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DomainsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DomainsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Asynchronously creates or updates a new domain with the specified parameters. @@ -92,7 +99,7 @@ func (client *DomainsClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, domainInfo) @@ -167,7 +174,7 @@ func (client *DomainsClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -221,7 +228,7 @@ func (client *DomainsClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -231,7 +238,7 @@ func (client *DomainsClient) getCreateRequest(ctx context.Context, resourceGroup func (client *DomainsClient) getHandleResponse(resp *http.Response) (DomainsGetResponse, error) { result := DomainsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Domain); err != nil { - return DomainsGetResponse{}, err + return DomainsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -278,7 +285,7 @@ func (client *DomainsClient) listByResourceGroupCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -294,7 +301,7 @@ func (client *DomainsClient) listByResourceGroupCreateRequest(ctx context.Contex func (client *DomainsClient) listByResourceGroupHandleResponse(resp *http.Response) (DomainsListByResourceGroupResponse, error) { result := DomainsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DomainsListResult); err != nil { - return DomainsListByResourceGroupResponse{}, err + return DomainsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -337,7 +344,7 @@ func (client *DomainsClient) listBySubscriptionCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -353,7 +360,7 @@ func (client *DomainsClient) listBySubscriptionCreateRequest(ctx context.Context func (client *DomainsClient) listBySubscriptionHandleResponse(resp *http.Response) (DomainsListBySubscriptionResponse, error) { result := DomainsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DomainsListResult); err != nil { - return DomainsListBySubscriptionResponse{}, err + return DomainsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -407,7 +414,7 @@ func (client *DomainsClient) listSharedAccessKeysCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -417,7 +424,7 @@ func (client *DomainsClient) listSharedAccessKeysCreateRequest(ctx context.Conte func (client *DomainsClient) listSharedAccessKeysHandleResponse(resp *http.Response) (DomainsListSharedAccessKeysResponse, error) { result := DomainsListSharedAccessKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DomainSharedAccessKeys); err != nil { - return DomainsListSharedAccessKeysResponse{}, err + return DomainsListSharedAccessKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -471,7 +478,7 @@ func (client *DomainsClient) regenerateKeyCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, regenerateKeyRequest) @@ -481,7 +488,7 @@ func (client *DomainsClient) regenerateKeyCreateRequest(ctx context.Context, res func (client *DomainsClient) regenerateKeyHandleResponse(resp *http.Response) (DomainsRegenerateKeyResponse, error) { result := DomainsRegenerateKeyResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DomainSharedAccessKeys); err != nil { - return DomainsRegenerateKeyResponse{}, err + return DomainsRegenerateKeyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -555,7 +562,7 @@ func (client *DomainsClient) updateCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, domainUpdateParameters) diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_domaintopics_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_domaintopics_client.go index 5656468443bc..47ccdf9cece0 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_domaintopics_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_domaintopics_client.go @@ -11,15 +11,15 @@ package armeventgrid import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // DomainTopicsClient contains the methods for the DomainTopics group. @@ -31,8 +31,15 @@ type DomainTopicsClient struct { } // NewDomainTopicsClient creates a new instance of DomainTopicsClient with the specified values. -func NewDomainTopicsClient(con *arm.Connection, subscriptionID string) *DomainTopicsClient { - return &DomainTopicsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDomainTopicsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DomainTopicsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DomainTopicsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Asynchronously creates or updates a new domain topic with the specified parameters. @@ -96,7 +103,7 @@ func (client *DomainTopicsClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -175,7 +182,7 @@ func (client *DomainTopicsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -233,7 +240,7 @@ func (client *DomainTopicsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -243,7 +250,7 @@ func (client *DomainTopicsClient) getCreateRequest(ctx context.Context, resource func (client *DomainTopicsClient) getHandleResponse(resp *http.Response) (DomainTopicsGetResponse, error) { result := DomainTopicsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DomainTopic); err != nil { - return DomainTopicsGetResponse{}, err + return DomainTopicsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -294,7 +301,7 @@ func (client *DomainTopicsClient) listByDomainCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -310,7 +317,7 @@ func (client *DomainTopicsClient) listByDomainCreateRequest(ctx context.Context, func (client *DomainTopicsClient) listByDomainHandleResponse(resp *http.Response) (DomainTopicsListByDomainResponse, error) { result := DomainTopicsListByDomainResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DomainTopicsListResult); err != nil { - return DomainTopicsListByDomainResponse{}, err + return DomainTopicsListByDomainResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_eventchannels_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_eventchannels_client.go deleted file mode 100644 index d89fe541bda0..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_eventchannels_client.go +++ /dev/null @@ -1,317 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armeventgrid - -import ( - "context" - "errors" - "net/http" - "net/url" - "strconv" - "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" -) - -// EventChannelsClient contains the methods for the EventChannels group. -// Don't use this type directly, use NewEventChannelsClient() instead. -type EventChannelsClient struct { - ep string - pl runtime.Pipeline - subscriptionID string -} - -// NewEventChannelsClient creates a new instance of EventChannelsClient with the specified values. -func NewEventChannelsClient(con *arm.Connection, subscriptionID string) *EventChannelsClient { - return &EventChannelsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} -} - -// CreateOrUpdate - Asynchronously creates a new event channel with the specified parameters. -// If the operation fails it returns a generic error. -func (client *EventChannelsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string, eventChannelInfo EventChannel, options *EventChannelsCreateOrUpdateOptions) (EventChannelsCreateOrUpdateResponse, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, partnerNamespaceName, eventChannelName, eventChannelInfo, options) - if err != nil { - return EventChannelsCreateOrUpdateResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return EventChannelsCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EventChannelsCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) - } - return client.createOrUpdateHandleResponse(resp) -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *EventChannelsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string, eventChannelInfo EventChannel, options *EventChannelsCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerNamespaceName == "" { - return nil, errors.New("parameter partnerNamespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerNamespaceName}", url.PathEscape(partnerNamespaceName)) - if eventChannelName == "" { - return nil, errors.New("parameter eventChannelName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{eventChannelName}", url.PathEscape(eventChannelName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, runtime.MarshalAsJSON(req, eventChannelInfo) -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *EventChannelsClient) createOrUpdateHandleResponse(resp *http.Response) (EventChannelsCreateOrUpdateResponse, error) { - result := EventChannelsCreateOrUpdateResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.EventChannel); err != nil { - return EventChannelsCreateOrUpdateResponse{}, err - } - return result, nil -} - -// createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *EventChannelsClient) createOrUpdateHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// BeginDelete - Delete existing event channel. -// If the operation fails it returns a generic error. -func (client *EventChannelsClient) BeginDelete(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string, options *EventChannelsBeginDeleteOptions) (EventChannelsDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, partnerNamespaceName, eventChannelName, options) - if err != nil { - return EventChannelsDeletePollerResponse{}, err - } - result := EventChannelsDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("EventChannelsClient.Delete", "", resp, client.pl, client.deleteHandleError) - if err != nil { - return EventChannelsDeletePollerResponse{}, err - } - result.Poller = &EventChannelsDeletePoller{ - pt: pt, - } - return result, nil -} - -// Delete - Delete existing event channel. -// If the operation fails it returns a generic error. -func (client *EventChannelsClient) deleteOperation(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string, options *EventChannelsBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, partnerNamespaceName, eventChannelName, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, client.deleteHandleError(resp) - } - return resp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *EventChannelsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string, options *EventChannelsBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerNamespaceName == "" { - return nil, errors.New("parameter partnerNamespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerNamespaceName}", url.PathEscape(partnerNamespaceName)) - if eventChannelName == "" { - return nil, errors.New("parameter eventChannelName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{eventChannelName}", url.PathEscape(eventChannelName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - return req, nil -} - -// deleteHandleError handles the Delete error response. -func (client *EventChannelsClient) deleteHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// Get - Get properties of an event channel. -// If the operation fails it returns a generic error. -func (client *EventChannelsClient) Get(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string, options *EventChannelsGetOptions) (EventChannelsGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, partnerNamespaceName, eventChannelName, options) - if err != nil { - return EventChannelsGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return EventChannelsGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return EventChannelsGetResponse{}, client.getHandleError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *EventChannelsClient) getCreateRequest(ctx context.Context, resourceGroupName string, partnerNamespaceName string, eventChannelName string, options *EventChannelsGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels/{eventChannelName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerNamespaceName == "" { - return nil, errors.New("parameter partnerNamespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerNamespaceName}", url.PathEscape(partnerNamespaceName)) - if eventChannelName == "" { - return nil, errors.New("parameter eventChannelName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{eventChannelName}", url.PathEscape(eventChannelName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *EventChannelsClient) getHandleResponse(resp *http.Response) (EventChannelsGetResponse, error) { - result := EventChannelsGetResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.EventChannel); err != nil { - return EventChannelsGetResponse{}, err - } - return result, nil -} - -// getHandleError handles the Get error response. -func (client *EventChannelsClient) getHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// ListByPartnerNamespace - List all the event channels in a partner namespace. -// If the operation fails it returns a generic error. -func (client *EventChannelsClient) ListByPartnerNamespace(resourceGroupName string, partnerNamespaceName string, options *EventChannelsListByPartnerNamespaceOptions) *EventChannelsListByPartnerNamespacePager { - return &EventChannelsListByPartnerNamespacePager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByPartnerNamespaceCreateRequest(ctx, resourceGroupName, partnerNamespaceName, options) - }, - advancer: func(ctx context.Context, resp EventChannelsListByPartnerNamespaceResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.EventChannelsListResult.NextLink) - }, - } -} - -// listByPartnerNamespaceCreateRequest creates the ListByPartnerNamespace request. -func (client *EventChannelsClient) listByPartnerNamespaceCreateRequest(ctx context.Context, resourceGroupName string, partnerNamespaceName string, options *EventChannelsListByPartnerNamespaceOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/eventChannels" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerNamespaceName == "" { - return nil, errors.New("parameter partnerNamespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerNamespaceName}", url.PathEscape(partnerNamespaceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// listByPartnerNamespaceHandleResponse handles the ListByPartnerNamespace response. -func (client *EventChannelsClient) listByPartnerNamespaceHandleResponse(resp *http.Response) (EventChannelsListByPartnerNamespaceResponse, error) { - result := EventChannelsListByPartnerNamespaceResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.EventChannelsListResult); err != nil { - return EventChannelsListByPartnerNamespaceResponse{}, err - } - return result, nil -} - -// listByPartnerNamespaceHandleError handles the ListByPartnerNamespace error response. -func (client *EventChannelsClient) listByPartnerNamespaceHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_eventsubscriptions_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_eventsubscriptions_client.go index d53233a6fcb3..96cf733d92e9 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_eventsubscriptions_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_eventsubscriptions_client.go @@ -11,15 +11,15 @@ package armeventgrid import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // EventSubscriptionsClient contains the methods for the EventSubscriptions group. @@ -31,8 +31,15 @@ type EventSubscriptionsClient struct { } // NewEventSubscriptionsClient creates a new instance of EventSubscriptionsClient with the specified values. -func NewEventSubscriptionsClient(con *arm.Connection, subscriptionID string) *EventSubscriptionsClient { - return &EventSubscriptionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewEventSubscriptionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *EventSubscriptionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &EventSubscriptionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Asynchronously creates a new event subscription or updates an existing event subscription based on the specified scope. @@ -75,9 +82,6 @@ func (client *EventSubscriptionsClient) createOrUpdate(ctx context.Context, scop // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *EventSubscriptionsClient) createOrUpdateCreateRequest(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription, options *EventSubscriptionsBeginCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if eventSubscriptionName == "" { return nil, errors.New("parameter eventSubscriptionName cannot be empty") @@ -88,7 +92,7 @@ func (client *EventSubscriptionsClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, eventSubscriptionInfo) @@ -146,9 +150,6 @@ func (client *EventSubscriptionsClient) deleteOperation(ctx context.Context, sco // deleteCreateRequest creates the Delete request. func (client *EventSubscriptionsClient) deleteCreateRequest(ctx context.Context, scope string, eventSubscriptionName string, options *EventSubscriptionsBeginDeleteOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if eventSubscriptionName == "" { return nil, errors.New("parameter eventSubscriptionName cannot be empty") @@ -159,7 +160,7 @@ func (client *EventSubscriptionsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -196,9 +197,6 @@ func (client *EventSubscriptionsClient) Get(ctx context.Context, scope string, e // getCreateRequest creates the Get request. func (client *EventSubscriptionsClient) getCreateRequest(ctx context.Context, scope string, eventSubscriptionName string, options *EventSubscriptionsGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if eventSubscriptionName == "" { return nil, errors.New("parameter eventSubscriptionName cannot be empty") @@ -209,7 +207,7 @@ func (client *EventSubscriptionsClient) getCreateRequest(ctx context.Context, sc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -219,7 +217,7 @@ func (client *EventSubscriptionsClient) getCreateRequest(ctx context.Context, sc func (client *EventSubscriptionsClient) getHandleResponse(resp *http.Response) (EventSubscriptionsGetResponse, error) { result := EventSubscriptionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventSubscription); err != nil { - return EventSubscriptionsGetResponse{}, err + return EventSubscriptionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -256,9 +254,6 @@ func (client *EventSubscriptionsClient) GetDeliveryAttributes(ctx context.Contex // getDeliveryAttributesCreateRequest creates the GetDeliveryAttributes request. func (client *EventSubscriptionsClient) getDeliveryAttributesCreateRequest(ctx context.Context, scope string, eventSubscriptionName string, options *EventSubscriptionsGetDeliveryAttributesOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if eventSubscriptionName == "" { return nil, errors.New("parameter eventSubscriptionName cannot be empty") @@ -269,7 +264,7 @@ func (client *EventSubscriptionsClient) getDeliveryAttributesCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -279,7 +274,7 @@ func (client *EventSubscriptionsClient) getDeliveryAttributesCreateRequest(ctx c func (client *EventSubscriptionsClient) getDeliveryAttributesHandleResponse(resp *http.Response) (EventSubscriptionsGetDeliveryAttributesResponse, error) { result := EventSubscriptionsGetDeliveryAttributesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeliveryAttributeListResult); err != nil { - return EventSubscriptionsGetDeliveryAttributesResponse{}, err + return EventSubscriptionsGetDeliveryAttributesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -316,9 +311,6 @@ func (client *EventSubscriptionsClient) GetFullURL(ctx context.Context, scope st // getFullURLCreateRequest creates the GetFullURL request. func (client *EventSubscriptionsClient) getFullURLCreateRequest(ctx context.Context, scope string, eventSubscriptionName string, options *EventSubscriptionsGetFullURLOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}/getFullUrl" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if eventSubscriptionName == "" { return nil, errors.New("parameter eventSubscriptionName cannot be empty") @@ -329,7 +321,7 @@ func (client *EventSubscriptionsClient) getFullURLCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -339,7 +331,7 @@ func (client *EventSubscriptionsClient) getFullURLCreateRequest(ctx context.Cont func (client *EventSubscriptionsClient) getFullURLHandleResponse(resp *http.Response) (EventSubscriptionsGetFullURLResponse, error) { result := EventSubscriptionsGetFullURLResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventSubscriptionFullURL); err != nil { - return EventSubscriptionsGetFullURLResponse{}, err + return EventSubscriptionsGetFullURLResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -394,7 +386,7 @@ func (client *EventSubscriptionsClient) listByDomainTopicCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -410,7 +402,7 @@ func (client *EventSubscriptionsClient) listByDomainTopicCreateRequest(ctx conte func (client *EventSubscriptionsClient) listByDomainTopicHandleResponse(resp *http.Response) (EventSubscriptionsListByDomainTopicResponse, error) { result := EventSubscriptionsListByDomainTopicResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventSubscriptionsListResult); err != nil { - return EventSubscriptionsListByDomainTopicResponse{}, err + return EventSubscriptionsListByDomainTopicResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -469,7 +461,7 @@ func (client *EventSubscriptionsClient) listByResourceCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -485,7 +477,7 @@ func (client *EventSubscriptionsClient) listByResourceCreateRequest(ctx context. func (client *EventSubscriptionsClient) listByResourceHandleResponse(resp *http.Response) (EventSubscriptionsListByResourceResponse, error) { result := EventSubscriptionsListByResourceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventSubscriptionsListResult); err != nil { - return EventSubscriptionsListByResourceResponse{}, err + return EventSubscriptionsListByResourceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -532,7 +524,7 @@ func (client *EventSubscriptionsClient) listGlobalByResourceGroupCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -548,7 +540,7 @@ func (client *EventSubscriptionsClient) listGlobalByResourceGroupCreateRequest(c func (client *EventSubscriptionsClient) listGlobalByResourceGroupHandleResponse(resp *http.Response) (EventSubscriptionsListGlobalByResourceGroupResponse, error) { result := EventSubscriptionsListGlobalByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventSubscriptionsListResult); err != nil { - return EventSubscriptionsListGlobalByResourceGroupResponse{}, err + return EventSubscriptionsListGlobalByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -599,7 +591,7 @@ func (client *EventSubscriptionsClient) listGlobalByResourceGroupForTopicTypeCre return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -615,7 +607,7 @@ func (client *EventSubscriptionsClient) listGlobalByResourceGroupForTopicTypeCre func (client *EventSubscriptionsClient) listGlobalByResourceGroupForTopicTypeHandleResponse(resp *http.Response) (EventSubscriptionsListGlobalByResourceGroupForTopicTypeResponse, error) { result := EventSubscriptionsListGlobalByResourceGroupForTopicTypeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventSubscriptionsListResult); err != nil { - return EventSubscriptionsListGlobalByResourceGroupForTopicTypeResponse{}, err + return EventSubscriptionsListGlobalByResourceGroupForTopicTypeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -658,7 +650,7 @@ func (client *EventSubscriptionsClient) listGlobalBySubscriptionCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -674,7 +666,7 @@ func (client *EventSubscriptionsClient) listGlobalBySubscriptionCreateRequest(ct func (client *EventSubscriptionsClient) listGlobalBySubscriptionHandleResponse(resp *http.Response) (EventSubscriptionsListGlobalBySubscriptionResponse, error) { result := EventSubscriptionsListGlobalBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventSubscriptionsListResult); err != nil { - return EventSubscriptionsListGlobalBySubscriptionResponse{}, err + return EventSubscriptionsListGlobalBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -721,7 +713,7 @@ func (client *EventSubscriptionsClient) listGlobalBySubscriptionForTopicTypeCrea return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -737,7 +729,7 @@ func (client *EventSubscriptionsClient) listGlobalBySubscriptionForTopicTypeCrea func (client *EventSubscriptionsClient) listGlobalBySubscriptionForTopicTypeHandleResponse(resp *http.Response) (EventSubscriptionsListGlobalBySubscriptionForTopicTypeResponse, error) { result := EventSubscriptionsListGlobalBySubscriptionForTopicTypeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventSubscriptionsListResult); err != nil { - return EventSubscriptionsListGlobalBySubscriptionForTopicTypeResponse{}, err + return EventSubscriptionsListGlobalBySubscriptionForTopicTypeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -788,7 +780,7 @@ func (client *EventSubscriptionsClient) listRegionalByResourceGroupCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -804,7 +796,7 @@ func (client *EventSubscriptionsClient) listRegionalByResourceGroupCreateRequest func (client *EventSubscriptionsClient) listRegionalByResourceGroupHandleResponse(resp *http.Response) (EventSubscriptionsListRegionalByResourceGroupResponse, error) { result := EventSubscriptionsListRegionalByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventSubscriptionsListResult); err != nil { - return EventSubscriptionsListRegionalByResourceGroupResponse{}, err + return EventSubscriptionsListRegionalByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -860,7 +852,7 @@ func (client *EventSubscriptionsClient) listRegionalByResourceGroupForTopicTypeC return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -876,7 +868,7 @@ func (client *EventSubscriptionsClient) listRegionalByResourceGroupForTopicTypeC func (client *EventSubscriptionsClient) listRegionalByResourceGroupForTopicTypeHandleResponse(resp *http.Response) (EventSubscriptionsListRegionalByResourceGroupForTopicTypeResponse, error) { result := EventSubscriptionsListRegionalByResourceGroupForTopicTypeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventSubscriptionsListResult); err != nil { - return EventSubscriptionsListRegionalByResourceGroupForTopicTypeResponse{}, err + return EventSubscriptionsListRegionalByResourceGroupForTopicTypeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -923,7 +915,7 @@ func (client *EventSubscriptionsClient) listRegionalBySubscriptionCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -939,7 +931,7 @@ func (client *EventSubscriptionsClient) listRegionalBySubscriptionCreateRequest( func (client *EventSubscriptionsClient) listRegionalBySubscriptionHandleResponse(resp *http.Response) (EventSubscriptionsListRegionalBySubscriptionResponse, error) { result := EventSubscriptionsListRegionalBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventSubscriptionsListResult); err != nil { - return EventSubscriptionsListRegionalBySubscriptionResponse{}, err + return EventSubscriptionsListRegionalBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -990,7 +982,7 @@ func (client *EventSubscriptionsClient) listRegionalBySubscriptionForTopicTypeCr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -1006,7 +998,7 @@ func (client *EventSubscriptionsClient) listRegionalBySubscriptionForTopicTypeCr func (client *EventSubscriptionsClient) listRegionalBySubscriptionForTopicTypeHandleResponse(resp *http.Response) (EventSubscriptionsListRegionalBySubscriptionForTopicTypeResponse, error) { result := EventSubscriptionsListRegionalBySubscriptionForTopicTypeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventSubscriptionsListResult); err != nil { - return EventSubscriptionsListRegionalBySubscriptionForTopicTypeResponse{}, err + return EventSubscriptionsListRegionalBySubscriptionForTopicTypeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1063,9 +1055,6 @@ func (client *EventSubscriptionsClient) update(ctx context.Context, scope string // updateCreateRequest creates the Update request. func (client *EventSubscriptionsClient) updateCreateRequest(ctx context.Context, scope string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters, options *EventSubscriptionsBeginUpdateOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.EventGrid/eventSubscriptions/{eventSubscriptionName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if eventSubscriptionName == "" { return nil, errors.New("parameter eventSubscriptionName cannot be empty") @@ -1076,7 +1065,7 @@ func (client *EventSubscriptionsClient) updateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, eventSubscriptionUpdateParameters) diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_extensiontopics_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_extensiontopics_client.go index f205553180db..237371f38f87 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_extensiontopics_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_extensiontopics_client.go @@ -11,13 +11,14 @@ package armeventgrid import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ExtensionTopicsClient contains the methods for the ExtensionTopics group. @@ -28,8 +29,15 @@ type ExtensionTopicsClient struct { } // NewExtensionTopicsClient creates a new instance of ExtensionTopicsClient with the specified values. -func NewExtensionTopicsClient(con *arm.Connection) *ExtensionTopicsClient { - return &ExtensionTopicsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewExtensionTopicsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ExtensionTopicsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ExtensionTopicsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get the properties of an extension topic. @@ -61,7 +69,7 @@ func (client *ExtensionTopicsClient) getCreateRequest(ctx context.Context, scope return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -71,7 +79,7 @@ func (client *ExtensionTopicsClient) getCreateRequest(ctx context.Context, scope func (client *ExtensionTopicsClient) getHandleResponse(resp *http.Response) (ExtensionTopicsGetResponse, error) { result := ExtensionTopicsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExtensionTopic); err != nil { - return ExtensionTopicsGetResponse{}, err + return ExtensionTopicsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_models.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_models.go index 74bea2ea0353..0ab129931c89 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_models.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_models.go @@ -10,20 +10,18 @@ package armeventgrid import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // AdvancedFilterClassification provides polymorphic access to related types. // Call the interface's GetAdvancedFilter() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: -// - *AdvancedFilter, *BoolEqualsAdvancedFilter, *IsNotNullAdvancedFilter, *IsNullOrUndefinedAdvancedFilter, *NumberGreaterThanAdvancedFilter, -// - *NumberGreaterThanOrEqualsAdvancedFilter, *NumberInAdvancedFilter, *NumberInRangeAdvancedFilter, *NumberLessThanAdvancedFilter, -// - *NumberLessThanOrEqualsAdvancedFilter, *NumberNotInAdvancedFilter, *NumberNotInRangeAdvancedFilter, *StringBeginsWithAdvancedFilter, -// - *StringContainsAdvancedFilter, *StringEndsWithAdvancedFilter, *StringInAdvancedFilter, *StringNotBeginsWithAdvancedFilter, -// - *StringNotContainsAdvancedFilter, *StringNotEndsWithAdvancedFilter, *StringNotInAdvancedFilter +// - *AdvancedFilter, *BoolEqualsAdvancedFilter, *NumberGreaterThanAdvancedFilter, *NumberGreaterThanOrEqualsAdvancedFilter, +// - *NumberInAdvancedFilter, *NumberLessThanAdvancedFilter, *NumberLessThanOrEqualsAdvancedFilter, *NumberNotInAdvancedFilter, +// - *StringBeginsWithAdvancedFilter, *StringContainsAdvancedFilter, *StringEndsWithAdvancedFilter, *StringInAdvancedFilter, +// - *StringNotInAdvancedFilter type AdvancedFilterClassification interface { // GetAdvancedFilter returns the AdvancedFilter content of the underlying type. GetAdvancedFilter() *AdvancedFilter @@ -447,10 +445,7 @@ type Domain struct { // Properties of the Event Grid Domain resource. Properties *DomainProperties `json:"properties,omitempty"` - // The Sku pricing tier for the Event Grid Domain resource. - SKU *ResourceSKU `json:"sku,omitempty"` - - // READ-ONLY; The system metadata relating to the Event Grid Domain resource. + // READ-ONLY; The system metadata relating to Domain resource. SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` } @@ -460,7 +455,6 @@ func (d Domain) MarshalJSON() ([]byte, error) { d.TrackedResource.marshalInternal(objectMap) populate(objectMap, "identity", d.Identity) populate(objectMap, "properties", d.Properties) - populate(objectMap, "sku", d.SKU) populate(objectMap, "systemData", d.SystemData) return json.Marshal(objectMap) } @@ -496,7 +490,7 @@ type DomainProperties struct { // This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. InboundIPRules []*InboundIPRule `json:"inboundIpRules,omitempty"` - // This determines the format that Event Grid should expect for incoming events published to the Event Grid Domain Resource. + // This determines the format that Event Grid should expect for incoming events published to the domain. InputSchema *InputSchema `json:"inputSchema,omitempty"` // Information about the InputSchemaMapping which specified the info about mapping event payload. @@ -505,10 +499,10 @@ type DomainProperties struct { // This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific IPs by configuring PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - // READ-ONLY; Endpoint for the Event Grid Domain Resource which is used for publishing the events. + // READ-ONLY; Endpoint for the domain. Endpoint *string `json:"endpoint,omitempty" azure:"ro"` - // READ-ONLY; Metric resource id for the Event Grid Domain Resource. + // READ-ONLY; Metric resource id for the domain. MetricResourceID *string `json:"metricResourceId,omitempty" azure:"ro"` // READ-ONLY; List of private endpoint connections. @@ -723,9 +717,6 @@ type DomainUpdateParameters struct { // Properties of the resource. Properties *DomainUpdateParameterProperties `json:"properties,omitempty"` - // The Sku pricing tier for the domain. - SKU *ResourceSKU `json:"sku,omitempty"` - // Tags of the domains resource. Tags map[string]*string `json:"tags,omitempty"` } @@ -735,7 +726,6 @@ func (d DomainUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "identity", d.Identity) populate(objectMap, "properties", d.Properties) - populate(objectMap, "sku", d.SKU) populate(objectMap, "tags", d.Tags) return json.Marshal(objectMap) } @@ -784,12 +774,12 @@ type DomainsListBySubscriptionOptions struct { Top *int32 } -// DomainsListResult - Result of the List Domains operation +// DomainsListResult - Result of the List Domains operation. type DomainsListResult struct { - // A link for the next page of domains + // A link for the next page of domains. NextLink *string `json:"nextLink,omitempty"` - // A collection of Domains + // A collection of Domains. Value []*Domain `json:"value,omitempty"` } @@ -855,209 +845,6 @@ type DynamicDeliveryAttributeMappingProperties struct { SourceField *string `json:"sourceField,omitempty"` } -// EventChannel - Event Channel. -type EventChannel struct { - Resource - // Properties of the EventChannel. - Properties *EventChannelProperties `json:"properties,omitempty"` - - // READ-ONLY; The system metadata relating to Event Channel resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` -} - -// MarshalJSON implements the json.Marshaller interface for type EventChannel. -func (e EventChannel) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - e.Resource.marshalInternal(objectMap) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "systemData", e.SystemData) - return json.Marshal(objectMap) -} - -// EventChannelDestination - Properties of the destination of an event channel. -type EventChannelDestination struct { - // Azure subscription ID of the customer creating the event channel. The partner topic associated with the event channel will be created under this Azure - // subscription. - AzureSubscriptionID *string `json:"azureSubscriptionId,omitempty"` - - // Name of the partner topic associated with the event channel. - PartnerTopicName *string `json:"partnerTopicName,omitempty"` - - // Azure Resource Group of the customer creating the event channel. The partner topic associated with the event channel will be created under this resource - // group. - ResourceGroup *string `json:"resourceGroup,omitempty"` -} - -// EventChannelFilter - Filter for the Event Channel. -type EventChannelFilter struct { - // An array of advanced filters that are used for filtering event channels. - AdvancedFilters []AdvancedFilterClassification `json:"advancedFilters,omitempty"` - - // Allows advanced filters to be evaluated against an array of values instead of expecting a singular value. The default value is either false or null. - EnableAdvancedFilteringOnArrays *bool `json:"enableAdvancedFilteringOnArrays,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type EventChannelFilter. -func (e EventChannelFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "advancedFilters", e.AdvancedFilters) - populate(objectMap, "enableAdvancedFilteringOnArrays", e.EnableAdvancedFilteringOnArrays) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventChannelFilter. -func (e *EventChannelFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "advancedFilters": - e.AdvancedFilters, err = unmarshalAdvancedFilterClassificationArray(val) - delete(rawMsg, key) - case "enableAdvancedFilteringOnArrays": - err = unpopulate(val, &e.EnableAdvancedFilteringOnArrays) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - -// EventChannelProperties - Properties of the Event Channel. -type EventChannelProperties struct { - // Represents the destination of an event channel. - Destination *EventChannelDestination `json:"destination,omitempty"` - - // Expiration time of the event channel. If this timer expires while the corresponding partner topic is never activated, the event channel and corresponding - // partner topic are deleted. - ExpirationTimeIfNotActivatedUTC *time.Time `json:"expirationTimeIfNotActivatedUtc,omitempty"` - - // Information about the filter for the event channel. - Filter *EventChannelFilter `json:"filter,omitempty"` - - // Friendly description about the topic. This can be set by the publisher/partner to show custom description for the customer partner topic. This will be - // helpful to remove any ambiguity of the origin of - // creation of the partner topic for the customer. - PartnerTopicFriendlyDescription *string `json:"partnerTopicFriendlyDescription,omitempty"` - - // Source of the event channel. This represents a unique resource in the partner's resource model. - Source *EventChannelSource `json:"source,omitempty"` - - // READ-ONLY; The readiness state of the corresponding partner topic. - PartnerTopicReadinessState *PartnerTopicReadinessState `json:"partnerTopicReadinessState,omitempty" azure:"ro"` - - // READ-ONLY; Provisioning state of the event channel. - ProvisioningState *EventChannelProvisioningState `json:"provisioningState,omitempty" azure:"ro"` -} - -// MarshalJSON implements the json.Marshaller interface for type EventChannelProperties. -func (e EventChannelProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "destination", e.Destination) - populate(objectMap, "expirationTimeIfNotActivatedUtc", (*timeRFC3339)(e.ExpirationTimeIfNotActivatedUTC)) - populate(objectMap, "filter", e.Filter) - populate(objectMap, "partnerTopicFriendlyDescription", e.PartnerTopicFriendlyDescription) - populate(objectMap, "partnerTopicReadinessState", e.PartnerTopicReadinessState) - populate(objectMap, "provisioningState", e.ProvisioningState) - populate(objectMap, "source", e.Source) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type EventChannelProperties. -func (e *EventChannelProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "destination": - err = unpopulate(val, &e.Destination) - delete(rawMsg, key) - case "expirationTimeIfNotActivatedUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.ExpirationTimeIfNotActivatedUTC = (*time.Time)(&aux) - delete(rawMsg, key) - case "filter": - err = unpopulate(val, &e.Filter) - delete(rawMsg, key) - case "partnerTopicFriendlyDescription": - err = unpopulate(val, &e.PartnerTopicFriendlyDescription) - delete(rawMsg, key) - case "partnerTopicReadinessState": - err = unpopulate(val, &e.PartnerTopicReadinessState) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &e.ProvisioningState) - delete(rawMsg, key) - case "source": - err = unpopulate(val, &e.Source) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - -// EventChannelSource - Properties of the source of an event channel. -type EventChannelSource struct { - // The identifier of the resource that's the source of the events. This represents a unique resource in the partner's resource model. - Source *string `json:"source,omitempty"` -} - -// EventChannelsBeginDeleteOptions contains the optional parameters for the EventChannels.BeginDelete method. -type EventChannelsBeginDeleteOptions struct { - // placeholder for future optional parameters -} - -// EventChannelsCreateOrUpdateOptions contains the optional parameters for the EventChannels.CreateOrUpdate method. -type EventChannelsCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// EventChannelsGetOptions contains the optional parameters for the EventChannels.Get method. -type EventChannelsGetOptions struct { - // placeholder for future optional parameters -} - -// EventChannelsListByPartnerNamespaceOptions contains the optional parameters for the EventChannels.ListByPartnerNamespace method. -type EventChannelsListByPartnerNamespaceOptions struct { - // The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. - // These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic - // operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a - // valid filter example: $filter=location eq 'westus'. - Filter *string - // The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results - // to be returned is 20 items per page. - Top *int32 -} - -// EventChannelsListResult - Result of the List Event Channels operation -type EventChannelsListResult struct { - // A link for the next page of event channels - NextLink *string `json:"nextLink,omitempty"` - - // A collection of Event Channels - Value []*EventChannel `json:"value,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type EventChannelsListResult. -func (e EventChannelsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", e.NextLink) - populate(objectMap, "value", e.Value) - return json.Marshal(objectMap) -} - // EventHubEventSubscriptionDestination - Information about the event hub destination for an event subscription. type EventHubEventSubscriptionDestination struct { EventSubscriptionDestination @@ -1295,9 +1082,7 @@ type EventSubscriptionIdentity struct { // EventSubscriptionProperties - Properties of the Event Subscription. type EventSubscriptionProperties struct { - // The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. - // Uses Azure Event Grid's identity to acquire the - // authentication tokens being used during delivery / dead-lettering. + // The DeadLetter destination of the event subscription. DeadLetterDestination DeadLetterDestinationClassification `json:"deadLetterDestination,omitempty"` // The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. @@ -1310,9 +1095,7 @@ type EventSubscriptionProperties struct { // authentication tokens being used during delivery / dead-lettering. DeliveryWithResourceIdentity *DeliveryWithResourceIdentity `json:"deliveryWithResourceIdentity,omitempty"` - // Information about the destination where events have to be delivered for the event subscription. Uses Azure Event Grid's identity to acquire the authentication - // tokens being used during delivery / - // dead-lettering. + // Information about the destination where events have to be delivered for the event subscription. Destination EventSubscriptionDestinationClassification `json:"destination,omitempty"` // The event delivery schema for the event subscription. @@ -1345,7 +1128,7 @@ func (e EventSubscriptionProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "deliveryWithResourceIdentity", e.DeliveryWithResourceIdentity) populate(objectMap, "destination", e.Destination) populate(objectMap, "eventDeliverySchema", e.EventDeliverySchema) - populate(objectMap, "expirationTimeUtc", (*timeRFC3339)(e.ExpirationTimeUTC)) + populateTimeRFC3339(objectMap, "expirationTimeUtc", e.ExpirationTimeUTC) populate(objectMap, "filter", e.Filter) populate(objectMap, "labels", e.Labels) populate(objectMap, "provisioningState", e.ProvisioningState) @@ -1379,9 +1162,7 @@ func (e *EventSubscriptionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.EventDeliverySchema) delete(rawMsg, key) case "expirationTimeUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.ExpirationTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.ExpirationTimeUTC) delete(rawMsg, key) case "filter": err = unpopulate(val, &e.Filter) @@ -1408,9 +1189,7 @@ func (e *EventSubscriptionProperties) UnmarshalJSON(data []byte) error { // EventSubscriptionUpdateParameters - Properties of the Event Subscription update. type EventSubscriptionUpdateParameters struct { - // The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. - // Uses Azure Event Grid's identity to acquire the - // authentication tokens being used during delivery / dead-lettering. + // The DeadLetter destination of the event subscription. DeadLetterDestination DeadLetterDestinationClassification `json:"deadLetterDestination,omitempty"` // The dead letter destination of the event subscription. Any event that cannot be delivered to its' destination is sent to the dead letter destination. @@ -1423,9 +1202,7 @@ type EventSubscriptionUpdateParameters struct { // tokens being used during delivery / dead-lettering. DeliveryWithResourceIdentity *DeliveryWithResourceIdentity `json:"deliveryWithResourceIdentity,omitempty"` - // Information about the destination where events have to be delivered for the event subscription. Uses Azure Event Grid's identity to acquire the authentication - // tokens being used during delivery / - // dead-lettering. + // Information about the destination where events have to be delivered for the event subscription. Destination EventSubscriptionDestinationClassification `json:"destination,omitempty"` // The event delivery schema for the event subscription. @@ -1452,7 +1229,7 @@ func (e EventSubscriptionUpdateParameters) MarshalJSON() ([]byte, error) { populate(objectMap, "deliveryWithResourceIdentity", e.DeliveryWithResourceIdentity) populate(objectMap, "destination", e.Destination) populate(objectMap, "eventDeliverySchema", e.EventDeliverySchema) - populate(objectMap, "expirationTimeUtc", (*timeRFC3339)(e.ExpirationTimeUTC)) + populateTimeRFC3339(objectMap, "expirationTimeUtc", e.ExpirationTimeUTC) populate(objectMap, "filter", e.Filter) populate(objectMap, "labels", e.Labels) populate(objectMap, "retryPolicy", e.RetryPolicy) @@ -1484,9 +1261,7 @@ func (e *EventSubscriptionUpdateParameters) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.EventDeliverySchema) delete(rawMsg, key) case "expirationTimeUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.ExpirationTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.ExpirationTimeUTC) delete(rawMsg, key) case "filter": err = unpopulate(val, &e.Filter) @@ -1719,20 +1494,14 @@ func (e EventTypesListResult) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// ExtendedLocation - Definition of an Extended Location -type ExtendedLocation struct { - // Fully qualified name of the extended location. - Name *string `json:"name,omitempty"` - - // Type of the extended location. - Type *string `json:"type,omitempty"` -} - // ExtensionTopic - Event grid Extension Topic. This is used for getting Event Grid related metrics for Azure resources. type ExtensionTopic struct { Resource // Properties of the extension topic Properties *ExtensionTopicProperties `json:"properties,omitempty"` + + // READ-ONLY; The system metadata relating to the Extension Topic resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` } // MarshalJSON implements the json.Marshaller interface for type ExtensionTopic. @@ -1740,6 +1509,7 @@ func (e ExtensionTopic) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) e.Resource.marshalInternal(objectMap) populate(objectMap, "properties", e.Properties) + populate(objectMap, "systemData", e.SystemData) return json.Marshal(objectMap) } @@ -1921,30 +1691,6 @@ func (i *InputSchemaMapping) unmarshalInternal(rawMsg map[string]json.RawMessage return nil } -// IsNotNullAdvancedFilter - IsNotNull Advanced Filter. -type IsNotNullAdvancedFilter struct { - AdvancedFilter -} - -// MarshalJSON implements the json.Marshaller interface for type IsNotNullAdvancedFilter. -func (i IsNotNullAdvancedFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - i.AdvancedFilter.marshalInternal(objectMap, AdvancedFilterOperatorTypeIsNotNull) - return json.Marshal(objectMap) -} - -// IsNullOrUndefinedAdvancedFilter - IsNullOrUndefined Advanced Filter. -type IsNullOrUndefinedAdvancedFilter struct { - AdvancedFilter -} - -// MarshalJSON implements the json.Marshaller interface for type IsNullOrUndefinedAdvancedFilter. -func (i IsNullOrUndefinedAdvancedFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - i.AdvancedFilter.marshalInternal(objectMap, AdvancedFilterOperatorTypeIsNullOrUndefined) - return json.Marshal(objectMap) -} - // JSONField - This is used to express the source of an input schema mapping for a single target field in the Event Grid Event schema. This is currently // used in the mappings for the 'id', 'topic' and 'eventtime' // properties. This represents a field in the input event schema. @@ -2141,44 +1887,6 @@ func (n *NumberInAdvancedFilter) UnmarshalJSON(data []byte) error { return nil } -// NumberInRangeAdvancedFilter - NumberInRange Advanced Filter. -type NumberInRangeAdvancedFilter struct { - AdvancedFilter - // The set of filter values. - Values [][]*float64 `json:"values,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type NumberInRangeAdvancedFilter. -func (n NumberInRangeAdvancedFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - n.AdvancedFilter.marshalInternal(objectMap, AdvancedFilterOperatorTypeNumberInRange) - populate(objectMap, "values", n.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NumberInRangeAdvancedFilter. -func (n *NumberInRangeAdvancedFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "values": - err = unpopulate(val, &n.Values) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - if err := n.AdvancedFilter.unmarshalInternal(rawMsg); err != nil { - return err - } - return nil -} - // NumberLessThanAdvancedFilter - NumberLessThan Advanced Filter. type NumberLessThanAdvancedFilter struct { AdvancedFilter @@ -2293,52 +2001,11 @@ func (n *NumberNotInAdvancedFilter) UnmarshalJSON(data []byte) error { return nil } -// NumberNotInRangeAdvancedFilter - NumberNotInRange Advanced Filter. -type NumberNotInRangeAdvancedFilter struct { - AdvancedFilter - // The set of filter values. - Values [][]*float64 `json:"values,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type NumberNotInRangeAdvancedFilter. -func (n NumberNotInRangeAdvancedFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - n.AdvancedFilter.marshalInternal(objectMap, AdvancedFilterOperatorTypeNumberNotInRange) - populate(objectMap, "values", n.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type NumberNotInRangeAdvancedFilter. -func (n *NumberNotInRangeAdvancedFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "values": - err = unpopulate(val, &n.Values) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - if err := n.AdvancedFilter.unmarshalInternal(rawMsg); err != nil { - return err - } - return nil -} - // Operation - Represents an operation returned by the GetOperations request type Operation struct { // Display name of the operation Display *OperationInfo `json:"display,omitempty"` - // This Boolean is used to determine if the operation is a data plane action or not. - IsDataAction *bool `json:"isDataAction,omitempty"` - // Name of the operation Name *string `json:"name,omitempty"` @@ -2382,625 +2049,37 @@ func (o OperationsListResult) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// PartnerNamespace - EventGrid Partner Namespace. -type PartnerNamespace struct { - TrackedResource - // Properties of the partner namespace. - Properties *PartnerNamespaceProperties `json:"properties,omitempty"` +// PrivateEndpoint information. +type PrivateEndpoint struct { + // The ARM identifier for Private Endpoint. + ID *string `json:"id,omitempty"` +} - // READ-ONLY; The system metadata relating to Partner Namespace resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +type PrivateEndpointConnection struct { + Resource + // Properties of the PrivateEndpointConnection. + Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PartnerNamespace. -func (p PartnerNamespace) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. +func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - p.TrackedResource.marshalInternal(objectMap) + p.Resource.marshalInternal(objectMap) populate(objectMap, "properties", p.Properties) - populate(objectMap, "systemData", p.SystemData) return json.Marshal(objectMap) } -// PartnerNamespaceProperties - Properties of the partner namespace. -type PartnerNamespaceProperties struct { - // This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate - // if user is allowed to publish to the partner - // namespace. - DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` - - // This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. - InboundIPRules []*InboundIPRule `json:"inboundIpRules,omitempty"` - - // The fully qualified ARM Id of the partner registration that should be associated with this partner namespace. This takes the following format: - // /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}. - PartnerRegistrationFullyQualifiedID *string `json:"partnerRegistrationFullyQualifiedId,omitempty"` - - // This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific IPs by configuring - PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` - - // READ-ONLY; Endpoint for the partner namespace. - Endpoint *string `json:"endpoint,omitempty" azure:"ro"` - - // READ-ONLY - PrivateEndpointConnections []*PrivateEndpointConnection `json:"privateEndpointConnections,omitempty" azure:"ro"` +// PrivateEndpointConnectionListResult - Result of the list of all private endpoint connections operation. +type PrivateEndpointConnectionListResult struct { + // A link for the next page of private endpoint connection resources. + NextLink *string `json:"nextLink,omitempty"` - // READ-ONLY; Provisioning state of the partner namespace. - ProvisioningState *PartnerNamespaceProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + // A collection of private endpoint connection resources. + Value []*PrivateEndpointConnection `json:"value,omitempty"` } -// MarshalJSON implements the json.Marshaller interface for type PartnerNamespaceProperties. -func (p PartnerNamespaceProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "disableLocalAuth", p.DisableLocalAuth) - populate(objectMap, "endpoint", p.Endpoint) - populate(objectMap, "inboundIpRules", p.InboundIPRules) - populate(objectMap, "partnerRegistrationFullyQualifiedId", p.PartnerRegistrationFullyQualifiedID) - populate(objectMap, "privateEndpointConnections", p.PrivateEndpointConnections) - populate(objectMap, "provisioningState", p.ProvisioningState) - populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) - return json.Marshal(objectMap) -} - -// PartnerNamespaceRegenerateKeyRequest - PartnerNamespace regenerate shared access key request. -type PartnerNamespaceRegenerateKeyRequest struct { - // REQUIRED; Key name to regenerate (key1 or key2). - KeyName *string `json:"keyName,omitempty"` -} - -// PartnerNamespaceSharedAccessKeys - Shared access keys of the partner namespace. -type PartnerNamespaceSharedAccessKeys struct { - // Shared access key1 for the partner namespace. - Key1 *string `json:"key1,omitempty"` - - // Shared access key2 for the partner namespace. - Key2 *string `json:"key2,omitempty"` -} - -// PartnerNamespaceUpdateParameterProperties - Information of Partner Namespace update parameter properties. -type PartnerNamespaceUpdateParameterProperties struct { - // This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate - // if user is allowed to publish to the partner - // namespace. - DisableLocalAuth *bool `json:"disableLocalAuth,omitempty"` - - // This can be used to restrict traffic from specific IPs instead of all IPs. Note: These are considered only if PublicNetworkAccess is enabled. - InboundIPRules []*InboundIPRule `json:"inboundIpRules,omitempty"` - - // This determines if traffic is allowed over public network. By default it is enabled. You can further restrict to specific IPs by configuring - PublicNetworkAccess *PublicNetworkAccess `json:"publicNetworkAccess,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerNamespaceUpdateParameterProperties. -func (p PartnerNamespaceUpdateParameterProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "disableLocalAuth", p.DisableLocalAuth) - populate(objectMap, "inboundIpRules", p.InboundIPRules) - populate(objectMap, "publicNetworkAccess", p.PublicNetworkAccess) - return json.Marshal(objectMap) -} - -// PartnerNamespaceUpdateParameters - Properties of the PartnerNamespace update. -type PartnerNamespaceUpdateParameters struct { - // Properties of the Partner Namespace. - Properties *PartnerNamespaceUpdateParameterProperties `json:"properties,omitempty"` - - // Tags of the partner namespace. - Tags map[string]*string `json:"tags,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerNamespaceUpdateParameters. -func (p PartnerNamespaceUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "tags", p.Tags) - return json.Marshal(objectMap) -} - -// PartnerNamespacesBeginCreateOrUpdateOptions contains the optional parameters for the PartnerNamespaces.BeginCreateOrUpdate method. -type PartnerNamespacesBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// PartnerNamespacesBeginDeleteOptions contains the optional parameters for the PartnerNamespaces.BeginDelete method. -type PartnerNamespacesBeginDeleteOptions struct { - // placeholder for future optional parameters -} - -// PartnerNamespacesBeginUpdateOptions contains the optional parameters for the PartnerNamespaces.BeginUpdate method. -type PartnerNamespacesBeginUpdateOptions struct { - // placeholder for future optional parameters -} - -// PartnerNamespacesGetOptions contains the optional parameters for the PartnerNamespaces.Get method. -type PartnerNamespacesGetOptions struct { - // placeholder for future optional parameters -} - -// PartnerNamespacesListByResourceGroupOptions contains the optional parameters for the PartnerNamespaces.ListByResourceGroup method. -type PartnerNamespacesListByResourceGroupOptions struct { - // The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. - // These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic - // operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a - // valid filter example: $filter=location eq 'westus'. - Filter *string - // The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results - // to be returned is 20 items per page. - Top *int32 -} - -// PartnerNamespacesListBySubscriptionOptions contains the optional parameters for the PartnerNamespaces.ListBySubscription method. -type PartnerNamespacesListBySubscriptionOptions struct { - // The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. - // These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic - // operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a - // valid filter example: $filter=location eq 'westus'. - Filter *string - // The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results - // to be returned is 20 items per page. - Top *int32 -} - -// PartnerNamespacesListResult - Result of the List Partner Namespaces operation -type PartnerNamespacesListResult struct { - // A link for the next page of partner namespaces. - NextLink *string `json:"nextLink,omitempty"` - - // A collection of partner namespaces. - Value []*PartnerNamespace `json:"value,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerNamespacesListResult. -func (p PartnerNamespacesListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// PartnerNamespacesListSharedAccessKeysOptions contains the optional parameters for the PartnerNamespaces.ListSharedAccessKeys method. -type PartnerNamespacesListSharedAccessKeysOptions struct { - // placeholder for future optional parameters -} - -// PartnerNamespacesRegenerateKeyOptions contains the optional parameters for the PartnerNamespaces.RegenerateKey method. -type PartnerNamespacesRegenerateKeyOptions struct { - // placeholder for future optional parameters -} - -// PartnerRegistration - Information about a partner registration. -type PartnerRegistration struct { - TrackedResource - // Properties of the partner registration. - Properties *PartnerRegistrationProperties `json:"properties,omitempty"` - - // READ-ONLY; The system metadata relating to Partner Registration resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerRegistration. -func (p PartnerRegistration) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - p.TrackedResource.marshalInternal(objectMap) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "systemData", p.SystemData) - return json.Marshal(objectMap) -} - -// PartnerRegistrationProperties - Properties of the partner registration. -type PartnerRegistrationProperties struct { - // List of Azure subscription Ids that are authorized to create a partner namespace associated with this partner registration. This is an optional property. - // Creating partner namespaces is always - // permitted under the same Azure subscription as the one used for creating the partner registration. - AuthorizedAzureSubscriptionIDs []*string `json:"authorizedAzureSubscriptionIds,omitempty"` - - // The extension of the customer service URI of the publisher. - CustomerServiceURI *string `json:"customerServiceUri,omitempty"` - - // URI of the logo. - LogoURI *string `json:"logoUri,omitempty"` - - // Long description for the custom scenarios and integration to be displayed in the portal if needed. Length of this description should not exceed 2048 - // characters. - LongDescription *string `json:"longDescription,omitempty"` - - // The extension of the customer service number of the publisher. Only digits are allowed and number of digits should not exceed 10. - PartnerCustomerServiceExtension *string `json:"partnerCustomerServiceExtension,omitempty"` - - // The customer service number of the publisher. The expected phone format should start with a '+' sign followed by the country code. The remaining digits - // are then followed. Only digits and spaces are - // allowed and its length cannot exceed 16 digits including country code. Examples of valid phone numbers are: +1 515 123 4567 and +966 7 5115 2471. Examples - // of invalid phone numbers are: +1 (515) - // 123-4567, 1 515 123 4567 and +966 121 5115 24 7 551 1234 43 - PartnerCustomerServiceNumber *string `json:"partnerCustomerServiceNumber,omitempty"` - - // Official name of the partner name. For example: "Contoso". - PartnerName *string `json:"partnerName,omitempty"` - - // Short description of the partner resource type. The length of this description should not exceed 256 characters. - PartnerResourceTypeDescription *string `json:"partnerResourceTypeDescription,omitempty"` - - // Display name of the partner resource type. - PartnerResourceTypeDisplayName *string `json:"partnerResourceTypeDisplayName,omitempty"` - - // Name of the partner resource type. - PartnerResourceTypeName *string `json:"partnerResourceTypeName,omitempty"` - - // URI of the partner website that can be used by Azure customers to setup Event Grid integration on an event source. - SetupURI *string `json:"setupUri,omitempty"` - - // Visibility state of the partner registration. - VisibilityState *PartnerRegistrationVisibilityState `json:"visibilityState,omitempty"` - - // READ-ONLY; Provisioning state of the partner registration. - ProvisioningState *PartnerRegistrationProvisioningState `json:"provisioningState,omitempty" azure:"ro"` -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerRegistrationProperties. -func (p PartnerRegistrationProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "authorizedAzureSubscriptionIds", p.AuthorizedAzureSubscriptionIDs) - populate(objectMap, "customerServiceUri", p.CustomerServiceURI) - populate(objectMap, "logoUri", p.LogoURI) - populate(objectMap, "longDescription", p.LongDescription) - populate(objectMap, "partnerCustomerServiceExtension", p.PartnerCustomerServiceExtension) - populate(objectMap, "partnerCustomerServiceNumber", p.PartnerCustomerServiceNumber) - populate(objectMap, "partnerName", p.PartnerName) - populate(objectMap, "partnerResourceTypeDescription", p.PartnerResourceTypeDescription) - populate(objectMap, "partnerResourceTypeDisplayName", p.PartnerResourceTypeDisplayName) - populate(objectMap, "partnerResourceTypeName", p.PartnerResourceTypeName) - populate(objectMap, "provisioningState", p.ProvisioningState) - populate(objectMap, "setupUri", p.SetupURI) - populate(objectMap, "visibilityState", p.VisibilityState) - return json.Marshal(objectMap) -} - -// PartnerRegistrationUpdateParameters - Properties of the Partner Registration update. -type PartnerRegistrationUpdateParameters struct { - // List of IDs of Azure AD applications that are authorized to create a partner namespace associated with this partner registration. This is an optional - // property. Creating partner namespaces is always - // permitted under the same Azure subscription as the one used for creating the partner registration. - AuthorizedAzureSubscriptionIDs []*string `json:"authorizedAzureSubscriptionIds,omitempty"` - - // URI of the partner logo. - LogoURI *string `json:"logoUri,omitempty"` - - // Description of the partner topic type. - PartnerTopicTypeDescription *string `json:"partnerTopicTypeDescription,omitempty"` - - // Display name of the partner topic type. - PartnerTopicTypeDisplayName *string `json:"partnerTopicTypeDisplayName,omitempty"` - - // Name of the partner topic type. - PartnerTopicTypeName *string `json:"partnerTopicTypeName,omitempty"` - - // URI of the partner website that can be used by Azure customers to setup Event Grid integration on an event source. - SetupURI *string `json:"setupUri,omitempty"` - - // Tags of the partner registration resource. - Tags map[string]*string `json:"tags,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerRegistrationUpdateParameters. -func (p PartnerRegistrationUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "authorizedAzureSubscriptionIds", p.AuthorizedAzureSubscriptionIDs) - populate(objectMap, "logoUri", p.LogoURI) - populate(objectMap, "partnerTopicTypeDescription", p.PartnerTopicTypeDescription) - populate(objectMap, "partnerTopicTypeDisplayName", p.PartnerTopicTypeDisplayName) - populate(objectMap, "partnerTopicTypeName", p.PartnerTopicTypeName) - populate(objectMap, "setupUri", p.SetupURI) - populate(objectMap, "tags", p.Tags) - return json.Marshal(objectMap) -} - -// PartnerRegistrationsCreateOrUpdateOptions contains the optional parameters for the PartnerRegistrations.CreateOrUpdate method. -type PartnerRegistrationsCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// PartnerRegistrationsDeleteOptions contains the optional parameters for the PartnerRegistrations.Delete method. -type PartnerRegistrationsDeleteOptions struct { - // placeholder for future optional parameters -} - -// PartnerRegistrationsGetOptions contains the optional parameters for the PartnerRegistrations.Get method. -type PartnerRegistrationsGetOptions struct { - // placeholder for future optional parameters -} - -// PartnerRegistrationsListByResourceGroupOptions contains the optional parameters for the PartnerRegistrations.ListByResourceGroup method. -type PartnerRegistrationsListByResourceGroupOptions struct { - // The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. - // These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic - // operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a - // valid filter example: $filter=location eq 'westus'. - Filter *string - // The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results - // to be returned is 20 items per page. - Top *int32 -} - -// PartnerRegistrationsListBySubscriptionOptions contains the optional parameters for the PartnerRegistrations.ListBySubscription method. -type PartnerRegistrationsListBySubscriptionOptions struct { - // The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. - // These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic - // operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a - // valid filter example: $filter=location eq 'westus'. - Filter *string - // The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results - // to be returned is 20 items per page. - Top *int32 -} - -// PartnerRegistrationsListResult - Result of the List Partner Registrations operation. -type PartnerRegistrationsListResult struct { - // A link for the next page of partner registrations. - NextLink *string `json:"nextLink,omitempty"` - - // A collection of partner registrations. - Value []*PartnerRegistration `json:"value,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerRegistrationsListResult. -func (p PartnerRegistrationsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// PartnerRegistrationsUpdateOptions contains the optional parameters for the PartnerRegistrations.Update method. -type PartnerRegistrationsUpdateOptions struct { - // placeholder for future optional parameters -} - -// PartnerTopic - EventGrid Partner Topic. -type PartnerTopic struct { - TrackedResource - // Identity information for the Partner Topic resource. - Identity *IdentityInfo `json:"identity,omitempty"` - - // Properties of the partner topic. - Properties *PartnerTopicProperties `json:"properties,omitempty"` - - // READ-ONLY; The system metadata relating to Partner Topic resource. - SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerTopic. -func (p PartnerTopic) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - p.TrackedResource.marshalInternal(objectMap) - populate(objectMap, "identity", p.Identity) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "systemData", p.SystemData) - return json.Marshal(objectMap) -} - -// PartnerTopicEventSubscriptionsBeginCreateOrUpdateOptions contains the optional parameters for the PartnerTopicEventSubscriptions.BeginCreateOrUpdate -// method. -type PartnerTopicEventSubscriptionsBeginCreateOrUpdateOptions struct { - // placeholder for future optional parameters -} - -// PartnerTopicEventSubscriptionsBeginDeleteOptions contains the optional parameters for the PartnerTopicEventSubscriptions.BeginDelete method. -type PartnerTopicEventSubscriptionsBeginDeleteOptions struct { - // placeholder for future optional parameters -} - -// PartnerTopicEventSubscriptionsBeginUpdateOptions contains the optional parameters for the PartnerTopicEventSubscriptions.BeginUpdate method. -type PartnerTopicEventSubscriptionsBeginUpdateOptions struct { - // placeholder for future optional parameters -} - -// PartnerTopicEventSubscriptionsGetDeliveryAttributesOptions contains the optional parameters for the PartnerTopicEventSubscriptions.GetDeliveryAttributes -// method. -type PartnerTopicEventSubscriptionsGetDeliveryAttributesOptions struct { - // placeholder for future optional parameters -} - -// PartnerTopicEventSubscriptionsGetFullURLOptions contains the optional parameters for the PartnerTopicEventSubscriptions.GetFullURL method. -type PartnerTopicEventSubscriptionsGetFullURLOptions struct { - // placeholder for future optional parameters -} - -// PartnerTopicEventSubscriptionsGetOptions contains the optional parameters for the PartnerTopicEventSubscriptions.Get method. -type PartnerTopicEventSubscriptionsGetOptions struct { - // placeholder for future optional parameters -} - -// PartnerTopicEventSubscriptionsListByPartnerTopicOptions contains the optional parameters for the PartnerTopicEventSubscriptions.ListByPartnerTopic method. -type PartnerTopicEventSubscriptionsListByPartnerTopicOptions struct { - // The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. - // These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic - // operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a - // valid filter example: $filter=location eq 'westus'. - Filter *string - // The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results - // to be returned is 20 items per page. - Top *int32 -} - -// PartnerTopicProperties - Properties of the Partner Topic. -type PartnerTopicProperties struct { - // Activation state of the partner topic. - ActivationState *PartnerTopicActivationState `json:"activationState,omitempty"` - - // Expiration time of the partner topic. If this timer expires while the partner topic is still never activated, the partner topic and corresponding event - // channel are deleted. - ExpirationTimeIfNotActivatedUTC *time.Time `json:"expirationTimeIfNotActivatedUtc,omitempty"` - - // Friendly description about the topic. This can be set by the publisher/partner to show custom description for the customer partner topic. This will be - // helpful to remove any ambiguity of the origin of - // creation of the partner topic for the customer. - PartnerTopicFriendlyDescription *string `json:"partnerTopicFriendlyDescription,omitempty"` - - // Source associated with this partner topic. This represents a unique partner resource. - Source *string `json:"source,omitempty"` - - // READ-ONLY; Provisioning state of the partner topic. - ProvisioningState *PartnerTopicProvisioningState `json:"provisioningState,omitempty" azure:"ro"` -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerTopicProperties. -func (p PartnerTopicProperties) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "activationState", p.ActivationState) - populate(objectMap, "expirationTimeIfNotActivatedUtc", (*timeRFC3339)(p.ExpirationTimeIfNotActivatedUTC)) - populate(objectMap, "partnerTopicFriendlyDescription", p.PartnerTopicFriendlyDescription) - populate(objectMap, "provisioningState", p.ProvisioningState) - populate(objectMap, "source", p.Source) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type PartnerTopicProperties. -func (p *PartnerTopicProperties) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "activationState": - err = unpopulate(val, &p.ActivationState) - delete(rawMsg, key) - case "expirationTimeIfNotActivatedUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - p.ExpirationTimeIfNotActivatedUTC = (*time.Time)(&aux) - delete(rawMsg, key) - case "partnerTopicFriendlyDescription": - err = unpopulate(val, &p.PartnerTopicFriendlyDescription) - delete(rawMsg, key) - case "provisioningState": - err = unpopulate(val, &p.ProvisioningState) - delete(rawMsg, key) - case "source": - err = unpopulate(val, &p.Source) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - return nil -} - -// PartnerTopicUpdateParameters - Properties of the Partner Topic update. -type PartnerTopicUpdateParameters struct { - // Identity information for the Partner Topic resource. - Identity *IdentityInfo `json:"identity,omitempty"` - - // Tags of the Partner Topic resource. - Tags map[string]*string `json:"tags,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerTopicUpdateParameters. -func (p PartnerTopicUpdateParameters) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "identity", p.Identity) - populate(objectMap, "tags", p.Tags) - return json.Marshal(objectMap) -} - -// PartnerTopicsActivateOptions contains the optional parameters for the PartnerTopics.Activate method. -type PartnerTopicsActivateOptions struct { - // placeholder for future optional parameters -} - -// PartnerTopicsBeginDeleteOptions contains the optional parameters for the PartnerTopics.BeginDelete method. -type PartnerTopicsBeginDeleteOptions struct { - // placeholder for future optional parameters -} - -// PartnerTopicsDeactivateOptions contains the optional parameters for the PartnerTopics.Deactivate method. -type PartnerTopicsDeactivateOptions struct { - // placeholder for future optional parameters -} - -// PartnerTopicsGetOptions contains the optional parameters for the PartnerTopics.Get method. -type PartnerTopicsGetOptions struct { - // placeholder for future optional parameters -} - -// PartnerTopicsListByResourceGroupOptions contains the optional parameters for the PartnerTopics.ListByResourceGroup method. -type PartnerTopicsListByResourceGroupOptions struct { - // The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. - // These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic - // operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a - // valid filter example: $filter=location eq 'westus'. - Filter *string - // The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results - // to be returned is 20 items per page. - Top *int32 -} - -// PartnerTopicsListBySubscriptionOptions contains the optional parameters for the PartnerTopics.ListBySubscription method. -type PartnerTopicsListBySubscriptionOptions struct { - // The query used to filter the search results using OData syntax. Filtering is permitted on the 'name' property only and with limited number of OData operations. - // These operations are: the 'contains' function as well as the following logical operations: not, and, or, eq (for equal), and ne (for not equal). No arithmetic - // operations are supported. The following is a valid filter example: $filter=contains(namE, 'PATTERN') and name ne 'PATTERN-1'. The following is not a - // valid filter example: $filter=location eq 'westus'. - Filter *string - // The number of results to return per page for the list operation. Valid range for top parameter is 1 to 100. If not specified, the default number of results - // to be returned is 20 items per page. - Top *int32 -} - -// PartnerTopicsListResult - Result of the List Partner Topics operation. -type PartnerTopicsListResult struct { - // A link for the next page of partner topics. - NextLink *string `json:"nextLink,omitempty"` - - // A collection of partner topics. - Value []*PartnerTopic `json:"value,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type PartnerTopicsListResult. -func (p PartnerTopicsListResult) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - populate(objectMap, "nextLink", p.NextLink) - populate(objectMap, "value", p.Value) - return json.Marshal(objectMap) -} - -// PartnerTopicsUpdateOptions contains the optional parameters for the PartnerTopics.Update method. -type PartnerTopicsUpdateOptions struct { - // placeholder for future optional parameters -} - -// PrivateEndpoint information. -type PrivateEndpoint struct { - // The ARM identifier for Private Endpoint. - ID *string `json:"id,omitempty"` -} - -type PrivateEndpointConnection struct { - Resource - // Properties of the PrivateEndpointConnection. - Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. -func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - p.Resource.marshalInternal(objectMap) - populate(objectMap, "properties", p.Properties) - return json.Marshal(objectMap) -} - -// PrivateEndpointConnectionListResult - Result of the list of all private endpoint connections operation. -type PrivateEndpointConnectionListResult struct { - // A link for the next page of private endpoint connection resources. - NextLink *string `json:"nextLink,omitempty"` - - // A collection of private endpoint connection resources. - Value []*PrivateEndpointConnection `json:"value,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. -func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { +// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnectionListResult. +func (p PrivateEndpointConnectionListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "nextLink", p.NextLink) populate(objectMap, "value", p.Value) @@ -3125,7 +2204,7 @@ func (p PrivateLinkResourcesListResult) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } -// Resource - Definition of a Resource +// Resource - Definition of a Resource. type Resource struct { // READ-ONLY; Fully qualified identifier of the resource. ID *string `json:"id,omitempty" azure:"ro"` @@ -3150,12 +2229,6 @@ func (r Resource) marshalInternal(objectMap map[string]interface{}) { populate(objectMap, "type", r.Type) } -// ResourceSKU - Describes an EventGrid Resource Sku. -type ResourceSKU struct { - // The Sku name of the resource. The possible values are: Basic or Premium. - Name *SKU `json:"name,omitempty"` -} - // RetryPolicy - Information about the retry policy for an event subscription. type RetryPolicy struct { // Time To Live (in minutes) for events. @@ -3617,120 +2690,6 @@ func (s *StringInAdvancedFilter) UnmarshalJSON(data []byte) error { return nil } -// StringNotBeginsWithAdvancedFilter - StringNotBeginsWith Advanced Filter. -type StringNotBeginsWithAdvancedFilter struct { - AdvancedFilter - // The set of filter values. - Values []*string `json:"values,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type StringNotBeginsWithAdvancedFilter. -func (s StringNotBeginsWithAdvancedFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - s.AdvancedFilter.marshalInternal(objectMap, AdvancedFilterOperatorTypeStringNotBeginsWith) - populate(objectMap, "values", s.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StringNotBeginsWithAdvancedFilter. -func (s *StringNotBeginsWithAdvancedFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "values": - err = unpopulate(val, &s.Values) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - if err := s.AdvancedFilter.unmarshalInternal(rawMsg); err != nil { - return err - } - return nil -} - -// StringNotContainsAdvancedFilter - StringNotContains Advanced Filter. -type StringNotContainsAdvancedFilter struct { - AdvancedFilter - // The set of filter values. - Values []*string `json:"values,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type StringNotContainsAdvancedFilter. -func (s StringNotContainsAdvancedFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - s.AdvancedFilter.marshalInternal(objectMap, AdvancedFilterOperatorTypeStringNotContains) - populate(objectMap, "values", s.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StringNotContainsAdvancedFilter. -func (s *StringNotContainsAdvancedFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "values": - err = unpopulate(val, &s.Values) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - if err := s.AdvancedFilter.unmarshalInternal(rawMsg); err != nil { - return err - } - return nil -} - -// StringNotEndsWithAdvancedFilter - StringNotEndsWith Advanced Filter. -type StringNotEndsWithAdvancedFilter struct { - AdvancedFilter - // The set of filter values. - Values []*string `json:"values,omitempty"` -} - -// MarshalJSON implements the json.Marshaller interface for type StringNotEndsWithAdvancedFilter. -func (s StringNotEndsWithAdvancedFilter) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - s.AdvancedFilter.marshalInternal(objectMap, AdvancedFilterOperatorTypeStringNotEndsWith) - populate(objectMap, "values", s.Values) - return json.Marshal(objectMap) -} - -// UnmarshalJSON implements the json.Unmarshaller interface for type StringNotEndsWithAdvancedFilter. -func (s *StringNotEndsWithAdvancedFilter) UnmarshalJSON(data []byte) error { - var rawMsg map[string]json.RawMessage - if err := json.Unmarshal(data, &rawMsg); err != nil { - return err - } - for key, val := range rawMsg { - var err error - switch key { - case "values": - err = unpopulate(val, &s.Values) - delete(rawMsg, key) - } - if err != nil { - return err - } - } - if err := s.AdvancedFilter.unmarshalInternal(rawMsg); err != nil { - return err - } - return nil -} - // StringNotInAdvancedFilter - StringNotIn Advanced Filter. type StringNotInAdvancedFilter struct { AdvancedFilter @@ -3793,10 +2752,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -3812,9 +2771,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -3823,9 +2780,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) @@ -4003,21 +2958,12 @@ func (s SystemTopicsListResult) MarshalJSON() ([]byte, error) { // Topic - EventGrid Topic type Topic struct { TrackedResource - // Extended location of the resource. - ExtendedLocation *ExtendedLocation `json:"extendedLocation,omitempty"` - // Identity information for the resource. Identity *IdentityInfo `json:"identity,omitempty"` - // Kind of the resource. - Kind *ResourceKind `json:"kind,omitempty"` - // Properties of the topic. Properties *TopicProperties `json:"properties,omitempty"` - // The Sku pricing tier for the topic. - SKU *ResourceSKU `json:"sku,omitempty"` - // READ-ONLY; The system metadata relating to Topic resource. SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` } @@ -4026,16 +2972,13 @@ type Topic struct { func (t Topic) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) t.TrackedResource.marshalInternal(objectMap) - populate(objectMap, "extendedLocation", t.ExtendedLocation) populate(objectMap, "identity", t.Identity) - populate(objectMap, "kind", t.Kind) populate(objectMap, "properties", t.Properties) - populate(objectMap, "sku", t.SKU) populate(objectMap, "systemData", t.SystemData) return json.Marshal(objectMap) } -// TopicProperties - Properties of the Topic. +// TopicProperties - Properties of the Topic type TopicProperties struct { // This boolean is used to enable or disable local auth. Default value is false. When the property is set to true, only AAD token will be used to authenticate // if user is allowed to publish to the topic. @@ -4252,13 +3195,10 @@ type TopicUpdateParameters struct { // Topic resource identity information. Identity *IdentityInfo `json:"identity,omitempty"` - // Properties of the Topic resource. + // Properties of the resource. Properties *TopicUpdateParameterProperties `json:"properties,omitempty"` - // The Sku pricing tier for the topic. - SKU *ResourceSKU `json:"sku,omitempty"` - - // Tags of the Topic resource. + // Tags of the resource. Tags map[string]*string `json:"tags,omitempty"` } @@ -4267,7 +3207,6 @@ func (t TopicUpdateParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "identity", t.Identity) populate(objectMap, "properties", t.Properties) - populate(objectMap, "sku", t.SKU) populate(objectMap, "tags", t.Tags) return json.Marshal(objectMap) } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_operations_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_operations_client.go index a67afb46aa36..8c06fd4d395a 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_operations_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armeventgrid import ( "context" "errors" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - List the available operations supported by the Microsoft.EventGrid resource provider. @@ -55,7 +63,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -65,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationsListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_pagers.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_pagers.go index a4a0801e853e..aa876c151be9 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_pagers.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armeventgrid import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // DomainTopicsListByDomainPager provides operations for iterating over paged responses. @@ -179,60 +178,6 @@ func (p *DomainsListBySubscriptionPager) PageResponse() DomainsListBySubscriptio return p.current } -// EventChannelsListByPartnerNamespacePager provides operations for iterating over paged responses. -type EventChannelsListByPartnerNamespacePager struct { - client *EventChannelsClient - current EventChannelsListByPartnerNamespaceResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, EventChannelsListByPartnerNamespaceResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *EventChannelsListByPartnerNamespacePager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *EventChannelsListByPartnerNamespacePager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.EventChannelsListResult.NextLink == nil || len(*p.current.EventChannelsListResult.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = p.client.listByPartnerNamespaceHandleError(resp) - return false - } - result, err := p.client.listByPartnerNamespaceHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current EventChannelsListByPartnerNamespaceResponse page. -func (p *EventChannelsListByPartnerNamespacePager) PageResponse() EventChannelsListByPartnerNamespaceResponse { - return p.current -} - // EventSubscriptionsListByDomainTopicPager provides operations for iterating over paged responses. type EventSubscriptionsListByDomainTopicPager struct { client *EventSubscriptionsClient @@ -773,384 +718,6 @@ func (p *EventSubscriptionsListRegionalBySubscriptionPager) PageResponse() Event return p.current } -// PartnerNamespacesListByResourceGroupPager provides operations for iterating over paged responses. -type PartnerNamespacesListByResourceGroupPager struct { - client *PartnerNamespacesClient - current PartnerNamespacesListByResourceGroupResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, PartnerNamespacesListByResourceGroupResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *PartnerNamespacesListByResourceGroupPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *PartnerNamespacesListByResourceGroupPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.PartnerNamespacesListResult.NextLink == nil || len(*p.current.PartnerNamespacesListResult.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = p.client.listByResourceGroupHandleError(resp) - return false - } - result, err := p.client.listByResourceGroupHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current PartnerNamespacesListByResourceGroupResponse page. -func (p *PartnerNamespacesListByResourceGroupPager) PageResponse() PartnerNamespacesListByResourceGroupResponse { - return p.current -} - -// PartnerNamespacesListBySubscriptionPager provides operations for iterating over paged responses. -type PartnerNamespacesListBySubscriptionPager struct { - client *PartnerNamespacesClient - current PartnerNamespacesListBySubscriptionResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, PartnerNamespacesListBySubscriptionResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *PartnerNamespacesListBySubscriptionPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *PartnerNamespacesListBySubscriptionPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.PartnerNamespacesListResult.NextLink == nil || len(*p.current.PartnerNamespacesListResult.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = p.client.listBySubscriptionHandleError(resp) - return false - } - result, err := p.client.listBySubscriptionHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current PartnerNamespacesListBySubscriptionResponse page. -func (p *PartnerNamespacesListBySubscriptionPager) PageResponse() PartnerNamespacesListBySubscriptionResponse { - return p.current -} - -// PartnerRegistrationsListByResourceGroupPager provides operations for iterating over paged responses. -type PartnerRegistrationsListByResourceGroupPager struct { - client *PartnerRegistrationsClient - current PartnerRegistrationsListByResourceGroupResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, PartnerRegistrationsListByResourceGroupResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *PartnerRegistrationsListByResourceGroupPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *PartnerRegistrationsListByResourceGroupPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.PartnerRegistrationsListResult.NextLink == nil || len(*p.current.PartnerRegistrationsListResult.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = p.client.listByResourceGroupHandleError(resp) - return false - } - result, err := p.client.listByResourceGroupHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current PartnerRegistrationsListByResourceGroupResponse page. -func (p *PartnerRegistrationsListByResourceGroupPager) PageResponse() PartnerRegistrationsListByResourceGroupResponse { - return p.current -} - -// PartnerRegistrationsListBySubscriptionPager provides operations for iterating over paged responses. -type PartnerRegistrationsListBySubscriptionPager struct { - client *PartnerRegistrationsClient - current PartnerRegistrationsListBySubscriptionResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, PartnerRegistrationsListBySubscriptionResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *PartnerRegistrationsListBySubscriptionPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *PartnerRegistrationsListBySubscriptionPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.PartnerRegistrationsListResult.NextLink == nil || len(*p.current.PartnerRegistrationsListResult.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = p.client.listBySubscriptionHandleError(resp) - return false - } - result, err := p.client.listBySubscriptionHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current PartnerRegistrationsListBySubscriptionResponse page. -func (p *PartnerRegistrationsListBySubscriptionPager) PageResponse() PartnerRegistrationsListBySubscriptionResponse { - return p.current -} - -// PartnerTopicEventSubscriptionsListByPartnerTopicPager provides operations for iterating over paged responses. -type PartnerTopicEventSubscriptionsListByPartnerTopicPager struct { - client *PartnerTopicEventSubscriptionsClient - current PartnerTopicEventSubscriptionsListByPartnerTopicResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, PartnerTopicEventSubscriptionsListByPartnerTopicResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *PartnerTopicEventSubscriptionsListByPartnerTopicPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *PartnerTopicEventSubscriptionsListByPartnerTopicPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.EventSubscriptionsListResult.NextLink == nil || len(*p.current.EventSubscriptionsListResult.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = p.client.listByPartnerTopicHandleError(resp) - return false - } - result, err := p.client.listByPartnerTopicHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current PartnerTopicEventSubscriptionsListByPartnerTopicResponse page. -func (p *PartnerTopicEventSubscriptionsListByPartnerTopicPager) PageResponse() PartnerTopicEventSubscriptionsListByPartnerTopicResponse { - return p.current -} - -// PartnerTopicsListByResourceGroupPager provides operations for iterating over paged responses. -type PartnerTopicsListByResourceGroupPager struct { - client *PartnerTopicsClient - current PartnerTopicsListByResourceGroupResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, PartnerTopicsListByResourceGroupResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *PartnerTopicsListByResourceGroupPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *PartnerTopicsListByResourceGroupPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.PartnerTopicsListResult.NextLink == nil || len(*p.current.PartnerTopicsListResult.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = p.client.listByResourceGroupHandleError(resp) - return false - } - result, err := p.client.listByResourceGroupHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current PartnerTopicsListByResourceGroupResponse page. -func (p *PartnerTopicsListByResourceGroupPager) PageResponse() PartnerTopicsListByResourceGroupResponse { - return p.current -} - -// PartnerTopicsListBySubscriptionPager provides operations for iterating over paged responses. -type PartnerTopicsListBySubscriptionPager struct { - client *PartnerTopicsClient - current PartnerTopicsListBySubscriptionResponse - err error - requester func(context.Context) (*policy.Request, error) - advancer func(context.Context, PartnerTopicsListBySubscriptionResponse) (*policy.Request, error) -} - -// Err returns the last error encountered while paging. -func (p *PartnerTopicsListBySubscriptionPager) Err() error { - return p.err -} - -// NextPage returns true if the pager advanced to the next page. -// Returns false if there are no more pages or an error occurred. -func (p *PartnerTopicsListBySubscriptionPager) NextPage(ctx context.Context) bool { - var req *policy.Request - var err error - if !reflect.ValueOf(p.current).IsZero() { - if p.current.PartnerTopicsListResult.NextLink == nil || len(*p.current.PartnerTopicsListResult.NextLink) == 0 { - return false - } - req, err = p.advancer(ctx, p.current) - } else { - req, err = p.requester(ctx) - } - if err != nil { - p.err = err - return false - } - resp, err := p.client.pl.Do(req) - if err != nil { - p.err = err - return false - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - p.err = p.client.listBySubscriptionHandleError(resp) - return false - } - result, err := p.client.listBySubscriptionHandleResponse(resp) - if err != nil { - p.err = err - return false - } - p.current = result - return true -} - -// PageResponse returns the current PartnerTopicsListBySubscriptionResponse page. -func (p *PartnerTopicsListBySubscriptionPager) PageResponse() PartnerTopicsListBySubscriptionResponse { - return p.current -} - // PrivateEndpointConnectionsListByResourcePager provides operations for iterating over paged responses. type PrivateEndpointConnectionsListByResourcePager struct { client *PrivateEndpointConnectionsClient diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_partnernamespaces_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_partnernamespaces_client.go deleted file mode 100644 index e41e6e0ffba9..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_partnernamespaces_client.go +++ /dev/null @@ -1,574 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armeventgrid - -import ( - "context" - "errors" - "net/http" - "net/url" - "strconv" - "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" -) - -// PartnerNamespacesClient contains the methods for the PartnerNamespaces group. -// Don't use this type directly, use NewPartnerNamespacesClient() instead. -type PartnerNamespacesClient struct { - ep string - pl runtime.Pipeline - subscriptionID string -} - -// NewPartnerNamespacesClient creates a new instance of PartnerNamespacesClient with the specified values. -func NewPartnerNamespacesClient(con *arm.Connection, subscriptionID string) *PartnerNamespacesClient { - return &PartnerNamespacesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} -} - -// BeginCreateOrUpdate - Asynchronously creates a new partner namespace with the specified parameters. -// If the operation fails it returns a generic error. -func (client *PartnerNamespacesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceInfo PartnerNamespace, options *PartnerNamespacesBeginCreateOrUpdateOptions) (PartnerNamespacesCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, resourceGroupName, partnerNamespaceName, partnerNamespaceInfo, options) - if err != nil { - return PartnerNamespacesCreateOrUpdatePollerResponse{}, err - } - result := PartnerNamespacesCreateOrUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("PartnerNamespacesClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) - if err != nil { - return PartnerNamespacesCreateOrUpdatePollerResponse{}, err - } - result.Poller = &PartnerNamespacesCreateOrUpdatePoller{ - pt: pt, - } - return result, nil -} - -// CreateOrUpdate - Asynchronously creates a new partner namespace with the specified parameters. -// If the operation fails it returns a generic error. -func (client *PartnerNamespacesClient) createOrUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceInfo PartnerNamespace, options *PartnerNamespacesBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, partnerNamespaceName, partnerNamespaceInfo, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return nil, client.createOrUpdateHandleError(resp) - } - return resp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PartnerNamespacesClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceInfo PartnerNamespace, options *PartnerNamespacesBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerNamespaceName == "" { - return nil, errors.New("parameter partnerNamespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerNamespaceName}", url.PathEscape(partnerNamespaceName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, runtime.MarshalAsJSON(req, partnerNamespaceInfo) -} - -// createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *PartnerNamespacesClient) createOrUpdateHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// BeginDelete - Delete existing partner namespace. -// If the operation fails it returns a generic error. -func (client *PartnerNamespacesClient) BeginDelete(ctx context.Context, resourceGroupName string, partnerNamespaceName string, options *PartnerNamespacesBeginDeleteOptions) (PartnerNamespacesDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, partnerNamespaceName, options) - if err != nil { - return PartnerNamespacesDeletePollerResponse{}, err - } - result := PartnerNamespacesDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("PartnerNamespacesClient.Delete", "", resp, client.pl, client.deleteHandleError) - if err != nil { - return PartnerNamespacesDeletePollerResponse{}, err - } - result.Poller = &PartnerNamespacesDeletePoller{ - pt: pt, - } - return result, nil -} - -// Delete - Delete existing partner namespace. -// If the operation fails it returns a generic error. -func (client *PartnerNamespacesClient) deleteOperation(ctx context.Context, resourceGroupName string, partnerNamespaceName string, options *PartnerNamespacesBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, partnerNamespaceName, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, client.deleteHandleError(resp) - } - return resp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *PartnerNamespacesClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, partnerNamespaceName string, options *PartnerNamespacesBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerNamespaceName == "" { - return nil, errors.New("parameter partnerNamespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerNamespaceName}", url.PathEscape(partnerNamespaceName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - return req, nil -} - -// deleteHandleError handles the Delete error response. -func (client *PartnerNamespacesClient) deleteHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// Get - Get properties of a partner namespace. -// If the operation fails it returns a generic error. -func (client *PartnerNamespacesClient) Get(ctx context.Context, resourceGroupName string, partnerNamespaceName string, options *PartnerNamespacesGetOptions) (PartnerNamespacesGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, partnerNamespaceName, options) - if err != nil { - return PartnerNamespacesGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PartnerNamespacesGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerNamespacesGetResponse{}, client.getHandleError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *PartnerNamespacesClient) getCreateRequest(ctx context.Context, resourceGroupName string, partnerNamespaceName string, options *PartnerNamespacesGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerNamespaceName == "" { - return nil, errors.New("parameter partnerNamespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerNamespaceName}", url.PathEscape(partnerNamespaceName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PartnerNamespacesClient) getHandleResponse(resp *http.Response) (PartnerNamespacesGetResponse, error) { - result := PartnerNamespacesGetResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerNamespace); err != nil { - return PartnerNamespacesGetResponse{}, err - } - return result, nil -} - -// getHandleError handles the Get error response. -func (client *PartnerNamespacesClient) getHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// ListByResourceGroup - List all the partner namespaces under a resource group. -// If the operation fails it returns a generic error. -func (client *PartnerNamespacesClient) ListByResourceGroup(resourceGroupName string, options *PartnerNamespacesListByResourceGroupOptions) *PartnerNamespacesListByResourceGroupPager { - return &PartnerNamespacesListByResourceGroupPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - }, - advancer: func(ctx context.Context, resp PartnerNamespacesListByResourceGroupResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.PartnerNamespacesListResult.NextLink) - }, - } -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *PartnerNamespacesClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PartnerNamespacesListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *PartnerNamespacesClient) listByResourceGroupHandleResponse(resp *http.Response) (PartnerNamespacesListByResourceGroupResponse, error) { - result := PartnerNamespacesListByResourceGroupResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerNamespacesListResult); err != nil { - return PartnerNamespacesListByResourceGroupResponse{}, err - } - return result, nil -} - -// listByResourceGroupHandleError handles the ListByResourceGroup error response. -func (client *PartnerNamespacesClient) listByResourceGroupHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// ListBySubscription - List all the partner namespaces under an Azure subscription. -// If the operation fails it returns a generic error. -func (client *PartnerNamespacesClient) ListBySubscription(options *PartnerNamespacesListBySubscriptionOptions) *PartnerNamespacesListBySubscriptionPager { - return &PartnerNamespacesListBySubscriptionPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) - }, - advancer: func(ctx context.Context, resp PartnerNamespacesListBySubscriptionResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.PartnerNamespacesListResult.NextLink) - }, - } -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *PartnerNamespacesClient) listBySubscriptionCreateRequest(ctx context.Context, options *PartnerNamespacesListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerNamespaces" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *PartnerNamespacesClient) listBySubscriptionHandleResponse(resp *http.Response) (PartnerNamespacesListBySubscriptionResponse, error) { - result := PartnerNamespacesListBySubscriptionResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerNamespacesListResult); err != nil { - return PartnerNamespacesListBySubscriptionResponse{}, err - } - return result, nil -} - -// listBySubscriptionHandleError handles the ListBySubscription error response. -func (client *PartnerNamespacesClient) listBySubscriptionHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// ListSharedAccessKeys - List the two keys used to publish to a partner namespace. -// If the operation fails it returns a generic error. -func (client *PartnerNamespacesClient) ListSharedAccessKeys(ctx context.Context, resourceGroupName string, partnerNamespaceName string, options *PartnerNamespacesListSharedAccessKeysOptions) (PartnerNamespacesListSharedAccessKeysResponse, error) { - req, err := client.listSharedAccessKeysCreateRequest(ctx, resourceGroupName, partnerNamespaceName, options) - if err != nil { - return PartnerNamespacesListSharedAccessKeysResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PartnerNamespacesListSharedAccessKeysResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerNamespacesListSharedAccessKeysResponse{}, client.listSharedAccessKeysHandleError(resp) - } - return client.listSharedAccessKeysHandleResponse(resp) -} - -// listSharedAccessKeysCreateRequest creates the ListSharedAccessKeys request. -func (client *PartnerNamespacesClient) listSharedAccessKeysCreateRequest(ctx context.Context, resourceGroupName string, partnerNamespaceName string, options *PartnerNamespacesListSharedAccessKeysOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/listKeys" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerNamespaceName == "" { - return nil, errors.New("parameter partnerNamespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerNamespaceName}", url.PathEscape(partnerNamespaceName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// listSharedAccessKeysHandleResponse handles the ListSharedAccessKeys response. -func (client *PartnerNamespacesClient) listSharedAccessKeysHandleResponse(resp *http.Response) (PartnerNamespacesListSharedAccessKeysResponse, error) { - result := PartnerNamespacesListSharedAccessKeysResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerNamespaceSharedAccessKeys); err != nil { - return PartnerNamespacesListSharedAccessKeysResponse{}, err - } - return result, nil -} - -// listSharedAccessKeysHandleError handles the ListSharedAccessKeys error response. -func (client *PartnerNamespacesClient) listSharedAccessKeysHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// RegenerateKey - Regenerate a shared access key for a partner namespace. -// If the operation fails it returns a generic error. -func (client *PartnerNamespacesClient) RegenerateKey(ctx context.Context, resourceGroupName string, partnerNamespaceName string, regenerateKeyRequest PartnerNamespaceRegenerateKeyRequest, options *PartnerNamespacesRegenerateKeyOptions) (PartnerNamespacesRegenerateKeyResponse, error) { - req, err := client.regenerateKeyCreateRequest(ctx, resourceGroupName, partnerNamespaceName, regenerateKeyRequest, options) - if err != nil { - return PartnerNamespacesRegenerateKeyResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PartnerNamespacesRegenerateKeyResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerNamespacesRegenerateKeyResponse{}, client.regenerateKeyHandleError(resp) - } - return client.regenerateKeyHandleResponse(resp) -} - -// regenerateKeyCreateRequest creates the RegenerateKey request. -func (client *PartnerNamespacesClient) regenerateKeyCreateRequest(ctx context.Context, resourceGroupName string, partnerNamespaceName string, regenerateKeyRequest PartnerNamespaceRegenerateKeyRequest, options *PartnerNamespacesRegenerateKeyOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}/regenerateKey" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerNamespaceName == "" { - return nil, errors.New("parameter partnerNamespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerNamespaceName}", url.PathEscape(partnerNamespaceName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, runtime.MarshalAsJSON(req, regenerateKeyRequest) -} - -// regenerateKeyHandleResponse handles the RegenerateKey response. -func (client *PartnerNamespacesClient) regenerateKeyHandleResponse(resp *http.Response) (PartnerNamespacesRegenerateKeyResponse, error) { - result := PartnerNamespacesRegenerateKeyResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerNamespaceSharedAccessKeys); err != nil { - return PartnerNamespacesRegenerateKeyResponse{}, err - } - return result, nil -} - -// regenerateKeyHandleError handles the RegenerateKey error response. -func (client *PartnerNamespacesClient) regenerateKeyHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// BeginUpdate - Asynchronously updates a partner namespace with the specified parameters. -// If the operation fails it returns a generic error. -func (client *PartnerNamespacesClient) BeginUpdate(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceUpdateParameters PartnerNamespaceUpdateParameters, options *PartnerNamespacesBeginUpdateOptions) (PartnerNamespacesUpdatePollerResponse, error) { - resp, err := client.update(ctx, resourceGroupName, partnerNamespaceName, partnerNamespaceUpdateParameters, options) - if err != nil { - return PartnerNamespacesUpdatePollerResponse{}, err - } - result := PartnerNamespacesUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("PartnerNamespacesClient.Update", "", resp, client.pl, client.updateHandleError) - if err != nil { - return PartnerNamespacesUpdatePollerResponse{}, err - } - result.Poller = &PartnerNamespacesUpdatePoller{ - pt: pt, - } - return result, nil -} - -// Update - Asynchronously updates a partner namespace with the specified parameters. -// If the operation fails it returns a generic error. -func (client *PartnerNamespacesClient) update(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceUpdateParameters PartnerNamespaceUpdateParameters, options *PartnerNamespacesBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, partnerNamespaceName, partnerNamespaceUpdateParameters, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return nil, client.updateHandleError(resp) - } - return resp, nil -} - -// updateCreateRequest creates the Update request. -func (client *PartnerNamespacesClient) updateCreateRequest(ctx context.Context, resourceGroupName string, partnerNamespaceName string, partnerNamespaceUpdateParameters PartnerNamespaceUpdateParameters, options *PartnerNamespacesBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerNamespaces/{partnerNamespaceName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerNamespaceName == "" { - return nil, errors.New("parameter partnerNamespaceName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerNamespaceName}", url.PathEscape(partnerNamespaceName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, runtime.MarshalAsJSON(req, partnerNamespaceUpdateParameters) -} - -// updateHandleError handles the Update error response. -func (client *PartnerNamespacesClient) updateHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_partnerregistrations_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_partnerregistrations_client.go deleted file mode 100644 index 70e126fd5926..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_partnerregistrations_client.go +++ /dev/null @@ -1,403 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armeventgrid - -import ( - "context" - "errors" - "net/http" - "net/url" - "strconv" - "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" -) - -// PartnerRegistrationsClient contains the methods for the PartnerRegistrations group. -// Don't use this type directly, use NewPartnerRegistrationsClient() instead. -type PartnerRegistrationsClient struct { - ep string - pl runtime.Pipeline - subscriptionID string -} - -// NewPartnerRegistrationsClient creates a new instance of PartnerRegistrationsClient with the specified values. -func NewPartnerRegistrationsClient(con *arm.Connection, subscriptionID string) *PartnerRegistrationsClient { - return &PartnerRegistrationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} -} - -// CreateOrUpdate - Creates a new partner registration with the specified parameters. -// If the operation fails it returns a generic error. -func (client *PartnerRegistrationsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationInfo PartnerRegistration, options *PartnerRegistrationsCreateOrUpdateOptions) (PartnerRegistrationsCreateOrUpdateResponse, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, partnerRegistrationName, partnerRegistrationInfo, options) - if err != nil { - return PartnerRegistrationsCreateOrUpdateResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PartnerRegistrationsCreateOrUpdateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { - return PartnerRegistrationsCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) - } - return client.createOrUpdateHandleResponse(resp) -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PartnerRegistrationsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationInfo PartnerRegistration, options *PartnerRegistrationsCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerRegistrationName == "" { - return nil, errors.New("parameter partnerRegistrationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerRegistrationName}", url.PathEscape(partnerRegistrationName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, runtime.MarshalAsJSON(req, partnerRegistrationInfo) -} - -// createOrUpdateHandleResponse handles the CreateOrUpdate response. -func (client *PartnerRegistrationsClient) createOrUpdateHandleResponse(resp *http.Response) (PartnerRegistrationsCreateOrUpdateResponse, error) { - result := PartnerRegistrationsCreateOrUpdateResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerRegistration); err != nil { - return PartnerRegistrationsCreateOrUpdateResponse{}, err - } - return result, nil -} - -// createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *PartnerRegistrationsClient) createOrUpdateHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// Delete - Deletes a partner registration with the specified parameters. -// If the operation fails it returns a generic error. -func (client *PartnerRegistrationsClient) Delete(ctx context.Context, resourceGroupName string, partnerRegistrationName string, options *PartnerRegistrationsDeleteOptions) (PartnerRegistrationsDeleteResponse, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, partnerRegistrationName, options) - if err != nil { - return PartnerRegistrationsDeleteResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PartnerRegistrationsDeleteResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return PartnerRegistrationsDeleteResponse{}, client.deleteHandleError(resp) - } - return PartnerRegistrationsDeleteResponse{RawResponse: resp}, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *PartnerRegistrationsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, partnerRegistrationName string, options *PartnerRegistrationsDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerRegistrationName == "" { - return nil, errors.New("parameter partnerRegistrationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerRegistrationName}", url.PathEscape(partnerRegistrationName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - return req, nil -} - -// deleteHandleError handles the Delete error response. -func (client *PartnerRegistrationsClient) deleteHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// Get - Gets a partner registration with the specified parameters. -// If the operation fails it returns a generic error. -func (client *PartnerRegistrationsClient) Get(ctx context.Context, resourceGroupName string, partnerRegistrationName string, options *PartnerRegistrationsGetOptions) (PartnerRegistrationsGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, partnerRegistrationName, options) - if err != nil { - return PartnerRegistrationsGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PartnerRegistrationsGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerRegistrationsGetResponse{}, client.getHandleError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *PartnerRegistrationsClient) getCreateRequest(ctx context.Context, resourceGroupName string, partnerRegistrationName string, options *PartnerRegistrationsGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerRegistrationName == "" { - return nil, errors.New("parameter partnerRegistrationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerRegistrationName}", url.PathEscape(partnerRegistrationName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PartnerRegistrationsClient) getHandleResponse(resp *http.Response) (PartnerRegistrationsGetResponse, error) { - result := PartnerRegistrationsGetResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerRegistration); err != nil { - return PartnerRegistrationsGetResponse{}, err - } - return result, nil -} - -// getHandleError handles the Get error response. -func (client *PartnerRegistrationsClient) getHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// ListByResourceGroup - List all the partner registrations under a resource group. -// If the operation fails it returns a generic error. -func (client *PartnerRegistrationsClient) ListByResourceGroup(resourceGroupName string, options *PartnerRegistrationsListByResourceGroupOptions) *PartnerRegistrationsListByResourceGroupPager { - return &PartnerRegistrationsListByResourceGroupPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - }, - advancer: func(ctx context.Context, resp PartnerRegistrationsListByResourceGroupResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.PartnerRegistrationsListResult.NextLink) - }, - } -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *PartnerRegistrationsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PartnerRegistrationsListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *PartnerRegistrationsClient) listByResourceGroupHandleResponse(resp *http.Response) (PartnerRegistrationsListByResourceGroupResponse, error) { - result := PartnerRegistrationsListByResourceGroupResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerRegistrationsListResult); err != nil { - return PartnerRegistrationsListByResourceGroupResponse{}, err - } - return result, nil -} - -// listByResourceGroupHandleError handles the ListByResourceGroup error response. -func (client *PartnerRegistrationsClient) listByResourceGroupHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// ListBySubscription - List all the partner registrations under an Azure subscription. -// If the operation fails it returns a generic error. -func (client *PartnerRegistrationsClient) ListBySubscription(options *PartnerRegistrationsListBySubscriptionOptions) *PartnerRegistrationsListBySubscriptionPager { - return &PartnerRegistrationsListBySubscriptionPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) - }, - advancer: func(ctx context.Context, resp PartnerRegistrationsListBySubscriptionResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.PartnerRegistrationsListResult.NextLink) - }, - } -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *PartnerRegistrationsClient) listBySubscriptionCreateRequest(ctx context.Context, options *PartnerRegistrationsListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerRegistrations" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *PartnerRegistrationsClient) listBySubscriptionHandleResponse(resp *http.Response) (PartnerRegistrationsListBySubscriptionResponse, error) { - result := PartnerRegistrationsListBySubscriptionResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerRegistrationsListResult); err != nil { - return PartnerRegistrationsListBySubscriptionResponse{}, err - } - return result, nil -} - -// listBySubscriptionHandleError handles the ListBySubscription error response. -func (client *PartnerRegistrationsClient) listBySubscriptionHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// Update - Updates a partner registration with the specified parameters. -// If the operation fails it returns a generic error. -func (client *PartnerRegistrationsClient) Update(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationUpdateParameters PartnerRegistrationUpdateParameters, options *PartnerRegistrationsUpdateOptions) (PartnerRegistrationsUpdateResponse, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, partnerRegistrationName, partnerRegistrationUpdateParameters, options) - if err != nil { - return PartnerRegistrationsUpdateResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PartnerRegistrationsUpdateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return PartnerRegistrationsUpdateResponse{}, client.updateHandleError(resp) - } - return client.updateHandleResponse(resp) -} - -// updateCreateRequest creates the Update request. -func (client *PartnerRegistrationsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, partnerRegistrationName string, partnerRegistrationUpdateParameters PartnerRegistrationUpdateParameters, options *PartnerRegistrationsUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerRegistrations/{partnerRegistrationName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerRegistrationName == "" { - return nil, errors.New("parameter partnerRegistrationName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerRegistrationName}", url.PathEscape(partnerRegistrationName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, runtime.MarshalAsJSON(req, partnerRegistrationUpdateParameters) -} - -// updateHandleResponse handles the Update response. -func (client *PartnerRegistrationsClient) updateHandleResponse(resp *http.Response) (PartnerRegistrationsUpdateResponse, error) { - result := PartnerRegistrationsUpdateResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerRegistration); err != nil { - return PartnerRegistrationsUpdateResponse{}, err - } - return result, nil -} - -// updateHandleError handles the Update error response. -func (client *PartnerRegistrationsClient) updateHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_partnertopiceventsubscriptions_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_partnertopiceventsubscriptions_client.go deleted file mode 100644 index f94dceb82d1b..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_partnertopiceventsubscriptions_client.go +++ /dev/null @@ -1,545 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armeventgrid - -import ( - "context" - "errors" - "net/http" - "net/url" - "strconv" - "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" -) - -// PartnerTopicEventSubscriptionsClient contains the methods for the PartnerTopicEventSubscriptions group. -// Don't use this type directly, use NewPartnerTopicEventSubscriptionsClient() instead. -type PartnerTopicEventSubscriptionsClient struct { - ep string - pl runtime.Pipeline - subscriptionID string -} - -// NewPartnerTopicEventSubscriptionsClient creates a new instance of PartnerTopicEventSubscriptionsClient with the specified values. -func NewPartnerTopicEventSubscriptionsClient(con *arm.Connection, subscriptionID string) *PartnerTopicEventSubscriptionsClient { - return &PartnerTopicEventSubscriptionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} -} - -// BeginCreateOrUpdate - Asynchronously creates or updates an event subscription of a partner topic with the specified parameters. Existing event subscriptions -// will be updated with this API. -// If the operation fails it returns a generic error. -func (client *PartnerTopicEventSubscriptionsClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription, options *PartnerTopicEventSubscriptionsBeginCreateOrUpdateOptions) (PartnerTopicEventSubscriptionsCreateOrUpdatePollerResponse, error) { - resp, err := client.createOrUpdate(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, eventSubscriptionInfo, options) - if err != nil { - return PartnerTopicEventSubscriptionsCreateOrUpdatePollerResponse{}, err - } - result := PartnerTopicEventSubscriptionsCreateOrUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("PartnerTopicEventSubscriptionsClient.CreateOrUpdate", "", resp, client.pl, client.createOrUpdateHandleError) - if err != nil { - return PartnerTopicEventSubscriptionsCreateOrUpdatePollerResponse{}, err - } - result.Poller = &PartnerTopicEventSubscriptionsCreateOrUpdatePoller{ - pt: pt, - } - return result, nil -} - -// CreateOrUpdate - Asynchronously creates or updates an event subscription of a partner topic with the specified parameters. Existing event subscriptions -// will be updated with this API. -// If the operation fails it returns a generic error. -func (client *PartnerTopicEventSubscriptionsClient) createOrUpdate(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription, options *PartnerTopicEventSubscriptionsBeginCreateOrUpdateOptions) (*http.Response, error) { - req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, eventSubscriptionInfo, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return nil, client.createOrUpdateHandleError(resp) - } - return resp, nil -} - -// createOrUpdateCreateRequest creates the CreateOrUpdate request. -func (client *PartnerTopicEventSubscriptionsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionInfo EventSubscription, options *PartnerTopicEventSubscriptionsBeginCreateOrUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerTopicName == "" { - return nil, errors.New("parameter partnerTopicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerTopicName}", url.PathEscape(partnerTopicName)) - if eventSubscriptionName == "" { - return nil, errors.New("parameter eventSubscriptionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{eventSubscriptionName}", url.PathEscape(eventSubscriptionName)) - req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, runtime.MarshalAsJSON(req, eventSubscriptionInfo) -} - -// createOrUpdateHandleError handles the CreateOrUpdate error response. -func (client *PartnerTopicEventSubscriptionsClient) createOrUpdateHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// BeginDelete - Delete an event subscription of a partner topic. -// If the operation fails it returns a generic error. -func (client *PartnerTopicEventSubscriptionsClient) BeginDelete(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, options *PartnerTopicEventSubscriptionsBeginDeleteOptions) (PartnerTopicEventSubscriptionsDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, options) - if err != nil { - return PartnerTopicEventSubscriptionsDeletePollerResponse{}, err - } - result := PartnerTopicEventSubscriptionsDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("PartnerTopicEventSubscriptionsClient.Delete", "", resp, client.pl, client.deleteHandleError) - if err != nil { - return PartnerTopicEventSubscriptionsDeletePollerResponse{}, err - } - result.Poller = &PartnerTopicEventSubscriptionsDeletePoller{ - pt: pt, - } - return result, nil -} - -// Delete - Delete an event subscription of a partner topic. -// If the operation fails it returns a generic error. -func (client *PartnerTopicEventSubscriptionsClient) deleteOperation(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, options *PartnerTopicEventSubscriptionsBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, client.deleteHandleError(resp) - } - return resp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *PartnerTopicEventSubscriptionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, options *PartnerTopicEventSubscriptionsBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerTopicName == "" { - return nil, errors.New("parameter partnerTopicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerTopicName}", url.PathEscape(partnerTopicName)) - if eventSubscriptionName == "" { - return nil, errors.New("parameter eventSubscriptionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{eventSubscriptionName}", url.PathEscape(eventSubscriptionName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - return req, nil -} - -// deleteHandleError handles the Delete error response. -func (client *PartnerTopicEventSubscriptionsClient) deleteHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// Get - Get an event subscription of a partner topic. -// If the operation fails it returns a generic error. -func (client *PartnerTopicEventSubscriptionsClient) Get(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, options *PartnerTopicEventSubscriptionsGetOptions) (PartnerTopicEventSubscriptionsGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, options) - if err != nil { - return PartnerTopicEventSubscriptionsGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PartnerTopicEventSubscriptionsGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerTopicEventSubscriptionsGetResponse{}, client.getHandleError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *PartnerTopicEventSubscriptionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, options *PartnerTopicEventSubscriptionsGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerTopicName == "" { - return nil, errors.New("parameter partnerTopicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerTopicName}", url.PathEscape(partnerTopicName)) - if eventSubscriptionName == "" { - return nil, errors.New("parameter eventSubscriptionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{eventSubscriptionName}", url.PathEscape(eventSubscriptionName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PartnerTopicEventSubscriptionsClient) getHandleResponse(resp *http.Response) (PartnerTopicEventSubscriptionsGetResponse, error) { - result := PartnerTopicEventSubscriptionsGetResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.EventSubscription); err != nil { - return PartnerTopicEventSubscriptionsGetResponse{}, err - } - return result, nil -} - -// getHandleError handles the Get error response. -func (client *PartnerTopicEventSubscriptionsClient) getHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// GetDeliveryAttributes - Get all delivery attributes for an event subscription of a partner topic. -// If the operation fails it returns a generic error. -func (client *PartnerTopicEventSubscriptionsClient) GetDeliveryAttributes(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, options *PartnerTopicEventSubscriptionsGetDeliveryAttributesOptions) (PartnerTopicEventSubscriptionsGetDeliveryAttributesResponse, error) { - req, err := client.getDeliveryAttributesCreateRequest(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, options) - if err != nil { - return PartnerTopicEventSubscriptionsGetDeliveryAttributesResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PartnerTopicEventSubscriptionsGetDeliveryAttributesResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerTopicEventSubscriptionsGetDeliveryAttributesResponse{}, client.getDeliveryAttributesHandleError(resp) - } - return client.getDeliveryAttributesHandleResponse(resp) -} - -// getDeliveryAttributesCreateRequest creates the GetDeliveryAttributes request. -func (client *PartnerTopicEventSubscriptionsClient) getDeliveryAttributesCreateRequest(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, options *PartnerTopicEventSubscriptionsGetDeliveryAttributesOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}/getDeliveryAttributes" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerTopicName == "" { - return nil, errors.New("parameter partnerTopicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerTopicName}", url.PathEscape(partnerTopicName)) - if eventSubscriptionName == "" { - return nil, errors.New("parameter eventSubscriptionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{eventSubscriptionName}", url.PathEscape(eventSubscriptionName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// getDeliveryAttributesHandleResponse handles the GetDeliveryAttributes response. -func (client *PartnerTopicEventSubscriptionsClient) getDeliveryAttributesHandleResponse(resp *http.Response) (PartnerTopicEventSubscriptionsGetDeliveryAttributesResponse, error) { - result := PartnerTopicEventSubscriptionsGetDeliveryAttributesResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.DeliveryAttributeListResult); err != nil { - return PartnerTopicEventSubscriptionsGetDeliveryAttributesResponse{}, err - } - return result, nil -} - -// getDeliveryAttributesHandleError handles the GetDeliveryAttributes error response. -func (client *PartnerTopicEventSubscriptionsClient) getDeliveryAttributesHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// GetFullURL - Get the full endpoint URL for an event subscription of a partner topic. -// If the operation fails it returns a generic error. -func (client *PartnerTopicEventSubscriptionsClient) GetFullURL(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, options *PartnerTopicEventSubscriptionsGetFullURLOptions) (PartnerTopicEventSubscriptionsGetFullURLResponse, error) { - req, err := client.getFullURLCreateRequest(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, options) - if err != nil { - return PartnerTopicEventSubscriptionsGetFullURLResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PartnerTopicEventSubscriptionsGetFullURLResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerTopicEventSubscriptionsGetFullURLResponse{}, client.getFullURLHandleError(resp) - } - return client.getFullURLHandleResponse(resp) -} - -// getFullURLCreateRequest creates the GetFullURL request. -func (client *PartnerTopicEventSubscriptionsClient) getFullURLCreateRequest(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, options *PartnerTopicEventSubscriptionsGetFullURLOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}/getFullUrl" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerTopicName == "" { - return nil, errors.New("parameter partnerTopicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerTopicName}", url.PathEscape(partnerTopicName)) - if eventSubscriptionName == "" { - return nil, errors.New("parameter eventSubscriptionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{eventSubscriptionName}", url.PathEscape(eventSubscriptionName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// getFullURLHandleResponse handles the GetFullURL response. -func (client *PartnerTopicEventSubscriptionsClient) getFullURLHandleResponse(resp *http.Response) (PartnerTopicEventSubscriptionsGetFullURLResponse, error) { - result := PartnerTopicEventSubscriptionsGetFullURLResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.EventSubscriptionFullURL); err != nil { - return PartnerTopicEventSubscriptionsGetFullURLResponse{}, err - } - return result, nil -} - -// getFullURLHandleError handles the GetFullURL error response. -func (client *PartnerTopicEventSubscriptionsClient) getFullURLHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// ListByPartnerTopic - List event subscriptions that belong to a specific partner topic. -// If the operation fails it returns a generic error. -func (client *PartnerTopicEventSubscriptionsClient) ListByPartnerTopic(resourceGroupName string, partnerTopicName string, options *PartnerTopicEventSubscriptionsListByPartnerTopicOptions) *PartnerTopicEventSubscriptionsListByPartnerTopicPager { - return &PartnerTopicEventSubscriptionsListByPartnerTopicPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByPartnerTopicCreateRequest(ctx, resourceGroupName, partnerTopicName, options) - }, - advancer: func(ctx context.Context, resp PartnerTopicEventSubscriptionsListByPartnerTopicResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.EventSubscriptionsListResult.NextLink) - }, - } -} - -// listByPartnerTopicCreateRequest creates the ListByPartnerTopic request. -func (client *PartnerTopicEventSubscriptionsClient) listByPartnerTopicCreateRequest(ctx context.Context, resourceGroupName string, partnerTopicName string, options *PartnerTopicEventSubscriptionsListByPartnerTopicOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerTopicName == "" { - return nil, errors.New("parameter partnerTopicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerTopicName}", url.PathEscape(partnerTopicName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// listByPartnerTopicHandleResponse handles the ListByPartnerTopic response. -func (client *PartnerTopicEventSubscriptionsClient) listByPartnerTopicHandleResponse(resp *http.Response) (PartnerTopicEventSubscriptionsListByPartnerTopicResponse, error) { - result := PartnerTopicEventSubscriptionsListByPartnerTopicResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.EventSubscriptionsListResult); err != nil { - return PartnerTopicEventSubscriptionsListByPartnerTopicResponse{}, err - } - return result, nil -} - -// listByPartnerTopicHandleError handles the ListByPartnerTopic error response. -func (client *PartnerTopicEventSubscriptionsClient) listByPartnerTopicHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// BeginUpdate - Update event subscription of a partner topic. -// If the operation fails it returns a generic error. -func (client *PartnerTopicEventSubscriptionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters, options *PartnerTopicEventSubscriptionsBeginUpdateOptions) (PartnerTopicEventSubscriptionsUpdatePollerResponse, error) { - resp, err := client.update(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, eventSubscriptionUpdateParameters, options) - if err != nil { - return PartnerTopicEventSubscriptionsUpdatePollerResponse{}, err - } - result := PartnerTopicEventSubscriptionsUpdatePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("PartnerTopicEventSubscriptionsClient.Update", "", resp, client.pl, client.updateHandleError) - if err != nil { - return PartnerTopicEventSubscriptionsUpdatePollerResponse{}, err - } - result.Poller = &PartnerTopicEventSubscriptionsUpdatePoller{ - pt: pt, - } - return result, nil -} - -// Update - Update event subscription of a partner topic. -// If the operation fails it returns a generic error. -func (client *PartnerTopicEventSubscriptionsClient) update(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters, options *PartnerTopicEventSubscriptionsBeginUpdateOptions) (*http.Response, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, partnerTopicName, eventSubscriptionName, eventSubscriptionUpdateParameters, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusCreated) { - return nil, client.updateHandleError(resp) - } - return resp, nil -} - -// updateCreateRequest creates the Update request. -func (client *PartnerTopicEventSubscriptionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, partnerTopicName string, eventSubscriptionName string, eventSubscriptionUpdateParameters EventSubscriptionUpdateParameters, options *PartnerTopicEventSubscriptionsBeginUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/eventSubscriptions/{eventSubscriptionName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerTopicName == "" { - return nil, errors.New("parameter partnerTopicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerTopicName}", url.PathEscape(partnerTopicName)) - if eventSubscriptionName == "" { - return nil, errors.New("parameter eventSubscriptionName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{eventSubscriptionName}", url.PathEscape(eventSubscriptionName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, runtime.MarshalAsJSON(req, eventSubscriptionUpdateParameters) -} - -// updateHandleError handles the Update error response. -func (client *PartnerTopicEventSubscriptionsClient) updateHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_partnertopics_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_partnertopics_client.go deleted file mode 100644 index 963aa91d0269..000000000000 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_partnertopics_client.go +++ /dev/null @@ -1,488 +0,0 @@ -//go:build go1.16 -// +build go1.16 - -// 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. - -package armeventgrid - -import ( - "context" - "errors" - "net/http" - "net/url" - "strconv" - "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" -) - -// PartnerTopicsClient contains the methods for the PartnerTopics group. -// Don't use this type directly, use NewPartnerTopicsClient() instead. -type PartnerTopicsClient struct { - ep string - pl runtime.Pipeline - subscriptionID string -} - -// NewPartnerTopicsClient creates a new instance of PartnerTopicsClient with the specified values. -func NewPartnerTopicsClient(con *arm.Connection, subscriptionID string) *PartnerTopicsClient { - return &PartnerTopicsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} -} - -// Activate - Activate a newly created partner topic. -// If the operation fails it returns a generic error. -func (client *PartnerTopicsClient) Activate(ctx context.Context, resourceGroupName string, partnerTopicName string, options *PartnerTopicsActivateOptions) (PartnerTopicsActivateResponse, error) { - req, err := client.activateCreateRequest(ctx, resourceGroupName, partnerTopicName, options) - if err != nil { - return PartnerTopicsActivateResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PartnerTopicsActivateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerTopicsActivateResponse{}, client.activateHandleError(resp) - } - return client.activateHandleResponse(resp) -} - -// activateCreateRequest creates the Activate request. -func (client *PartnerTopicsClient) activateCreateRequest(ctx context.Context, resourceGroupName string, partnerTopicName string, options *PartnerTopicsActivateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/activate" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerTopicName == "" { - return nil, errors.New("parameter partnerTopicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerTopicName}", url.PathEscape(partnerTopicName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// activateHandleResponse handles the Activate response. -func (client *PartnerTopicsClient) activateHandleResponse(resp *http.Response) (PartnerTopicsActivateResponse, error) { - result := PartnerTopicsActivateResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerTopic); err != nil { - return PartnerTopicsActivateResponse{}, err - } - return result, nil -} - -// activateHandleError handles the Activate error response. -func (client *PartnerTopicsClient) activateHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// Deactivate - Deactivate specific partner topic. -// If the operation fails it returns a generic error. -func (client *PartnerTopicsClient) Deactivate(ctx context.Context, resourceGroupName string, partnerTopicName string, options *PartnerTopicsDeactivateOptions) (PartnerTopicsDeactivateResponse, error) { - req, err := client.deactivateCreateRequest(ctx, resourceGroupName, partnerTopicName, options) - if err != nil { - return PartnerTopicsDeactivateResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PartnerTopicsDeactivateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerTopicsDeactivateResponse{}, client.deactivateHandleError(resp) - } - return client.deactivateHandleResponse(resp) -} - -// deactivateCreateRequest creates the Deactivate request. -func (client *PartnerTopicsClient) deactivateCreateRequest(ctx context.Context, resourceGroupName string, partnerTopicName string, options *PartnerTopicsDeactivateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}/deactivate" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerTopicName == "" { - return nil, errors.New("parameter partnerTopicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerTopicName}", url.PathEscape(partnerTopicName)) - req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// deactivateHandleResponse handles the Deactivate response. -func (client *PartnerTopicsClient) deactivateHandleResponse(resp *http.Response) (PartnerTopicsDeactivateResponse, error) { - result := PartnerTopicsDeactivateResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerTopic); err != nil { - return PartnerTopicsDeactivateResponse{}, err - } - return result, nil -} - -// deactivateHandleError handles the Deactivate error response. -func (client *PartnerTopicsClient) deactivateHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// BeginDelete - Delete existing partner topic. -// If the operation fails it returns a generic error. -func (client *PartnerTopicsClient) BeginDelete(ctx context.Context, resourceGroupName string, partnerTopicName string, options *PartnerTopicsBeginDeleteOptions) (PartnerTopicsDeletePollerResponse, error) { - resp, err := client.deleteOperation(ctx, resourceGroupName, partnerTopicName, options) - if err != nil { - return PartnerTopicsDeletePollerResponse{}, err - } - result := PartnerTopicsDeletePollerResponse{ - RawResponse: resp, - } - pt, err := armruntime.NewPoller("PartnerTopicsClient.Delete", "", resp, client.pl, client.deleteHandleError) - if err != nil { - return PartnerTopicsDeletePollerResponse{}, err - } - result.Poller = &PartnerTopicsDeletePoller{ - pt: pt, - } - return result, nil -} - -// Delete - Delete existing partner topic. -// If the operation fails it returns a generic error. -func (client *PartnerTopicsClient) deleteOperation(ctx context.Context, resourceGroupName string, partnerTopicName string, options *PartnerTopicsBeginDeleteOptions) (*http.Response, error) { - req, err := client.deleteCreateRequest(ctx, resourceGroupName, partnerTopicName, options) - if err != nil { - return nil, err - } - resp, err := client.pl.Do(req) - if err != nil { - return nil, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { - return nil, client.deleteHandleError(resp) - } - return resp, nil -} - -// deleteCreateRequest creates the Delete request. -func (client *PartnerTopicsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, partnerTopicName string, options *PartnerTopicsBeginDeleteOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerTopicName == "" { - return nil, errors.New("parameter partnerTopicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerTopicName}", url.PathEscape(partnerTopicName)) - req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - return req, nil -} - -// deleteHandleError handles the Delete error response. -func (client *PartnerTopicsClient) deleteHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// Get - Get properties of a partner topic. -// If the operation fails it returns a generic error. -func (client *PartnerTopicsClient) Get(ctx context.Context, resourceGroupName string, partnerTopicName string, options *PartnerTopicsGetOptions) (PartnerTopicsGetResponse, error) { - req, err := client.getCreateRequest(ctx, resourceGroupName, partnerTopicName, options) - if err != nil { - return PartnerTopicsGetResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PartnerTopicsGetResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK) { - return PartnerTopicsGetResponse{}, client.getHandleError(resp) - } - return client.getHandleResponse(resp) -} - -// getCreateRequest creates the Get request. -func (client *PartnerTopicsClient) getCreateRequest(ctx context.Context, resourceGroupName string, partnerTopicName string, options *PartnerTopicsGetOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerTopicName == "" { - return nil, errors.New("parameter partnerTopicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerTopicName}", url.PathEscape(partnerTopicName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// getHandleResponse handles the Get response. -func (client *PartnerTopicsClient) getHandleResponse(resp *http.Response) (PartnerTopicsGetResponse, error) { - result := PartnerTopicsGetResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerTopic); err != nil { - return PartnerTopicsGetResponse{}, err - } - return result, nil -} - -// getHandleError handles the Get error response. -func (client *PartnerTopicsClient) getHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// ListByResourceGroup - List all the partner topics under a resource group. -// If the operation fails it returns a generic error. -func (client *PartnerTopicsClient) ListByResourceGroup(resourceGroupName string, options *PartnerTopicsListByResourceGroupOptions) *PartnerTopicsListByResourceGroupPager { - return &PartnerTopicsListByResourceGroupPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) - }, - advancer: func(ctx context.Context, resp PartnerTopicsListByResourceGroupResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.PartnerTopicsListResult.NextLink) - }, - } -} - -// listByResourceGroupCreateRequest creates the ListByResourceGroup request. -func (client *PartnerTopicsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *PartnerTopicsListByResourceGroupOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// listByResourceGroupHandleResponse handles the ListByResourceGroup response. -func (client *PartnerTopicsClient) listByResourceGroupHandleResponse(resp *http.Response) (PartnerTopicsListByResourceGroupResponse, error) { - result := PartnerTopicsListByResourceGroupResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerTopicsListResult); err != nil { - return PartnerTopicsListByResourceGroupResponse{}, err - } - return result, nil -} - -// listByResourceGroupHandleError handles the ListByResourceGroup error response. -func (client *PartnerTopicsClient) listByResourceGroupHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// ListBySubscription - List all the partner topics under an Azure subscription. -// If the operation fails it returns a generic error. -func (client *PartnerTopicsClient) ListBySubscription(options *PartnerTopicsListBySubscriptionOptions) *PartnerTopicsListBySubscriptionPager { - return &PartnerTopicsListBySubscriptionPager{ - client: client, - requester: func(ctx context.Context) (*policy.Request, error) { - return client.listBySubscriptionCreateRequest(ctx, options) - }, - advancer: func(ctx context.Context, resp PartnerTopicsListBySubscriptionResponse) (*policy.Request, error) { - return runtime.NewRequest(ctx, http.MethodGet, *resp.PartnerTopicsListResult.NextLink) - }, - } -} - -// listBySubscriptionCreateRequest creates the ListBySubscription request. -func (client *PartnerTopicsClient) listBySubscriptionCreateRequest(ctx context.Context, options *PartnerTopicsListBySubscriptionOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.EventGrid/partnerTopics" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - if options != nil && options.Filter != nil { - reqQP.Set("$filter", *options.Filter) - } - if options != nil && options.Top != nil { - reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) - } - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, nil -} - -// listBySubscriptionHandleResponse handles the ListBySubscription response. -func (client *PartnerTopicsClient) listBySubscriptionHandleResponse(resp *http.Response) (PartnerTopicsListBySubscriptionResponse, error) { - result := PartnerTopicsListBySubscriptionResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerTopicsListResult); err != nil { - return PartnerTopicsListBySubscriptionResponse{}, err - } - return result, nil -} - -// listBySubscriptionHandleError handles the ListBySubscription error response. -func (client *PartnerTopicsClient) listBySubscriptionHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} - -// Update - Asynchronously updates a partner topic with the specified parameters. -// If the operation fails it returns a generic error. -func (client *PartnerTopicsClient) Update(ctx context.Context, resourceGroupName string, partnerTopicName string, partnerTopicUpdateParameters PartnerTopicUpdateParameters, options *PartnerTopicsUpdateOptions) (PartnerTopicsUpdateResponse, error) { - req, err := client.updateCreateRequest(ctx, resourceGroupName, partnerTopicName, partnerTopicUpdateParameters, options) - if err != nil { - return PartnerTopicsUpdateResponse{}, err - } - resp, err := client.pl.Do(req) - if err != nil { - return PartnerTopicsUpdateResponse{}, err - } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { - return PartnerTopicsUpdateResponse{}, client.updateHandleError(resp) - } - return client.updateHandleResponse(resp) -} - -// updateCreateRequest creates the Update request. -func (client *PartnerTopicsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, partnerTopicName string, partnerTopicUpdateParameters PartnerTopicUpdateParameters, options *PartnerTopicsUpdateOptions) (*policy.Request, error) { - urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/partnerTopics/{partnerTopicName}" - if client.subscriptionID == "" { - return nil, errors.New("parameter client.subscriptionID cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) - if resourceGroupName == "" { - return nil, errors.New("parameter resourceGroupName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) - if partnerTopicName == "" { - return nil, errors.New("parameter partnerTopicName cannot be empty") - } - urlPath = strings.ReplaceAll(urlPath, "{partnerTopicName}", url.PathEscape(partnerTopicName)) - req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) - if err != nil { - return nil, err - } - reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") - req.Raw().URL.RawQuery = reqQP.Encode() - req.Raw().Header.Set("Accept", "application/json") - return req, runtime.MarshalAsJSON(req, partnerTopicUpdateParameters) -} - -// updateHandleResponse handles the Update response. -func (client *PartnerTopicsClient) updateHandleResponse(resp *http.Response) (PartnerTopicsUpdateResponse, error) { - result := PartnerTopicsUpdateResponse{RawResponse: resp} - if err := runtime.UnmarshalAsJSON(resp, &result.PartnerTopic); err != nil { - return PartnerTopicsUpdateResponse{}, err - } - return result, nil -} - -// updateHandleError handles the Update error response. -func (client *PartnerTopicsClient) updateHandleError(resp *http.Response) error { - body, err := runtime.Payload(resp) - if err != nil { - return runtime.NewResponseError(err, resp) - } - if len(body) == 0 { - return runtime.NewResponseError(errors.New(resp.Status), resp) - } - return runtime.NewResponseError(errors.New(string(body)), resp) -} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_pollers.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_pollers.go index f9e6bff74395..55f65a02d11f 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_pollers.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armeventgrid import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // DomainTopicsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. @@ -230,49 +229,6 @@ func (p *DomainsUpdatePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -// EventChannelsDeletePoller provides polling facilities until the operation reaches a terminal state. -type EventChannelsDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *EventChannelsDeletePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *EventChannelsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final EventChannelsDeleteResponse will be returned. -func (p *EventChannelsDeletePoller) FinalResponse(ctx context.Context) (EventChannelsDeleteResponse, error) { - respType := EventChannelsDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return EventChannelsDeleteResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *EventChannelsDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - // EventSubscriptionsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. type EventSubscriptionsCreateOrUpdatePoller struct { pt *azcore.Poller @@ -402,307 +358,6 @@ func (p *EventSubscriptionsUpdatePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } -// PartnerNamespacesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type PartnerNamespacesCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *PartnerNamespacesCreateOrUpdatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *PartnerNamespacesCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final PartnerNamespacesCreateOrUpdateResponse will be returned. -func (p *PartnerNamespacesCreateOrUpdatePoller) FinalResponse(ctx context.Context) (PartnerNamespacesCreateOrUpdateResponse, error) { - respType := PartnerNamespacesCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.PartnerNamespace) - if err != nil { - return PartnerNamespacesCreateOrUpdateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *PartnerNamespacesCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// PartnerNamespacesDeletePoller provides polling facilities until the operation reaches a terminal state. -type PartnerNamespacesDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *PartnerNamespacesDeletePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *PartnerNamespacesDeletePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final PartnerNamespacesDeleteResponse will be returned. -func (p *PartnerNamespacesDeletePoller) FinalResponse(ctx context.Context) (PartnerNamespacesDeleteResponse, error) { - respType := PartnerNamespacesDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return PartnerNamespacesDeleteResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *PartnerNamespacesDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// PartnerNamespacesUpdatePoller provides polling facilities until the operation reaches a terminal state. -type PartnerNamespacesUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *PartnerNamespacesUpdatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *PartnerNamespacesUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final PartnerNamespacesUpdateResponse will be returned. -func (p *PartnerNamespacesUpdatePoller) FinalResponse(ctx context.Context) (PartnerNamespacesUpdateResponse, error) { - respType := PartnerNamespacesUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.PartnerNamespace) - if err != nil { - return PartnerNamespacesUpdateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *PartnerNamespacesUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// PartnerTopicEventSubscriptionsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. -type PartnerTopicEventSubscriptionsCreateOrUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *PartnerTopicEventSubscriptionsCreateOrUpdatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *PartnerTopicEventSubscriptionsCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final PartnerTopicEventSubscriptionsCreateOrUpdateResponse will be returned. -func (p *PartnerTopicEventSubscriptionsCreateOrUpdatePoller) FinalResponse(ctx context.Context) (PartnerTopicEventSubscriptionsCreateOrUpdateResponse, error) { - respType := PartnerTopicEventSubscriptionsCreateOrUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.EventSubscription) - if err != nil { - return PartnerTopicEventSubscriptionsCreateOrUpdateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *PartnerTopicEventSubscriptionsCreateOrUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// PartnerTopicEventSubscriptionsDeletePoller provides polling facilities until the operation reaches a terminal state. -type PartnerTopicEventSubscriptionsDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *PartnerTopicEventSubscriptionsDeletePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *PartnerTopicEventSubscriptionsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final PartnerTopicEventSubscriptionsDeleteResponse will be returned. -func (p *PartnerTopicEventSubscriptionsDeletePoller) FinalResponse(ctx context.Context) (PartnerTopicEventSubscriptionsDeleteResponse, error) { - respType := PartnerTopicEventSubscriptionsDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return PartnerTopicEventSubscriptionsDeleteResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *PartnerTopicEventSubscriptionsDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// PartnerTopicEventSubscriptionsUpdatePoller provides polling facilities until the operation reaches a terminal state. -type PartnerTopicEventSubscriptionsUpdatePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *PartnerTopicEventSubscriptionsUpdatePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *PartnerTopicEventSubscriptionsUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final PartnerTopicEventSubscriptionsUpdateResponse will be returned. -func (p *PartnerTopicEventSubscriptionsUpdatePoller) FinalResponse(ctx context.Context) (PartnerTopicEventSubscriptionsUpdateResponse, error) { - respType := PartnerTopicEventSubscriptionsUpdateResponse{} - resp, err := p.pt.FinalResponse(ctx, &respType.EventSubscription) - if err != nil { - return PartnerTopicEventSubscriptionsUpdateResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *PartnerTopicEventSubscriptionsUpdatePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - -// PartnerTopicsDeletePoller provides polling facilities until the operation reaches a terminal state. -type PartnerTopicsDeletePoller struct { - pt *azcore.Poller -} - -// Done returns true if the LRO has reached a terminal state. -func (p *PartnerTopicsDeletePoller) Done() bool { - return p.pt.Done() -} - -// Poll fetches the latest state of the LRO. It returns an HTTP response or error. -// If the LRO has completed successfully, the poller's state is updated and the HTTP -// response is returned. -// If the LRO has completed with failure or was cancelled, the poller's state is -// updated and the error is returned. -// If the LRO has not reached a terminal state, the poller's state is updated and -// the latest HTTP response is returned. -// If Poll fails, the poller's state is unmodified and the error is returned. -// Calling Poll on an LRO that has reached a terminal state will return the final -// HTTP response or error. -func (p *PartnerTopicsDeletePoller) Poll(ctx context.Context) (*http.Response, error) { - return p.pt.Poll(ctx) -} - -// FinalResponse performs a final GET to the service and returns the final response -// for the polling operation. If there is an error performing the final GET then an error is returned. -// If the final GET succeeded then the final PartnerTopicsDeleteResponse will be returned. -func (p *PartnerTopicsDeletePoller) FinalResponse(ctx context.Context) (PartnerTopicsDeleteResponse, error) { - respType := PartnerTopicsDeleteResponse{} - resp, err := p.pt.FinalResponse(ctx, nil) - if err != nil { - return PartnerTopicsDeleteResponse{}, err - } - respType.RawResponse = resp - return respType, nil -} - -// ResumeToken returns a value representing the poller that can be used to resume -// the LRO at a later time. ResumeTokens are unique per service operation. -func (p *PartnerTopicsDeletePoller) ResumeToken() (string, error) { - return p.pt.ResumeToken() -} - // PrivateEndpointConnectionsDeletePoller provides polling facilities until the operation reaches a terminal state. type PrivateEndpointConnectionsDeletePoller struct { pt *azcore.Poller diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_polymorphic_helpers.go index 262391fbe1af..e7ed4af8e4cb 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_polymorphic_helpers.go @@ -22,26 +22,18 @@ func unmarshalAdvancedFilterClassification(rawMsg json.RawMessage) (AdvancedFilt switch m["operatorType"] { case string(AdvancedFilterOperatorTypeBoolEquals): b = &BoolEqualsAdvancedFilter{} - case string(AdvancedFilterOperatorTypeIsNotNull): - b = &IsNotNullAdvancedFilter{} - case string(AdvancedFilterOperatorTypeIsNullOrUndefined): - b = &IsNullOrUndefinedAdvancedFilter{} case string(AdvancedFilterOperatorTypeNumberGreaterThan): b = &NumberGreaterThanAdvancedFilter{} case string(AdvancedFilterOperatorTypeNumberGreaterThanOrEquals): b = &NumberGreaterThanOrEqualsAdvancedFilter{} case string(AdvancedFilterOperatorTypeNumberIn): b = &NumberInAdvancedFilter{} - case string(AdvancedFilterOperatorTypeNumberInRange): - b = &NumberInRangeAdvancedFilter{} case string(AdvancedFilterOperatorTypeNumberLessThan): b = &NumberLessThanAdvancedFilter{} case string(AdvancedFilterOperatorTypeNumberLessThanOrEquals): b = &NumberLessThanOrEqualsAdvancedFilter{} case string(AdvancedFilterOperatorTypeNumberNotIn): b = &NumberNotInAdvancedFilter{} - case string(AdvancedFilterOperatorTypeNumberNotInRange): - b = &NumberNotInRangeAdvancedFilter{} case string(AdvancedFilterOperatorTypeStringBeginsWith): b = &StringBeginsWithAdvancedFilter{} case string(AdvancedFilterOperatorTypeStringContains): @@ -50,12 +42,6 @@ func unmarshalAdvancedFilterClassification(rawMsg json.RawMessage) (AdvancedFilt b = &StringEndsWithAdvancedFilter{} case string(AdvancedFilterOperatorTypeStringIn): b = &StringInAdvancedFilter{} - case string(AdvancedFilterOperatorTypeStringNotBeginsWith): - b = &StringNotBeginsWithAdvancedFilter{} - case string(AdvancedFilterOperatorTypeStringNotContains): - b = &StringNotContainsAdvancedFilter{} - case string(AdvancedFilterOperatorTypeStringNotEndsWith): - b = &StringNotEndsWithAdvancedFilter{} case string(AdvancedFilterOperatorTypeStringNotIn): b = &StringNotInAdvancedFilter{} default: @@ -83,6 +69,25 @@ func unmarshalAdvancedFilterClassificationArray(rawMsg json.RawMessage) ([]Advan return fArray, nil } +func unmarshalAdvancedFilterClassificationMap(rawMsg json.RawMessage) (map[string]AdvancedFilterClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]AdvancedFilterClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalAdvancedFilterClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalDeadLetterDestinationClassification(rawMsg json.RawMessage) (DeadLetterDestinationClassification, error) { if rawMsg == nil { return nil, nil @@ -120,6 +125,25 @@ func unmarshalDeadLetterDestinationClassificationArray(rawMsg json.RawMessage) ( return fArray, nil } +func unmarshalDeadLetterDestinationClassificationMap(rawMsg json.RawMessage) (map[string]DeadLetterDestinationClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]DeadLetterDestinationClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalDeadLetterDestinationClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalDeliveryAttributeMappingClassification(rawMsg json.RawMessage) (DeliveryAttributeMappingClassification, error) { if rawMsg == nil { return nil, nil @@ -159,6 +183,25 @@ func unmarshalDeliveryAttributeMappingClassificationArray(rawMsg json.RawMessage return fArray, nil } +func unmarshalDeliveryAttributeMappingClassificationMap(rawMsg json.RawMessage) (map[string]DeliveryAttributeMappingClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]DeliveryAttributeMappingClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalDeliveryAttributeMappingClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalEventSubscriptionDestinationClassification(rawMsg json.RawMessage) (EventSubscriptionDestinationClassification, error) { if rawMsg == nil { return nil, nil @@ -208,6 +251,25 @@ func unmarshalEventSubscriptionDestinationClassificationArray(rawMsg json.RawMes return fArray, nil } +func unmarshalEventSubscriptionDestinationClassificationMap(rawMsg json.RawMessage) (map[string]EventSubscriptionDestinationClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]EventSubscriptionDestinationClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalEventSubscriptionDestinationClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalInputSchemaMappingClassification(rawMsg json.RawMessage) (InputSchemaMappingClassification, error) { if rawMsg == nil { return nil, nil @@ -244,3 +306,22 @@ func unmarshalInputSchemaMappingClassificationArray(rawMsg json.RawMessage) ([]I } return fArray, nil } + +func unmarshalInputSchemaMappingClassificationMap(rawMsg json.RawMessage) (map[string]InputSchemaMappingClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]InputSchemaMappingClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalInputSchemaMappingClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_privateendpointconnections_client.go index 64c750afe55e..f1fbea1a6534 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_privateendpointconnections_client.go @@ -11,15 +11,15 @@ package armeventgrid import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. @@ -31,13 +31,20 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { - return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } -// BeginDelete - Delete a specific private endpoint connection under a topic, domain, or partner namespace. +// BeginDelete - Delete a specific private endpoint connection under a topic or domain. // If the operation fails it returns a generic error. -func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, parentType Enum27, parentName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsBeginDeleteOptions) (PrivateEndpointConnectionsDeletePollerResponse, error) { +func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, resourceGroupName string, parentType Enum20, parentName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsBeginDeleteOptions) (PrivateEndpointConnectionsDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, parentType, parentName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsDeletePollerResponse{}, err @@ -55,9 +62,9 @@ func (client *PrivateEndpointConnectionsClient) BeginDelete(ctx context.Context, return result, nil } -// Delete - Delete a specific private endpoint connection under a topic, domain, or partner namespace. +// Delete - Delete a specific private endpoint connection under a topic or domain. // If the operation fails it returns a generic error. -func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, parentType Enum27, parentName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsBeginDeleteOptions) (*http.Response, error) { +func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Context, resourceGroupName string, parentType Enum20, parentName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, parentType, parentName, privateEndpointConnectionName, options) if err != nil { return nil, err @@ -73,7 +80,7 @@ func (client *PrivateEndpointConnectionsClient) deleteOperation(ctx context.Cont } // deleteCreateRequest creates the Delete request. -func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, parentType Enum27, parentName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsBeginDeleteOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, parentType Enum20, parentName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsBeginDeleteOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -100,7 +107,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -117,9 +124,9 @@ func (client *PrivateEndpointConnectionsClient) deleteHandleError(resp *http.Res return runtime.NewResponseError(errors.New(string(body)), resp) } -// Get - Get a specific private endpoint connection under a topic, domain, or partner namespace. +// Get - Get a specific private endpoint connection under a topic or domain. // If the operation fails it returns a generic error. -func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, parentType Enum25, parentName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsGetOptions) (PrivateEndpointConnectionsGetResponse, error) { +func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourceGroupName string, parentType Enum18, parentName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsGetOptions) (PrivateEndpointConnectionsGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, parentType, parentName, privateEndpointConnectionName, options) if err != nil { return PrivateEndpointConnectionsGetResponse{}, err @@ -135,7 +142,7 @@ func (client *PrivateEndpointConnectionsClient) Get(ctx context.Context, resourc } // getCreateRequest creates the Get request. -func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, parentType Enum25, parentName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsGetOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Context, resourceGroupName string, parentType Enum18, parentName string, privateEndpointConnectionName string, options *PrivateEndpointConnectionsGetOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -162,7 +169,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -172,7 +179,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsGetResponse{}, err + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -189,9 +196,9 @@ func (client *PrivateEndpointConnectionsClient) getHandleError(resp *http.Respon return runtime.NewResponseError(errors.New(string(body)), resp) } -// ListByResource - Get all private endpoint connections under a topic, domain, or partner namespace. +// ListByResource - Get all private endpoint connections under a topic or domain. // If the operation fails it returns a generic error. -func (client *PrivateEndpointConnectionsClient) ListByResource(resourceGroupName string, parentType Enum28, parentName string, options *PrivateEndpointConnectionsListByResourceOptions) *PrivateEndpointConnectionsListByResourcePager { +func (client *PrivateEndpointConnectionsClient) ListByResource(resourceGroupName string, parentType Enum21, parentName string, options *PrivateEndpointConnectionsListByResourceOptions) *PrivateEndpointConnectionsListByResourcePager { return &PrivateEndpointConnectionsListByResourcePager{ client: client, requester: func(ctx context.Context) (*policy.Request, error) { @@ -204,7 +211,7 @@ func (client *PrivateEndpointConnectionsClient) ListByResource(resourceGroupName } // listByResourceCreateRequest creates the ListByResource request. -func (client *PrivateEndpointConnectionsClient) listByResourceCreateRequest(ctx context.Context, resourceGroupName string, parentType Enum28, parentName string, options *PrivateEndpointConnectionsListByResourceOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) listByResourceCreateRequest(ctx context.Context, resourceGroupName string, parentType Enum21, parentName string, options *PrivateEndpointConnectionsListByResourceOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -227,7 +234,7 @@ func (client *PrivateEndpointConnectionsClient) listByResourceCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -243,7 +250,7 @@ func (client *PrivateEndpointConnectionsClient) listByResourceCreateRequest(ctx func (client *PrivateEndpointConnectionsClient) listByResourceHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListByResourceResponse, error) { result := PrivateEndpointConnectionsListByResourceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionsListByResourceResponse{}, err + return PrivateEndpointConnectionsListByResourceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -260,9 +267,9 @@ func (client *PrivateEndpointConnectionsClient) listByResourceHandleError(resp * return runtime.NewResponseError(errors.New(string(body)), resp) } -// BeginUpdate - Update a specific private endpoint connection under a topic, domain or partner namespace. +// BeginUpdate - Update a specific private endpoint connection under a topic or domain. // If the operation fails it returns a generic error. -func (client *PrivateEndpointConnectionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, parentType Enum26, parentName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsBeginUpdateOptions) (PrivateEndpointConnectionsUpdatePollerResponse, error) { +func (client *PrivateEndpointConnectionsClient) BeginUpdate(ctx context.Context, resourceGroupName string, parentType Enum19, parentName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsBeginUpdateOptions) (PrivateEndpointConnectionsUpdatePollerResponse, error) { resp, err := client.update(ctx, resourceGroupName, parentType, parentName, privateEndpointConnectionName, privateEndpointConnection, options) if err != nil { return PrivateEndpointConnectionsUpdatePollerResponse{}, err @@ -280,9 +287,9 @@ func (client *PrivateEndpointConnectionsClient) BeginUpdate(ctx context.Context, return result, nil } -// Update - Update a specific private endpoint connection under a topic, domain or partner namespace. +// Update - Update a specific private endpoint connection under a topic or domain. // If the operation fails it returns a generic error. -func (client *PrivateEndpointConnectionsClient) update(ctx context.Context, resourceGroupName string, parentType Enum26, parentName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsBeginUpdateOptions) (*http.Response, error) { +func (client *PrivateEndpointConnectionsClient) update(ctx context.Context, resourceGroupName string, parentType Enum19, parentName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsBeginUpdateOptions) (*http.Response, error) { req, err := client.updateCreateRequest(ctx, resourceGroupName, parentType, parentName, privateEndpointConnectionName, privateEndpointConnection, options) if err != nil { return nil, err @@ -298,7 +305,7 @@ func (client *PrivateEndpointConnectionsClient) update(ctx context.Context, reso } // updateCreateRequest creates the Update request. -func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, parentType Enum26, parentName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsBeginUpdateOptions) (*policy.Request, error) { +func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, parentType Enum19, parentName string, privateEndpointConnectionName string, privateEndpointConnection PrivateEndpointConnection, options *PrivateEndpointConnectionsBeginUpdateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventGrid/{parentType}/{parentName}/privateEndpointConnections/{privateEndpointConnectionName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -325,7 +332,7 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, privateEndpointConnection) diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_privatelinkresources_client.go index 4c158934a80c..09bc7c2cd14b 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_privatelinkresources_client.go @@ -11,14 +11,15 @@ package armeventgrid import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. @@ -30,8 +31,15 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { - return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get properties of a private link resource. @@ -79,7 +87,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -89,7 +97,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesGetResponse, error) { result := PrivateLinkResourcesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { - return PrivateLinkResourcesGetResponse{}, err + return PrivateLinkResourcesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -106,7 +114,7 @@ func (client *PrivateLinkResourcesClient) getHandleError(resp *http.Response) er return runtime.NewResponseError(errors.New(string(body)), resp) } -// ListByResource - List all the private link resources under a topic, domain, or partner namespace. +// ListByResource - List all the private link resources under a topic or domain. // If the operation fails it returns a generic error. func (client *PrivateLinkResourcesClient) ListByResource(resourceGroupName string, parentType string, parentName string, options *PrivateLinkResourcesListByResourceOptions) *PrivateLinkResourcesListByResourcePager { return &PrivateLinkResourcesListByResourcePager{ @@ -144,7 +152,7 @@ func (client *PrivateLinkResourcesClient) listByResourceCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -160,7 +168,7 @@ func (client *PrivateLinkResourcesClient) listByResourceCreateRequest(ctx contex func (client *PrivateLinkResourcesClient) listByResourceHandleResponse(resp *http.Response) (PrivateLinkResourcesListByResourceResponse, error) { result := PrivateLinkResourcesListByResourceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourcesListResult); err != nil { - return PrivateLinkResourcesListByResourceResponse{}, err + return PrivateLinkResourcesListByResourceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_response_types.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_response_types.go index f55b7a6e49a7..bf18f44beebc 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_response_types.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armeventgrid import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // DomainTopicsCreateOrUpdatePollerResponse contains the response from method DomainTopics.CreateOrUpdate. @@ -26,6 +25,8 @@ type DomainTopicsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DomainTopicsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DomainTopicsCreateOrUpdateResponse, error) { respType := DomainTopicsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DomainTopic) @@ -76,6 +77,8 @@ type DomainTopicsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DomainTopicsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DomainTopicsDeleteResponse, error) { respType := DomainTopicsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -144,6 +147,8 @@ type DomainsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DomainsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DomainsCreateOrUpdateResponse, error) { respType := DomainsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Domain) @@ -194,6 +199,8 @@ type DomainsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DomainsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DomainsDeleteResponse, error) { respType := DomainsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -298,6 +305,8 @@ type DomainsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DomainsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DomainsUpdateResponse, error) { respType := DomainsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Domain) @@ -338,86 +347,6 @@ type DomainsUpdateResult struct { Domain } -// EventChannelsCreateOrUpdateResponse contains the response from method EventChannels.CreateOrUpdate. -type EventChannelsCreateOrUpdateResponse struct { - EventChannelsCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// EventChannelsCreateOrUpdateResult contains the result from method EventChannels.CreateOrUpdate. -type EventChannelsCreateOrUpdateResult struct { - EventChannel -} - -// EventChannelsDeletePollerResponse contains the response from method EventChannels.Delete. -type EventChannelsDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *EventChannelsDeletePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l EventChannelsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (EventChannelsDeleteResponse, error) { - respType := EventChannelsDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a EventChannelsDeletePollerResponse from the provided client and resume token. -func (l *EventChannelsDeletePollerResponse) Resume(ctx context.Context, client *EventChannelsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("EventChannelsClient.Delete", token, client.pl, client.deleteHandleError) - if err != nil { - return err - } - poller := &EventChannelsDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - -// EventChannelsDeleteResponse contains the response from method EventChannels.Delete. -type EventChannelsDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// EventChannelsGetResponse contains the response from method EventChannels.Get. -type EventChannelsGetResponse struct { - EventChannelsGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// EventChannelsGetResult contains the result from method EventChannels.Get. -type EventChannelsGetResult struct { - EventChannel -} - -// EventChannelsListByPartnerNamespaceResponse contains the response from method EventChannels.ListByPartnerNamespace. -type EventChannelsListByPartnerNamespaceResponse struct { - EventChannelsListByPartnerNamespaceResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// EventChannelsListByPartnerNamespaceResult contains the result from method EventChannels.ListByPartnerNamespace. -type EventChannelsListByPartnerNamespaceResult struct { - EventChannelsListResult -} - // EventSubscriptionsCreateOrUpdatePollerResponse contains the response from method EventSubscriptions.CreateOrUpdate. type EventSubscriptionsCreateOrUpdatePollerResponse struct { // Poller contains an initialized poller. @@ -428,6 +357,8 @@ type EventSubscriptionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l EventSubscriptionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (EventSubscriptionsCreateOrUpdateResponse, error) { respType := EventSubscriptionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.EventSubscription) @@ -478,6 +409,8 @@ type EventSubscriptionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l EventSubscriptionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (EventSubscriptionsDeleteResponse, error) { respType := EventSubscriptionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -678,6 +611,8 @@ type EventSubscriptionsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l EventSubscriptionsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (EventSubscriptionsUpdateResponse, error) { respType := EventSubscriptionsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.EventSubscription) @@ -742,584 +677,6 @@ type OperationsListResultEnvelope struct { OperationsListResult } -// PartnerNamespacesCreateOrUpdatePollerResponse contains the response from method PartnerNamespaces.CreateOrUpdate. -type PartnerNamespacesCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *PartnerNamespacesCreateOrUpdatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l PartnerNamespacesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PartnerNamespacesCreateOrUpdateResponse, error) { - respType := PartnerNamespacesCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PartnerNamespace) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a PartnerNamespacesCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *PartnerNamespacesCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PartnerNamespacesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("PartnerNamespacesClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) - if err != nil { - return err - } - poller := &PartnerNamespacesCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - -// PartnerNamespacesCreateOrUpdateResponse contains the response from method PartnerNamespaces.CreateOrUpdate. -type PartnerNamespacesCreateOrUpdateResponse struct { - PartnerNamespacesCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerNamespacesCreateOrUpdateResult contains the result from method PartnerNamespaces.CreateOrUpdate. -type PartnerNamespacesCreateOrUpdateResult struct { - PartnerNamespace -} - -// PartnerNamespacesDeletePollerResponse contains the response from method PartnerNamespaces.Delete. -type PartnerNamespacesDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *PartnerNamespacesDeletePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l PartnerNamespacesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PartnerNamespacesDeleteResponse, error) { - respType := PartnerNamespacesDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a PartnerNamespacesDeletePollerResponse from the provided client and resume token. -func (l *PartnerNamespacesDeletePollerResponse) Resume(ctx context.Context, client *PartnerNamespacesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("PartnerNamespacesClient.Delete", token, client.pl, client.deleteHandleError) - if err != nil { - return err - } - poller := &PartnerNamespacesDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - -// PartnerNamespacesDeleteResponse contains the response from method PartnerNamespaces.Delete. -type PartnerNamespacesDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerNamespacesGetResponse contains the response from method PartnerNamespaces.Get. -type PartnerNamespacesGetResponse struct { - PartnerNamespacesGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerNamespacesGetResult contains the result from method PartnerNamespaces.Get. -type PartnerNamespacesGetResult struct { - PartnerNamespace -} - -// PartnerNamespacesListByResourceGroupResponse contains the response from method PartnerNamespaces.ListByResourceGroup. -type PartnerNamespacesListByResourceGroupResponse struct { - PartnerNamespacesListByResourceGroupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerNamespacesListByResourceGroupResult contains the result from method PartnerNamespaces.ListByResourceGroup. -type PartnerNamespacesListByResourceGroupResult struct { - PartnerNamespacesListResult -} - -// PartnerNamespacesListBySubscriptionResponse contains the response from method PartnerNamespaces.ListBySubscription. -type PartnerNamespacesListBySubscriptionResponse struct { - PartnerNamespacesListBySubscriptionResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerNamespacesListBySubscriptionResult contains the result from method PartnerNamespaces.ListBySubscription. -type PartnerNamespacesListBySubscriptionResult struct { - PartnerNamespacesListResult -} - -// PartnerNamespacesListSharedAccessKeysResponse contains the response from method PartnerNamespaces.ListSharedAccessKeys. -type PartnerNamespacesListSharedAccessKeysResponse struct { - PartnerNamespacesListSharedAccessKeysResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerNamespacesListSharedAccessKeysResult contains the result from method PartnerNamespaces.ListSharedAccessKeys. -type PartnerNamespacesListSharedAccessKeysResult struct { - PartnerNamespaceSharedAccessKeys -} - -// PartnerNamespacesRegenerateKeyResponse contains the response from method PartnerNamespaces.RegenerateKey. -type PartnerNamespacesRegenerateKeyResponse struct { - PartnerNamespacesRegenerateKeyResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerNamespacesRegenerateKeyResult contains the result from method PartnerNamespaces.RegenerateKey. -type PartnerNamespacesRegenerateKeyResult struct { - PartnerNamespaceSharedAccessKeys -} - -// PartnerNamespacesUpdatePollerResponse contains the response from method PartnerNamespaces.Update. -type PartnerNamespacesUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *PartnerNamespacesUpdatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l PartnerNamespacesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PartnerNamespacesUpdateResponse, error) { - respType := PartnerNamespacesUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PartnerNamespace) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a PartnerNamespacesUpdatePollerResponse from the provided client and resume token. -func (l *PartnerNamespacesUpdatePollerResponse) Resume(ctx context.Context, client *PartnerNamespacesClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("PartnerNamespacesClient.Update", token, client.pl, client.updateHandleError) - if err != nil { - return err - } - poller := &PartnerNamespacesUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - -// PartnerNamespacesUpdateResponse contains the response from method PartnerNamespaces.Update. -type PartnerNamespacesUpdateResponse struct { - PartnerNamespacesUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerNamespacesUpdateResult contains the result from method PartnerNamespaces.Update. -type PartnerNamespacesUpdateResult struct { - PartnerNamespace -} - -// PartnerRegistrationsCreateOrUpdateResponse contains the response from method PartnerRegistrations.CreateOrUpdate. -type PartnerRegistrationsCreateOrUpdateResponse struct { - PartnerRegistrationsCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerRegistrationsCreateOrUpdateResult contains the result from method PartnerRegistrations.CreateOrUpdate. -type PartnerRegistrationsCreateOrUpdateResult struct { - PartnerRegistration -} - -// PartnerRegistrationsDeleteResponse contains the response from method PartnerRegistrations.Delete. -type PartnerRegistrationsDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerRegistrationsGetResponse contains the response from method PartnerRegistrations.Get. -type PartnerRegistrationsGetResponse struct { - PartnerRegistrationsGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerRegistrationsGetResult contains the result from method PartnerRegistrations.Get. -type PartnerRegistrationsGetResult struct { - PartnerRegistration -} - -// PartnerRegistrationsListByResourceGroupResponse contains the response from method PartnerRegistrations.ListByResourceGroup. -type PartnerRegistrationsListByResourceGroupResponse struct { - PartnerRegistrationsListByResourceGroupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerRegistrationsListByResourceGroupResult contains the result from method PartnerRegistrations.ListByResourceGroup. -type PartnerRegistrationsListByResourceGroupResult struct { - PartnerRegistrationsListResult -} - -// PartnerRegistrationsListBySubscriptionResponse contains the response from method PartnerRegistrations.ListBySubscription. -type PartnerRegistrationsListBySubscriptionResponse struct { - PartnerRegistrationsListBySubscriptionResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerRegistrationsListBySubscriptionResult contains the result from method PartnerRegistrations.ListBySubscription. -type PartnerRegistrationsListBySubscriptionResult struct { - PartnerRegistrationsListResult -} - -// PartnerRegistrationsUpdateResponse contains the response from method PartnerRegistrations.Update. -type PartnerRegistrationsUpdateResponse struct { - PartnerRegistrationsUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerRegistrationsUpdateResult contains the result from method PartnerRegistrations.Update. -type PartnerRegistrationsUpdateResult struct { - PartnerRegistration -} - -// PartnerTopicEventSubscriptionsCreateOrUpdatePollerResponse contains the response from method PartnerTopicEventSubscriptions.CreateOrUpdate. -type PartnerTopicEventSubscriptionsCreateOrUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *PartnerTopicEventSubscriptionsCreateOrUpdatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l PartnerTopicEventSubscriptionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PartnerTopicEventSubscriptionsCreateOrUpdateResponse, error) { - respType := PartnerTopicEventSubscriptionsCreateOrUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.EventSubscription) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a PartnerTopicEventSubscriptionsCreateOrUpdatePollerResponse from the provided client and resume token. -func (l *PartnerTopicEventSubscriptionsCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *PartnerTopicEventSubscriptionsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("PartnerTopicEventSubscriptionsClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) - if err != nil { - return err - } - poller := &PartnerTopicEventSubscriptionsCreateOrUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - -// PartnerTopicEventSubscriptionsCreateOrUpdateResponse contains the response from method PartnerTopicEventSubscriptions.CreateOrUpdate. -type PartnerTopicEventSubscriptionsCreateOrUpdateResponse struct { - PartnerTopicEventSubscriptionsCreateOrUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerTopicEventSubscriptionsCreateOrUpdateResult contains the result from method PartnerTopicEventSubscriptions.CreateOrUpdate. -type PartnerTopicEventSubscriptionsCreateOrUpdateResult struct { - EventSubscription -} - -// PartnerTopicEventSubscriptionsDeletePollerResponse contains the response from method PartnerTopicEventSubscriptions.Delete. -type PartnerTopicEventSubscriptionsDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *PartnerTopicEventSubscriptionsDeletePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l PartnerTopicEventSubscriptionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PartnerTopicEventSubscriptionsDeleteResponse, error) { - respType := PartnerTopicEventSubscriptionsDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a PartnerTopicEventSubscriptionsDeletePollerResponse from the provided client and resume token. -func (l *PartnerTopicEventSubscriptionsDeletePollerResponse) Resume(ctx context.Context, client *PartnerTopicEventSubscriptionsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("PartnerTopicEventSubscriptionsClient.Delete", token, client.pl, client.deleteHandleError) - if err != nil { - return err - } - poller := &PartnerTopicEventSubscriptionsDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - -// PartnerTopicEventSubscriptionsDeleteResponse contains the response from method PartnerTopicEventSubscriptions.Delete. -type PartnerTopicEventSubscriptionsDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerTopicEventSubscriptionsGetDeliveryAttributesResponse contains the response from method PartnerTopicEventSubscriptions.GetDeliveryAttributes. -type PartnerTopicEventSubscriptionsGetDeliveryAttributesResponse struct { - PartnerTopicEventSubscriptionsGetDeliveryAttributesResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerTopicEventSubscriptionsGetDeliveryAttributesResult contains the result from method PartnerTopicEventSubscriptions.GetDeliveryAttributes. -type PartnerTopicEventSubscriptionsGetDeliveryAttributesResult struct { - DeliveryAttributeListResult -} - -// PartnerTopicEventSubscriptionsGetFullURLResponse contains the response from method PartnerTopicEventSubscriptions.GetFullURL. -type PartnerTopicEventSubscriptionsGetFullURLResponse struct { - PartnerTopicEventSubscriptionsGetFullURLResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerTopicEventSubscriptionsGetFullURLResult contains the result from method PartnerTopicEventSubscriptions.GetFullURL. -type PartnerTopicEventSubscriptionsGetFullURLResult struct { - EventSubscriptionFullURL -} - -// PartnerTopicEventSubscriptionsGetResponse contains the response from method PartnerTopicEventSubscriptions.Get. -type PartnerTopicEventSubscriptionsGetResponse struct { - PartnerTopicEventSubscriptionsGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerTopicEventSubscriptionsGetResult contains the result from method PartnerTopicEventSubscriptions.Get. -type PartnerTopicEventSubscriptionsGetResult struct { - EventSubscription -} - -// PartnerTopicEventSubscriptionsListByPartnerTopicResponse contains the response from method PartnerTopicEventSubscriptions.ListByPartnerTopic. -type PartnerTopicEventSubscriptionsListByPartnerTopicResponse struct { - PartnerTopicEventSubscriptionsListByPartnerTopicResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerTopicEventSubscriptionsListByPartnerTopicResult contains the result from method PartnerTopicEventSubscriptions.ListByPartnerTopic. -type PartnerTopicEventSubscriptionsListByPartnerTopicResult struct { - EventSubscriptionsListResult -} - -// PartnerTopicEventSubscriptionsUpdatePollerResponse contains the response from method PartnerTopicEventSubscriptions.Update. -type PartnerTopicEventSubscriptionsUpdatePollerResponse struct { - // Poller contains an initialized poller. - Poller *PartnerTopicEventSubscriptionsUpdatePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l PartnerTopicEventSubscriptionsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PartnerTopicEventSubscriptionsUpdateResponse, error) { - respType := PartnerTopicEventSubscriptionsUpdateResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.EventSubscription) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a PartnerTopicEventSubscriptionsUpdatePollerResponse from the provided client and resume token. -func (l *PartnerTopicEventSubscriptionsUpdatePollerResponse) Resume(ctx context.Context, client *PartnerTopicEventSubscriptionsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("PartnerTopicEventSubscriptionsClient.Update", token, client.pl, client.updateHandleError) - if err != nil { - return err - } - poller := &PartnerTopicEventSubscriptionsUpdatePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - -// PartnerTopicEventSubscriptionsUpdateResponse contains the response from method PartnerTopicEventSubscriptions.Update. -type PartnerTopicEventSubscriptionsUpdateResponse struct { - PartnerTopicEventSubscriptionsUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerTopicEventSubscriptionsUpdateResult contains the result from method PartnerTopicEventSubscriptions.Update. -type PartnerTopicEventSubscriptionsUpdateResult struct { - EventSubscription -} - -// PartnerTopicsActivateResponse contains the response from method PartnerTopics.Activate. -type PartnerTopicsActivateResponse struct { - PartnerTopicsActivateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerTopicsActivateResult contains the result from method PartnerTopics.Activate. -type PartnerTopicsActivateResult struct { - PartnerTopic -} - -// PartnerTopicsDeactivateResponse contains the response from method PartnerTopics.Deactivate. -type PartnerTopicsDeactivateResponse struct { - PartnerTopicsDeactivateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerTopicsDeactivateResult contains the result from method PartnerTopics.Deactivate. -type PartnerTopicsDeactivateResult struct { - PartnerTopic -} - -// PartnerTopicsDeletePollerResponse contains the response from method PartnerTopics.Delete. -type PartnerTopicsDeletePollerResponse struct { - // Poller contains an initialized poller. - Poller *PartnerTopicsDeletePoller - - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. -func (l PartnerTopicsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PartnerTopicsDeleteResponse, error) { - respType := PartnerTopicsDeleteResponse{} - resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) - if err != nil { - return respType, err - } - respType.RawResponse = resp - return respType, nil -} - -// Resume rehydrates a PartnerTopicsDeletePollerResponse from the provided client and resume token. -func (l *PartnerTopicsDeletePollerResponse) Resume(ctx context.Context, client *PartnerTopicsClient, token string) error { - pt, err := armruntime.NewPollerFromResumeToken("PartnerTopicsClient.Delete", token, client.pl, client.deleteHandleError) - if err != nil { - return err - } - poller := &PartnerTopicsDeletePoller{ - pt: pt, - } - resp, err := poller.Poll(ctx) - if err != nil { - return err - } - l.Poller = poller - l.RawResponse = resp - return nil -} - -// PartnerTopicsDeleteResponse contains the response from method PartnerTopics.Delete. -type PartnerTopicsDeleteResponse struct { - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerTopicsGetResponse contains the response from method PartnerTopics.Get. -type PartnerTopicsGetResponse struct { - PartnerTopicsGetResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerTopicsGetResult contains the result from method PartnerTopics.Get. -type PartnerTopicsGetResult struct { - PartnerTopic -} - -// PartnerTopicsListByResourceGroupResponse contains the response from method PartnerTopics.ListByResourceGroup. -type PartnerTopicsListByResourceGroupResponse struct { - PartnerTopicsListByResourceGroupResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerTopicsListByResourceGroupResult contains the result from method PartnerTopics.ListByResourceGroup. -type PartnerTopicsListByResourceGroupResult struct { - PartnerTopicsListResult -} - -// PartnerTopicsListBySubscriptionResponse contains the response from method PartnerTopics.ListBySubscription. -type PartnerTopicsListBySubscriptionResponse struct { - PartnerTopicsListBySubscriptionResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerTopicsListBySubscriptionResult contains the result from method PartnerTopics.ListBySubscription. -type PartnerTopicsListBySubscriptionResult struct { - PartnerTopicsListResult -} - -// PartnerTopicsUpdateResponse contains the response from method PartnerTopics.Update. -type PartnerTopicsUpdateResponse struct { - PartnerTopicsUpdateResult - // RawResponse contains the underlying HTTP response. - RawResponse *http.Response -} - -// PartnerTopicsUpdateResult contains the result from method PartnerTopics.Update. -type PartnerTopicsUpdateResult struct { - PartnerTopic -} - // PrivateEndpointConnectionsDeletePollerResponse contains the response from method PrivateEndpointConnections.Delete. type PrivateEndpointConnectionsDeletePollerResponse struct { // Poller contains an initialized poller. @@ -1330,6 +687,8 @@ type PrivateEndpointConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsDeleteResponse, error) { respType := PrivateEndpointConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1398,6 +757,8 @@ type PrivateEndpointConnectionsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsUpdateResponse, error) { respType := PrivateEndpointConnectionsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) @@ -1472,6 +833,8 @@ type SystemTopicEventSubscriptionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SystemTopicEventSubscriptionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SystemTopicEventSubscriptionsCreateOrUpdateResponse, error) { respType := SystemTopicEventSubscriptionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.EventSubscription) @@ -1522,6 +885,8 @@ type SystemTopicEventSubscriptionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SystemTopicEventSubscriptionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SystemTopicEventSubscriptionsDeleteResponse, error) { respType := SystemTopicEventSubscriptionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1614,6 +979,8 @@ type SystemTopicEventSubscriptionsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SystemTopicEventSubscriptionsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SystemTopicEventSubscriptionsUpdateResponse, error) { respType := SystemTopicEventSubscriptionsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.EventSubscription) @@ -1664,6 +1031,8 @@ type SystemTopicsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SystemTopicsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SystemTopicsCreateOrUpdateResponse, error) { respType := SystemTopicsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SystemTopic) @@ -1714,6 +1083,8 @@ type SystemTopicsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SystemTopicsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SystemTopicsDeleteResponse, error) { respType := SystemTopicsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1794,6 +1165,8 @@ type SystemTopicsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SystemTopicsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SystemTopicsUpdateResponse, error) { respType := SystemTopicsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SystemTopic) @@ -1880,6 +1253,8 @@ type TopicsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TopicsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TopicsCreateOrUpdateResponse, error) { respType := TopicsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Topic) @@ -1930,6 +1305,8 @@ type TopicsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TopicsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TopicsDeleteResponse, error) { respType := TopicsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2034,6 +1411,8 @@ type TopicsRegenerateKeyPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TopicsRegenerateKeyPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TopicsRegenerateKeyResponse, error) { respType := TopicsRegenerateKeyResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.TopicSharedAccessKeys) @@ -2084,6 +1463,8 @@ type TopicsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TopicsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TopicsUpdateResponse, error) { respType := TopicsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Topic) diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_systemtopiceventsubscriptions_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_systemtopiceventsubscriptions_client.go index a16695ac11af..6b052351aad7 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_systemtopiceventsubscriptions_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_systemtopiceventsubscriptions_client.go @@ -11,15 +11,15 @@ package armeventgrid import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // SystemTopicEventSubscriptionsClient contains the methods for the SystemTopicEventSubscriptions group. @@ -31,8 +31,15 @@ type SystemTopicEventSubscriptionsClient struct { } // NewSystemTopicEventSubscriptionsClient creates a new instance of SystemTopicEventSubscriptionsClient with the specified values. -func NewSystemTopicEventSubscriptionsClient(con *arm.Connection, subscriptionID string) *SystemTopicEventSubscriptionsClient { - return &SystemTopicEventSubscriptionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSystemTopicEventSubscriptionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SystemTopicEventSubscriptionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SystemTopicEventSubscriptionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Asynchronously creates or updates an event subscription with the specified parameters. Existing event subscriptions will be updated @@ -98,7 +105,7 @@ func (client *SystemTopicEventSubscriptionsClient) createOrUpdateCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, eventSubscriptionInfo) @@ -177,7 +184,7 @@ func (client *SystemTopicEventSubscriptionsClient) deleteCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -235,7 +242,7 @@ func (client *SystemTopicEventSubscriptionsClient) getCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -245,7 +252,7 @@ func (client *SystemTopicEventSubscriptionsClient) getCreateRequest(ctx context. func (client *SystemTopicEventSubscriptionsClient) getHandleResponse(resp *http.Response) (SystemTopicEventSubscriptionsGetResponse, error) { result := SystemTopicEventSubscriptionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventSubscription); err != nil { - return SystemTopicEventSubscriptionsGetResponse{}, err + return SystemTopicEventSubscriptionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -303,7 +310,7 @@ func (client *SystemTopicEventSubscriptionsClient) getDeliveryAttributesCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -313,7 +320,7 @@ func (client *SystemTopicEventSubscriptionsClient) getDeliveryAttributesCreateRe func (client *SystemTopicEventSubscriptionsClient) getDeliveryAttributesHandleResponse(resp *http.Response) (SystemTopicEventSubscriptionsGetDeliveryAttributesResponse, error) { result := SystemTopicEventSubscriptionsGetDeliveryAttributesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeliveryAttributeListResult); err != nil { - return SystemTopicEventSubscriptionsGetDeliveryAttributesResponse{}, err + return SystemTopicEventSubscriptionsGetDeliveryAttributesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -371,7 +378,7 @@ func (client *SystemTopicEventSubscriptionsClient) getFullURLCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -381,7 +388,7 @@ func (client *SystemTopicEventSubscriptionsClient) getFullURLCreateRequest(ctx c func (client *SystemTopicEventSubscriptionsClient) getFullURLHandleResponse(resp *http.Response) (SystemTopicEventSubscriptionsGetFullURLResponse, error) { result := SystemTopicEventSubscriptionsGetFullURLResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventSubscriptionFullURL); err != nil { - return SystemTopicEventSubscriptionsGetFullURLResponse{}, err + return SystemTopicEventSubscriptionsGetFullURLResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -432,7 +439,7 @@ func (client *SystemTopicEventSubscriptionsClient) listBySystemTopicCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -448,7 +455,7 @@ func (client *SystemTopicEventSubscriptionsClient) listBySystemTopicCreateReques func (client *SystemTopicEventSubscriptionsClient) listBySystemTopicHandleResponse(resp *http.Response) (SystemTopicEventSubscriptionsListBySystemTopicResponse, error) { result := SystemTopicEventSubscriptionsListBySystemTopicResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventSubscriptionsListResult); err != nil { - return SystemTopicEventSubscriptionsListBySystemTopicResponse{}, err + return SystemTopicEventSubscriptionsListBySystemTopicResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -526,7 +533,7 @@ func (client *SystemTopicEventSubscriptionsClient) updateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, eventSubscriptionUpdateParameters) diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_systemtopics_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_systemtopics_client.go index 3699318bf01d..fd7a37a56996 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_systemtopics_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_systemtopics_client.go @@ -11,15 +11,15 @@ package armeventgrid import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // SystemTopicsClient contains the methods for the SystemTopics group. @@ -31,8 +31,15 @@ type SystemTopicsClient struct { } // NewSystemTopicsClient creates a new instance of SystemTopicsClient with the specified values. -func NewSystemTopicsClient(con *arm.Connection, subscriptionID string) *SystemTopicsClient { - return &SystemTopicsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSystemTopicsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SystemTopicsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SystemTopicsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Asynchronously creates a new system topic with the specified parameters. @@ -92,7 +99,7 @@ func (client *SystemTopicsClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, systemTopicInfo) @@ -167,7 +174,7 @@ func (client *SystemTopicsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -221,7 +228,7 @@ func (client *SystemTopicsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -231,7 +238,7 @@ func (client *SystemTopicsClient) getCreateRequest(ctx context.Context, resource func (client *SystemTopicsClient) getHandleResponse(resp *http.Response) (SystemTopicsGetResponse, error) { result := SystemTopicsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SystemTopic); err != nil { - return SystemTopicsGetResponse{}, err + return SystemTopicsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -278,7 +285,7 @@ func (client *SystemTopicsClient) listByResourceGroupCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -294,7 +301,7 @@ func (client *SystemTopicsClient) listByResourceGroupCreateRequest(ctx context.C func (client *SystemTopicsClient) listByResourceGroupHandleResponse(resp *http.Response) (SystemTopicsListByResourceGroupResponse, error) { result := SystemTopicsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SystemTopicsListResult); err != nil { - return SystemTopicsListByResourceGroupResponse{}, err + return SystemTopicsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -337,7 +344,7 @@ func (client *SystemTopicsClient) listBySubscriptionCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -353,7 +360,7 @@ func (client *SystemTopicsClient) listBySubscriptionCreateRequest(ctx context.Co func (client *SystemTopicsClient) listBySubscriptionHandleResponse(resp *http.Response) (SystemTopicsListBySubscriptionResponse, error) { result := SystemTopicsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SystemTopicsListResult); err != nil { - return SystemTopicsListBySubscriptionResponse{}, err + return SystemTopicsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -427,7 +434,7 @@ func (client *SystemTopicsClient) updateCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, systemTopicUpdateParameters) diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_time_rfc3339.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_time_rfc3339.go index b2a4293c83c7..fb372f5e7325 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armeventgrid import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_topics_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_topics_client.go index 77ffd368b04a..9f13a5cdb67a 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_topics_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_topics_client.go @@ -11,15 +11,15 @@ package armeventgrid import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // TopicsClient contains the methods for the Topics group. @@ -31,8 +31,15 @@ type TopicsClient struct { } // NewTopicsClient creates a new instance of TopicsClient with the specified values. -func NewTopicsClient(con *arm.Connection, subscriptionID string) *TopicsClient { - return &TopicsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTopicsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TopicsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TopicsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Asynchronously creates a new topic with the specified parameters. @@ -92,7 +99,7 @@ func (client *TopicsClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, topicInfo) @@ -167,7 +174,7 @@ func (client *TopicsClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() return req, nil } @@ -221,7 +228,7 @@ func (client *TopicsClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -231,7 +238,7 @@ func (client *TopicsClient) getCreateRequest(ctx context.Context, resourceGroupN func (client *TopicsClient) getHandleResponse(resp *http.Response) (TopicsGetResponse, error) { result := TopicsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Topic); err != nil { - return TopicsGetResponse{}, err + return TopicsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -278,7 +285,7 @@ func (client *TopicsClient) listByResourceGroupCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -294,7 +301,7 @@ func (client *TopicsClient) listByResourceGroupCreateRequest(ctx context.Context func (client *TopicsClient) listByResourceGroupHandleResponse(resp *http.Response) (TopicsListByResourceGroupResponse, error) { result := TopicsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TopicsListResult); err != nil { - return TopicsListByResourceGroupResponse{}, err + return TopicsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -337,7 +344,7 @@ func (client *TopicsClient) listBySubscriptionCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") if options != nil && options.Filter != nil { reqQP.Set("$filter", *options.Filter) } @@ -353,7 +360,7 @@ func (client *TopicsClient) listBySubscriptionCreateRequest(ctx context.Context, func (client *TopicsClient) listBySubscriptionHandleResponse(resp *http.Response) (TopicsListBySubscriptionResponse, error) { result := TopicsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TopicsListResult); err != nil { - return TopicsListBySubscriptionResponse{}, err + return TopicsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -415,7 +422,7 @@ func (client *TopicsClient) listEventTypesCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -425,7 +432,7 @@ func (client *TopicsClient) listEventTypesCreateRequest(ctx context.Context, res func (client *TopicsClient) listEventTypesHandleResponse(resp *http.Response) (TopicsListEventTypesResponse, error) { result := TopicsListEventTypesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventTypesListResult); err != nil { - return TopicsListEventTypesResponse{}, err + return TopicsListEventTypesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -479,7 +486,7 @@ func (client *TopicsClient) listSharedAccessKeysCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -489,7 +496,7 @@ func (client *TopicsClient) listSharedAccessKeysCreateRequest(ctx context.Contex func (client *TopicsClient) listSharedAccessKeysHandleResponse(resp *http.Response) (TopicsListSharedAccessKeysResponse, error) { result := TopicsListSharedAccessKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TopicSharedAccessKeys); err != nil { - return TopicsListSharedAccessKeysResponse{}, err + return TopicsListSharedAccessKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -537,7 +544,7 @@ func (client *TopicsClient) regenerateKey(ctx context.Context, resourceGroupName if err != nil { return nil, err } - if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + if !runtime.HasStatusCode(resp, http.StatusOK) { return nil, client.regenerateKeyHandleError(resp) } return resp, nil @@ -563,7 +570,7 @@ func (client *TopicsClient) regenerateKeyCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, regenerateKeyRequest) @@ -638,7 +645,7 @@ func (client *TopicsClient) updateCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, topicUpdateParameters) diff --git a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_topictypes_client.go b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_topictypes_client.go index 81a21f1c4a41..45ceeac02711 100644 --- a/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_topictypes_client.go +++ b/sdk/resourcemanager/eventgrid/armeventgrid/zz_generated_topictypes_client.go @@ -11,13 +11,14 @@ package armeventgrid import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TopicTypesClient contains the methods for the TopicTypes group. @@ -28,8 +29,15 @@ type TopicTypesClient struct { } // NewTopicTypesClient creates a new instance of TopicTypesClient with the specified values. -func NewTopicTypesClient(con *arm.Connection) *TopicTypesClient { - return &TopicTypesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewTopicTypesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *TopicTypesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TopicTypesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get information about a topic type. @@ -61,7 +69,7 @@ func (client *TopicTypesClient) getCreateRequest(ctx context.Context, topicTypeN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -71,7 +79,7 @@ func (client *TopicTypesClient) getCreateRequest(ctx context.Context, topicTypeN func (client *TopicTypesClient) getHandleResponse(resp *http.Response) (TopicTypesGetResponse, error) { result := TopicTypesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TopicTypeInfo); err != nil { - return TopicTypesGetResponse{}, err + return TopicTypesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -113,7 +121,7 @@ func (client *TopicTypesClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -123,7 +131,7 @@ func (client *TopicTypesClient) listCreateRequest(ctx context.Context, options * func (client *TopicTypesClient) listHandleResponse(resp *http.Response) (TopicTypesListResponse, error) { result := TopicTypesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TopicTypesListResult); err != nil { - return TopicTypesListResponse{}, err + return TopicTypesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -169,7 +177,7 @@ func (client *TopicTypesClient) listEventTypesCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-12-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -179,7 +187,7 @@ func (client *TopicTypesClient) listEventTypesCreateRequest(ctx context.Context, func (client *TopicTypesClient) listEventTypesHandleResponse(resp *http.Response) (TopicTypesListEventTypesResponse, error) { result := TopicTypesListEventTypesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventTypesListResult); err != nil { - return TopicTypesListEventTypesResponse{}, err + return TopicTypesListEventTypesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/eventhub/armeventhub/CHANGELOG.md b/sdk/resourcemanager/eventhub/armeventhub/CHANGELOG.md index 08c3ed74c968..693538a4c9e0 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/CHANGELOG.md +++ b/sdk/resourcemanager/eventhub/armeventhub/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-10-08) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventhub/armeventhub". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/eventhub/armeventhub") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/eventhub/armeventhub/README.md b/sdk/resourcemanager/eventhub/armeventhub/README.md index 38899736db6e..def7641dad66 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/README.md +++ b/sdk/resourcemanager/eventhub/armeventhub/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Event Hubs +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Event Hubs modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armeventhub.NewPrivateEndpointConnectionsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Event Hubs modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armeventhub.NewPrivateEndpointConnectionsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armeventhub.NewPrivateEndpointConnectionsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/eventhub/armeventhub/autorest.md b/sdk/resourcemanager/eventhub/armeventhub/autorest.md index a1d4312c903a..9490a66e77af 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/autorest.md +++ b/sdk/resourcemanager/eventhub/armeventhub/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/eventhub/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/eventhub/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/eventhub/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/eventhub/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/eventhub/armeventhub/go.mod b/sdk/resourcemanager/eventhub/armeventhub/go.mod index 9d81bac6c3ea..28521ecc607d 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/go.mod +++ b/sdk/resourcemanager/eventhub/armeventhub/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/eventhub/armeventhu go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/eventhub/armeventhub/go.sum b/sdk/resourcemanager/eventhub/armeventhub/go.sum index 4f0fb709cf31..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/go.sum +++ b/sdk/resourcemanager/eventhub/armeventhub/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible h1:Cw16jiP4dI+CK761aq44ol4RV5dUiIIXky1+EKpoiVM= -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_clusters_client.go b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_clusters_client.go index b383ce5765b6..cbe6a68be712 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_clusters_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_clusters_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ClustersClient contains the methods for the Clusters group. @@ -31,8 +31,15 @@ type ClustersClient struct { } // NewClustersClient creates a new instance of ClustersClient with the specified values. -func NewClustersClient(con *arm.Connection, subscriptionID string) *ClustersClient { - return &ClustersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ClustersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ClustersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates an instance of an Event Hubs Cluster. @@ -92,7 +99,7 @@ func (client *ClustersClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *ClustersClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +241,7 @@ func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGrou func (client *ClustersClient) getHandleResponse(resp *http.Response) (ClustersGetResponse, error) { result := ClustersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Cluster); err != nil { - return ClustersGetResponse{}, err + return ClustersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -281,7 +288,7 @@ func (client *ClustersClient) listAvailableClusterRegionCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -291,7 +298,7 @@ func (client *ClustersClient) listAvailableClusterRegionCreateRequest(ctx contex func (client *ClustersClient) listAvailableClusterRegionHandleResponse(resp *http.Response) (ClustersListAvailableClusterRegionResponse, error) { result := ClustersListAvailableClusterRegionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailableClustersList); err != nil { - return ClustersListAvailableClusterRegionResponse{}, err + return ClustersListAvailableClusterRegionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -339,7 +346,7 @@ func (client *ClustersClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -349,7 +356,7 @@ func (client *ClustersClient) listByResourceGroupCreateRequest(ctx context.Conte func (client *ClustersClient) listByResourceGroupHandleResponse(resp *http.Response) (ClustersListByResourceGroupResponse, error) { result := ClustersListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ClusterListResult); err != nil { - return ClustersListByResourceGroupResponse{}, err + return ClustersListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -393,7 +400,7 @@ func (client *ClustersClient) listBySubscriptionCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -403,7 +410,7 @@ func (client *ClustersClient) listBySubscriptionCreateRequest(ctx context.Contex func (client *ClustersClient) listBySubscriptionHandleResponse(resp *http.Response) (ClustersListBySubscriptionResponse, error) { result := ClustersListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ClusterListResult); err != nil { - return ClustersListBySubscriptionResponse{}, err + return ClustersListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -458,7 +465,7 @@ func (client *ClustersClient) listNamespacesCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -468,7 +475,7 @@ func (client *ClustersClient) listNamespacesCreateRequest(ctx context.Context, r func (client *ClustersClient) listNamespacesHandleResponse(resp *http.Response) (ClustersListNamespacesResponse, error) { result := ClustersListNamespacesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EHNamespaceIDListResult); err != nil { - return ClustersListNamespacesResponse{}, err + return ClustersListNamespacesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -543,7 +550,7 @@ func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_configuration_client.go b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_configuration_client.go index 46f89e2d2a6c..39fd5a28db26 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_configuration_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_configuration_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ConfigurationClient contains the methods for the Configuration group. @@ -30,8 +31,15 @@ type ConfigurationClient struct { } // NewConfigurationClient creates a new instance of ConfigurationClient with the specified values. -func NewConfigurationClient(con *arm.Connection, subscriptionID string) *ConfigurationClient { - return &ConfigurationClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewConfigurationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ConfigurationClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ConfigurationClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get all Event Hubs Cluster settings - a collection of key/value pairs which represent the quotas and settings imposed on the cluster. @@ -71,7 +79,7 @@ func (client *ConfigurationClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -81,7 +89,7 @@ func (client *ConfigurationClient) getCreateRequest(ctx context.Context, resourc func (client *ConfigurationClient) getHandleResponse(resp *http.Response) (ConfigurationGetResponse, error) { result := ConfigurationGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ClusterQuotaConfigurationProperties); err != nil { - return ConfigurationGetResponse{}, err + return ConfigurationGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -137,7 +145,7 @@ func (client *ConfigurationClient) patchCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -147,7 +155,7 @@ func (client *ConfigurationClient) patchCreateRequest(ctx context.Context, resou func (client *ConfigurationClient) patchHandleResponse(resp *http.Response) (ConfigurationPatchResponse, error) { result := ConfigurationPatchResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ClusterQuotaConfigurationProperties); err != nil { - return ConfigurationPatchResponse{}, err + return ConfigurationPatchResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_constants.go b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_constants.go index 17272b1e3d1c..c96f0ad06e22 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_constants.go +++ b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_constants.go @@ -10,7 +10,7 @@ package armeventhub const ( module = "armeventhub" - version = "v0.1.0" + version = "v0.2.0" ) type AccessRights string @@ -389,6 +389,48 @@ func (c SKUTier) ToPtr() *SKUTier { return &c } +type SchemaCompatibility string + +const ( + SchemaCompatibilityBackward SchemaCompatibility = "Backward" + SchemaCompatibilityForward SchemaCompatibility = "Forward" + SchemaCompatibilityNone SchemaCompatibility = "None" +) + +// PossibleSchemaCompatibilityValues returns the possible values for the SchemaCompatibility const type. +func PossibleSchemaCompatibilityValues() []SchemaCompatibility { + return []SchemaCompatibility{ + SchemaCompatibilityBackward, + SchemaCompatibilityForward, + SchemaCompatibilityNone, + } +} + +// ToPtr returns a *SchemaCompatibility pointing to the current value. +func (c SchemaCompatibility) ToPtr() *SchemaCompatibility { + return &c +} + +type SchemaType string + +const ( + SchemaTypeAvro SchemaType = "Avro" + SchemaTypeUnknown SchemaType = "Unknown" +) + +// PossibleSchemaTypeValues returns the possible values for the SchemaType const type. +func PossibleSchemaTypeValues() []SchemaType { + return []SchemaType{ + SchemaTypeAvro, + SchemaTypeUnknown, + } +} + +// ToPtr returns a *SchemaType pointing to the current value. +func (c SchemaType) ToPtr() *SchemaType { + return &c +} + // UnavailableReason - Specifies the reason for the unavailability of the service. type UnavailableReason string diff --git a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_consumergroups_client.go b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_consumergroups_client.go index 2ebfd757ec38..884b9dbd8282 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_consumergroups_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_consumergroups_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // ConsumerGroupsClient contains the methods for the ConsumerGroups group. @@ -31,8 +32,15 @@ type ConsumerGroupsClient struct { } // NewConsumerGroupsClient creates a new instance of ConsumerGroupsClient with the specified values. -func NewConsumerGroupsClient(con *arm.Connection, subscriptionID string) *ConsumerGroupsClient { - return &ConsumerGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewConsumerGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ConsumerGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ConsumerGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates an Event Hubs consumer group as a nested resource within a Namespace. @@ -80,7 +88,7 @@ func (client *ConsumerGroupsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -90,7 +98,7 @@ func (client *ConsumerGroupsClient) createOrUpdateCreateRequest(ctx context.Cont func (client *ConsumerGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (ConsumerGroupsCreateOrUpdateResponse, error) { result := ConsumerGroupsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConsumerGroup); err != nil { - return ConsumerGroupsCreateOrUpdateResponse{}, err + return ConsumerGroupsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -153,7 +161,7 @@ func (client *ConsumerGroupsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -217,7 +225,7 @@ func (client *ConsumerGroupsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -227,7 +235,7 @@ func (client *ConsumerGroupsClient) getCreateRequest(ctx context.Context, resour func (client *ConsumerGroupsClient) getHandleResponse(resp *http.Response) (ConsumerGroupsGetResponse, error) { result := ConsumerGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConsumerGroup); err != nil { - return ConsumerGroupsGetResponse{}, err + return ConsumerGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -283,7 +291,7 @@ func (client *ConsumerGroupsClient) listByEventHubCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } @@ -299,7 +307,7 @@ func (client *ConsumerGroupsClient) listByEventHubCreateRequest(ctx context.Cont func (client *ConsumerGroupsClient) listByEventHubHandleResponse(resp *http.Response) (ConsumerGroupsListByEventHubResponse, error) { result := ConsumerGroupsListByEventHubResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConsumerGroupListResult); err != nil { - return ConsumerGroupsListByEventHubResponse{}, err + return ConsumerGroupsListByEventHubResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_disasterrecoveryconfigs_client.go b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_disasterrecoveryconfigs_client.go index c315296ab2ac..426142d9d1c2 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_disasterrecoveryconfigs_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_disasterrecoveryconfigs_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DisasterRecoveryConfigsClient contains the methods for the DisasterRecoveryConfigs group. @@ -30,8 +31,15 @@ type DisasterRecoveryConfigsClient struct { } // NewDisasterRecoveryConfigsClient creates a new instance of DisasterRecoveryConfigsClient with the specified values. -func NewDisasterRecoveryConfigsClient(con *arm.Connection, subscriptionID string) *DisasterRecoveryConfigsClient { - return &DisasterRecoveryConfigsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDisasterRecoveryConfigsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DisasterRecoveryConfigsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DisasterRecoveryConfigsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BreakPairing - This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces @@ -75,7 +83,7 @@ func (client *DisasterRecoveryConfigsClient) breakPairingCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -131,7 +139,7 @@ func (client *DisasterRecoveryConfigsClient) checkNameAvailabilityCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -141,7 +149,7 @@ func (client *DisasterRecoveryConfigsClient) checkNameAvailabilityCreateRequest( func (client *DisasterRecoveryConfigsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (DisasterRecoveryConfigsCheckNameAvailabilityResponse, error) { result := DisasterRecoveryConfigsCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResult); err != nil { - return DisasterRecoveryConfigsCheckNameAvailabilityResponse{}, err + return DisasterRecoveryConfigsCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -200,7 +208,7 @@ func (client *DisasterRecoveryConfigsClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -210,7 +218,7 @@ func (client *DisasterRecoveryConfigsClient) createOrUpdateCreateRequest(ctx con func (client *DisasterRecoveryConfigsClient) createOrUpdateHandleResponse(resp *http.Response) (DisasterRecoveryConfigsCreateOrUpdateResponse, error) { result := DisasterRecoveryConfigsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ArmDisasterRecovery); err != nil { - return DisasterRecoveryConfigsCreateOrUpdateResponse{}, err + return DisasterRecoveryConfigsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -239,7 +247,7 @@ func (client *DisasterRecoveryConfigsClient) Delete(ctx context.Context, resourc if err != nil { return DisasterRecoveryConfigsDeleteResponse{}, err } - if !runtime.HasStatusCode(resp, http.StatusOK) { + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { return DisasterRecoveryConfigsDeleteResponse{}, client.deleteHandleError(resp) } return DisasterRecoveryConfigsDeleteResponse{RawResponse: resp}, nil @@ -269,7 +277,7 @@ func (client *DisasterRecoveryConfigsClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -329,7 +337,7 @@ func (client *DisasterRecoveryConfigsClient) failOverCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -389,7 +397,7 @@ func (client *DisasterRecoveryConfigsClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -399,7 +407,7 @@ func (client *DisasterRecoveryConfigsClient) getCreateRequest(ctx context.Contex func (client *DisasterRecoveryConfigsClient) getHandleResponse(resp *http.Response) (DisasterRecoveryConfigsGetResponse, error) { result := DisasterRecoveryConfigsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ArmDisasterRecovery); err != nil { - return DisasterRecoveryConfigsGetResponse{}, err + return DisasterRecoveryConfigsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -462,7 +470,7 @@ func (client *DisasterRecoveryConfigsClient) getAuthorizationRuleCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -472,7 +480,7 @@ func (client *DisasterRecoveryConfigsClient) getAuthorizationRuleCreateRequest(c func (client *DisasterRecoveryConfigsClient) getAuthorizationRuleHandleResponse(resp *http.Response) (DisasterRecoveryConfigsGetAuthorizationRuleResponse, error) { result := DisasterRecoveryConfigsGetAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRule); err != nil { - return DisasterRecoveryConfigsGetAuthorizationRuleResponse{}, err + return DisasterRecoveryConfigsGetAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -524,7 +532,7 @@ func (client *DisasterRecoveryConfigsClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -534,7 +542,7 @@ func (client *DisasterRecoveryConfigsClient) listCreateRequest(ctx context.Conte func (client *DisasterRecoveryConfigsClient) listHandleResponse(resp *http.Response) (DisasterRecoveryConfigsListResponse, error) { result := DisasterRecoveryConfigsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ArmDisasterRecoveryListResult); err != nil { - return DisasterRecoveryConfigsListResponse{}, err + return DisasterRecoveryConfigsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -590,7 +598,7 @@ func (client *DisasterRecoveryConfigsClient) listAuthorizationRulesCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -600,7 +608,7 @@ func (client *DisasterRecoveryConfigsClient) listAuthorizationRulesCreateRequest func (client *DisasterRecoveryConfigsClient) listAuthorizationRulesHandleResponse(resp *http.Response) (DisasterRecoveryConfigsListAuthorizationRulesResponse, error) { result := DisasterRecoveryConfigsListAuthorizationRulesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRuleListResult); err != nil { - return DisasterRecoveryConfigsListAuthorizationRulesResponse{}, err + return DisasterRecoveryConfigsListAuthorizationRulesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -663,7 +671,7 @@ func (client *DisasterRecoveryConfigsClient) listKeysCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -673,7 +681,7 @@ func (client *DisasterRecoveryConfigsClient) listKeysCreateRequest(ctx context.C func (client *DisasterRecoveryConfigsClient) listKeysHandleResponse(resp *http.Response) (DisasterRecoveryConfigsListKeysResponse, error) { result := DisasterRecoveryConfigsListKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { - return DisasterRecoveryConfigsListKeysResponse{}, err + return DisasterRecoveryConfigsListKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_eventhubs_client.go b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_eventhubs_client.go index a9b20bf57e0f..6a62f558b308 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_eventhubs_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_eventhubs_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // EventHubsClient contains the methods for the EventHubs group. @@ -31,8 +32,15 @@ type EventHubsClient struct { } // NewEventHubsClient creates a new instance of EventHubsClient with the specified values. -func NewEventHubsClient(con *arm.Connection, subscriptionID string) *EventHubsClient { - return &EventHubsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewEventHubsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *EventHubsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &EventHubsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a new Event Hub as a nested resource within a Namespace. @@ -76,7 +84,7 @@ func (client *EventHubsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -86,7 +94,7 @@ func (client *EventHubsClient) createOrUpdateCreateRequest(ctx context.Context, func (client *EventHubsClient) createOrUpdateHandleResponse(resp *http.Response) (EventHubsCreateOrUpdateResponse, error) { result := EventHubsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Eventhub); err != nil { - return EventHubsCreateOrUpdateResponse{}, err + return EventHubsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -150,7 +158,7 @@ func (client *EventHubsClient) createOrUpdateAuthorizationRuleCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -160,7 +168,7 @@ func (client *EventHubsClient) createOrUpdateAuthorizationRuleCreateRequest(ctx func (client *EventHubsClient) createOrUpdateAuthorizationRuleHandleResponse(resp *http.Response) (EventHubsCreateOrUpdateAuthorizationRuleResponse, error) { result := EventHubsCreateOrUpdateAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRule); err != nil { - return EventHubsCreateOrUpdateAuthorizationRuleResponse{}, err + return EventHubsCreateOrUpdateAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -219,7 +227,7 @@ func (client *EventHubsClient) deleteCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -283,7 +291,7 @@ func (client *EventHubsClient) deleteAuthorizationRuleCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -343,7 +351,7 @@ func (client *EventHubsClient) getCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -353,7 +361,7 @@ func (client *EventHubsClient) getCreateRequest(ctx context.Context, resourceGro func (client *EventHubsClient) getHandleResponse(resp *http.Response) (EventHubsGetResponse, error) { result := EventHubsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Eventhub); err != nil { - return EventHubsGetResponse{}, err + return EventHubsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -416,7 +424,7 @@ func (client *EventHubsClient) getAuthorizationRuleCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -426,7 +434,7 @@ func (client *EventHubsClient) getAuthorizationRuleCreateRequest(ctx context.Con func (client *EventHubsClient) getAuthorizationRuleHandleResponse(resp *http.Response) (EventHubsGetAuthorizationRuleResponse, error) { result := EventHubsGetAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRule); err != nil { - return EventHubsGetAuthorizationRuleResponse{}, err + return EventHubsGetAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -482,7 +490,7 @@ func (client *EventHubsClient) listAuthorizationRulesCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -492,7 +500,7 @@ func (client *EventHubsClient) listAuthorizationRulesCreateRequest(ctx context.C func (client *EventHubsClient) listAuthorizationRulesHandleResponse(resp *http.Response) (EventHubsListAuthorizationRulesResponse, error) { result := EventHubsListAuthorizationRulesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRuleListResult); err != nil { - return EventHubsListAuthorizationRulesResponse{}, err + return EventHubsListAuthorizationRulesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -544,7 +552,7 @@ func (client *EventHubsClient) listByNamespaceCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") if options != nil && options.Skip != nil { reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) } @@ -560,7 +568,7 @@ func (client *EventHubsClient) listByNamespaceCreateRequest(ctx context.Context, func (client *EventHubsClient) listByNamespaceHandleResponse(resp *http.Response) (EventHubsListByNamespaceResponse, error) { result := EventHubsListByNamespaceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventHubListResult); err != nil { - return EventHubsListByNamespaceResponse{}, err + return EventHubsListByNamespaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -623,7 +631,7 @@ func (client *EventHubsClient) listKeysCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -633,7 +641,7 @@ func (client *EventHubsClient) listKeysCreateRequest(ctx context.Context, resour func (client *EventHubsClient) listKeysHandleResponse(resp *http.Response) (EventHubsListKeysResponse, error) { result := EventHubsListKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { - return EventHubsListKeysResponse{}, err + return EventHubsListKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -696,7 +704,7 @@ func (client *EventHubsClient) regenerateKeysCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -706,7 +714,7 @@ func (client *EventHubsClient) regenerateKeysCreateRequest(ctx context.Context, func (client *EventHubsClient) regenerateKeysHandleResponse(resp *http.Response) (EventHubsRegenerateKeysResponse, error) { result := EventHubsRegenerateKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { - return EventHubsRegenerateKeysResponse{}, err + return EventHubsRegenerateKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_models.go b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_models.go index af0282c5e516..f01d395395d5 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_models.go +++ b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_models.go @@ -10,10 +10,9 @@ package armeventhub import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // AccessKeys - Namespace/EventHub Connection String @@ -42,7 +41,7 @@ type AccessKeys struct { // ArmDisasterRecovery - Single item in List or Get Alias(Disaster Recovery configuration) operation type ArmDisasterRecovery struct { - Resource + ProxyResource // Properties required to the Create Or Update Alias(Disaster Recovery configurations) Properties *ArmDisasterRecoveryProperties `json:"properties,omitempty"` @@ -50,15 +49,6 @@ type ArmDisasterRecovery struct { SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ArmDisasterRecovery. -func (a ArmDisasterRecovery) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - a.Resource.marshalInternal(objectMap) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - return json.Marshal(objectMap) -} - // ArmDisasterRecoveryListResult - The result of the List Alias(Disaster Recovery configuration) operation. type ArmDisasterRecoveryListResult struct { // List of Alias(Disaster Recovery configurations) @@ -96,7 +86,7 @@ type ArmDisasterRecoveryProperties struct { // AuthorizationRule - Single item in a List or Get AuthorizationRule operation type AuthorizationRule struct { - Resource + ProxyResource // Properties supplied to create or update AuthorizationRule Properties *AuthorizationRuleProperties `json:"properties,omitempty"` @@ -104,15 +94,6 @@ type AuthorizationRule struct { SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type AuthorizationRule. -func (a AuthorizationRule) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - a.Resource.marshalInternal(objectMap) - populate(objectMap, "properties", a.Properties) - populate(objectMap, "systemData", a.SystemData) - return json.Marshal(objectMap) -} - // AuthorizationRuleListResult - The response from the List namespace operation. type AuthorizationRuleListResult struct { // Link to the next set of results. Not empty if Value contains an incomplete list of Authorization Rules @@ -339,7 +320,7 @@ type ConnectionState struct { // ConsumerGroup - Single item in List or Get Consumer group operation type ConsumerGroup struct { - Resource + ProxyResource // Single item in List or Get Consumer group operation Properties *ConsumerGroupProperties `json:"properties,omitempty"` @@ -347,15 +328,6 @@ type ConsumerGroup struct { SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type ConsumerGroup. -func (c ConsumerGroup) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - c.Resource.marshalInternal(objectMap) - populate(objectMap, "properties", c.Properties) - populate(objectMap, "systemData", c.SystemData) - return json.Marshal(objectMap) -} - // ConsumerGroupListResult - The result to the List Consumer Group operation. type ConsumerGroupListResult struct { // Link to the next set of results. Not empty if Value contains incomplete list of Consumer Group @@ -390,8 +362,8 @@ type ConsumerGroupProperties struct { // MarshalJSON implements the json.Marshaller interface for type ConsumerGroupProperties. func (c ConsumerGroupProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(c.CreatedAt)) - populate(objectMap, "updatedAt", (*timeRFC3339)(c.UpdatedAt)) + populateTimeRFC3339(objectMap, "createdAt", c.CreatedAt) + populateTimeRFC3339(objectMap, "updatedAt", c.UpdatedAt) populate(objectMap, "userMetadata", c.UserMetadata) return json.Marshal(objectMap) } @@ -406,14 +378,10 @@ func (c *ConsumerGroupProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.CreatedAt) delete(rawMsg, key) case "updatedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.UpdatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.UpdatedAt) delete(rawMsg, key) case "userMetadata": err = unpopulate(val, &c.UserMetadata) @@ -469,6 +437,15 @@ type DestinationProperties struct { // Blob container Name BlobContainer *string `json:"blobContainer,omitempty"` + // The Azure Data Lake Store name for the captured events + DataLakeAccountName *string `json:"dataLakeAccountName,omitempty"` + + // The destination folder path for the captured events + DataLakeFolderPath *string `json:"dataLakeFolderPath,omitempty"` + + // Subscription Id of Azure Data Lake Store + DataLakeSubscriptionID *string `json:"dataLakeSubscriptionId,omitempty"` + // Resource id of the storage account to be used to create the blobs StorageAccountResourceID *string `json:"storageAccountResourceId,omitempty"` } @@ -588,6 +565,9 @@ func (e EHNamespaceListResult) MarshalJSON() ([]byte, error) { // EHNamespaceProperties - Namespace properties supplied for create namespace operation. type EHNamespaceProperties struct { + // Alternate name specified when alias and namespace names are same. + AlternateName *string `json:"alternateName,omitempty"` + // Cluster ARM ID of the Namespace. ClusterArmID *string `json:"clusterArmId,omitempty"` @@ -634,8 +614,9 @@ type EHNamespaceProperties struct { // MarshalJSON implements the json.Marshaller interface for type EHNamespaceProperties. func (e EHNamespaceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) + populate(objectMap, "alternateName", e.AlternateName) populate(objectMap, "clusterArmId", e.ClusterArmID) - populate(objectMap, "createdAt", (*timeRFC3339)(e.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", e.CreatedAt) populate(objectMap, "disableLocalAuth", e.DisableLocalAuth) populate(objectMap, "encryption", e.Encryption) populate(objectMap, "isAutoInflateEnabled", e.IsAutoInflateEnabled) @@ -646,7 +627,7 @@ func (e EHNamespaceProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "provisioningState", e.ProvisioningState) populate(objectMap, "serviceBusEndpoint", e.ServiceBusEndpoint) populate(objectMap, "status", e.Status) - populate(objectMap, "updatedAt", (*timeRFC3339)(e.UpdatedAt)) + populateTimeRFC3339(objectMap, "updatedAt", e.UpdatedAt) populate(objectMap, "zoneRedundant", e.ZoneRedundant) return json.Marshal(objectMap) } @@ -660,13 +641,14 @@ func (e *EHNamespaceProperties) UnmarshalJSON(data []byte) error { for key, val := range rawMsg { var err error switch key { + case "alternateName": + err = unpopulate(val, &e.AlternateName) + delete(rawMsg, key) case "clusterArmId": err = unpopulate(val, &e.ClusterArmID) delete(rawMsg, key) case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.CreatedAt) delete(rawMsg, key) case "disableLocalAuth": err = unpopulate(val, &e.DisableLocalAuth) @@ -699,9 +681,7 @@ func (e *EHNamespaceProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.Status) delete(rawMsg, key) case "updatedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.UpdatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.UpdatedAt) delete(rawMsg, key) case "zoneRedundant": err = unpopulate(val, &e.ZoneRedundant) @@ -735,15 +715,50 @@ func (e Encryption) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// ErrorAdditionalInfo - The resource management error additional info. +type ErrorAdditionalInfo struct { + // READ-ONLY; The additional info. + Info map[string]interface{} `json:"info,omitempty" azure:"ro"` + + // READ-ONLY; The additional info type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// ErrorDetail - The error detail. +type ErrorDetail struct { + // READ-ONLY; The error additional info. + AdditionalInfo []*ErrorAdditionalInfo `json:"additionalInfo,omitempty" azure:"ro"` + + // READ-ONLY; The error code. + Code *string `json:"code,omitempty" azure:"ro"` + + // READ-ONLY; The error details. + Details []*ErrorDetail `json:"details,omitempty" azure:"ro"` + + // READ-ONLY; The error message. + Message *string `json:"message,omitempty" azure:"ro"` + + // READ-ONLY; The error target. + Target *string `json:"target,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type ErrorDetail. +func (e ErrorDetail) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "additionalInfo", e.AdditionalInfo) + populate(objectMap, "code", e.Code) + populate(objectMap, "details", e.Details) + populate(objectMap, "message", e.Message) + populate(objectMap, "target", e.Target) + return json.Marshal(objectMap) +} + // ErrorResponse - Error response indicates Event Hub service is not able to process the incoming request. The reason is provided in the error message. // Implements the error and azcore.HTTPResponse interfaces. type ErrorResponse struct { raw string - // Error code. - Code *string `json:"code,omitempty"` - - // Error message indicating why the operation failed. - Message *string `json:"message,omitempty"` + // The error object. + InnerError *ErrorDetail `json:"error,omitempty"` } // Error implements the error interface for type ErrorResponse. @@ -825,7 +840,7 @@ type EventHubsRegenerateKeysOptions struct { // Eventhub - Single item in List or Get Event Hub operation type Eventhub struct { - Resource + ProxyResource // Properties supplied to the Create Or Update Event Hub operation. Properties *EventhubProperties `json:"properties,omitempty"` @@ -833,15 +848,6 @@ type Eventhub struct { SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type Eventhub. -func (e Eventhub) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - e.Resource.marshalInternal(objectMap) - populate(objectMap, "properties", e.Properties) - populate(objectMap, "systemData", e.SystemData) - return json.Marshal(objectMap) -} - // EventhubProperties - Properties supplied to the Create Or Update Event Hub operation. type EventhubProperties struct { // Properties of capture description @@ -870,12 +876,12 @@ type EventhubProperties struct { func (e EventhubProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "captureDescription", e.CaptureDescription) - populate(objectMap, "createdAt", (*timeRFC3339)(e.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", e.CreatedAt) populate(objectMap, "messageRetentionInDays", e.MessageRetentionInDays) populate(objectMap, "partitionCount", e.PartitionCount) populate(objectMap, "partitionIds", e.PartitionIDs) populate(objectMap, "status", e.Status) - populate(objectMap, "updatedAt", (*timeRFC3339)(e.UpdatedAt)) + populateTimeRFC3339(objectMap, "updatedAt", e.UpdatedAt) return json.Marshal(objectMap) } @@ -892,9 +898,7 @@ func (e *EventhubProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.CaptureDescription) delete(rawMsg, key) case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.CreatedAt) delete(rawMsg, key) case "messageRetentionInDays": err = unpopulate(val, &e.MessageRetentionInDays) @@ -909,9 +913,7 @@ func (e *EventhubProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.Status) delete(rawMsg, key) case "updatedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.UpdatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.UpdatedAt) delete(rawMsg, key) } if err != nil { @@ -1038,6 +1040,11 @@ type NamespacesListKeysOptions struct { // placeholder for future optional parameters } +// NamespacesListNetworkRuleSetOptions contains the optional parameters for the Namespaces.ListNetworkRuleSet method. +type NamespacesListNetworkRuleSetOptions struct { + // placeholder for future optional parameters +} + // NamespacesListOptions contains the optional parameters for the Namespaces.List method. type NamespacesListOptions struct { // placeholder for future optional parameters @@ -1055,7 +1062,7 @@ type NamespacesUpdateOptions struct { // NetworkRuleSet - Description of topic resource. type NetworkRuleSet struct { - Resource + ProxyResource // NetworkRuleSet properties Properties *NetworkRuleSetProperties `json:"properties,omitempty"` @@ -1063,12 +1070,20 @@ type NetworkRuleSet struct { SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSet. -func (n NetworkRuleSet) MarshalJSON() ([]byte, error) { +// NetworkRuleSetListResult - The response of the List NetworkRuleSet operation +type NetworkRuleSetListResult struct { + // Link to the next set of results. Not empty if Value contains incomplete list of NetworkRuleSet. + NextLink *string `json:"nextLink,omitempty"` + + // Result of the List NetworkRuleSet operation + Value []*NetworkRuleSet `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type NetworkRuleSetListResult. +func (n NetworkRuleSetListResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - n.Resource.marshalInternal(objectMap) - populate(objectMap, "properties", n.Properties) - populate(objectMap, "systemData", n.SystemData) + populate(objectMap, "nextLink", n.NextLink) + populate(objectMap, "value", n.Value) return json.Marshal(objectMap) } @@ -1103,22 +1118,34 @@ func (n NetworkRuleSetProperties) MarshalJSON() ([]byte, error) { // Operation - A Event Hub REST API operation type Operation struct { - // The object that represents the operation. + // Display of the operation Display *OperationDisplay `json:"display,omitempty"` + // Indicates whether the operation is a data action + IsDataAction *bool `json:"isDataAction,omitempty"` + + // Origin of the operation + Origin *string `json:"origin,omitempty"` + + // Properties of the operation + Properties map[string]interface{} `json:"properties,omitempty"` + // READ-ONLY; Operation name: {provider}/{resource}/{operation} Name *string `json:"name,omitempty" azure:"ro"` } -// OperationDisplay - The object that represents the operation. +// OperationDisplay - Operation display payload type OperationDisplay struct { - // READ-ONLY; Operation type: Read, write, delete, etc. + // READ-ONLY; Localized friendly description for the operation + Description *string `json:"description,omitempty" azure:"ro"` + + // READ-ONLY; Localized friendly name for the operation Operation *string `json:"operation,omitempty" azure:"ro"` - // READ-ONLY; Service provider: Microsoft.EventHub + // READ-ONLY; Resource provider of the operation Provider *string `json:"provider,omitempty" azure:"ro"` - // READ-ONLY; Resource on which the operation is performed: Invoice, etc. + // READ-ONLY; Resource of the operation Resource *string `json:"resource,omitempty" azure:"ro"` } @@ -1152,7 +1179,7 @@ type PrivateEndpoint struct { // PrivateEndpointConnection - Properties of the PrivateEndpointConnection. type PrivateEndpointConnection struct { - Resource + ProxyResource // Properties of the PrivateEndpointConnection. Properties *PrivateEndpointConnectionProperties `json:"properties,omitempty"` @@ -1160,15 +1187,6 @@ type PrivateEndpointConnection struct { SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` } -// MarshalJSON implements the json.Marshaller interface for type PrivateEndpointConnection. -func (p PrivateEndpointConnection) MarshalJSON() ([]byte, error) { - objectMap := make(map[string]interface{}) - p.Resource.marshalInternal(objectMap) - populate(objectMap, "properties", p.Properties) - populate(objectMap, "systemData", p.SystemData) - return json.Marshal(objectMap) -} - // PrivateEndpointConnectionListResult - Result of the list of all private endpoint connections operation. type PrivateEndpointConnectionListResult struct { // A link for the next page of private endpoint connection resources. @@ -1276,6 +1294,21 @@ func (p PrivateLinkResourcesListResult) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// ProxyResource - Common fields that are returned in the response for all Azure Resource Manager resources +type ProxyResource struct { + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} + ID *string `json:"id,omitempty" azure:"ro"` + + // READ-ONLY; The geo-location where the resource lives + Location *string `json:"location,omitempty" azure:"ro"` + + // READ-ONLY; The name of the resource + Name *string `json:"name,omitempty" azure:"ro"` + + // READ-ONLY; The type of the resource. E.g. "Microsoft.EventHub/Namespaces" or "Microsoft.EventHub/Namespaces/EventHubs" + Type *string `json:"type,omitempty" azure:"ro"` +} + // RegenerateAccessKeyParameters - Parameters supplied to the Regenerate Authorization Rule operation, specifies which key needs to be reset. type RegenerateAccessKeyParameters struct { // REQUIRED; The access key to regenerate. @@ -1285,15 +1318,15 @@ type RegenerateAccessKeyParameters struct { Key *string `json:"key,omitempty"` } -// Resource - The resource definition. +// Resource - Common fields that are returned in the response for all Azure Resource Manager resources type Resource struct { - // READ-ONLY; Resource ID. + // READ-ONLY; Fully qualified resource ID for the resource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} ID *string `json:"id,omitempty" azure:"ro"` - // READ-ONLY; Resource name. + // READ-ONLY; The name of the resource Name *string `json:"name,omitempty" azure:"ro"` - // READ-ONLY; Resource type. + // READ-ONLY; The type of the resource. E.g. "Microsoft.Compute/virtualMachines" or "Microsoft.Storage/storageAccounts" Type *string `json:"type,omitempty" azure:"ro"` } @@ -1323,6 +1356,119 @@ type SKU struct { Tier *SKUTier `json:"tier,omitempty"` } +// SchemaGroup - Single item in List or Get Schema Group operation +type SchemaGroup struct { + ProxyResource + Properties *SchemaGroupProperties `json:"properties,omitempty"` + + // READ-ONLY; The system meta data relating to this resource. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// SchemaGroupListResult - The result of the List SchemaGroup operation. +type SchemaGroupListResult struct { + // Link to the next set of results. Not empty if Value contains incomplete list of Schema Groups. + NextLink *string `json:"nextLink,omitempty"` + + // Result of the List SchemaGroups operation. + Value []*SchemaGroup `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SchemaGroupListResult. +func (s SchemaGroupListResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +type SchemaGroupProperties struct { + // dictionary object for SchemaGroup group properties + GroupProperties map[string]*string `json:"groupProperties,omitempty"` + SchemaCompatibility *SchemaCompatibility `json:"schemaCompatibility,omitempty"` + SchemaType *SchemaType `json:"schemaType,omitempty"` + + // READ-ONLY; Exact time the Schema Group was created. + CreatedAtUTC *time.Time `json:"createdAtUtc,omitempty" azure:"ro"` + + // READ-ONLY; The ETag value. + ETag *string `json:"eTag,omitempty" azure:"ro"` + + // READ-ONLY; Exact time the Schema Group was updated + UpdatedAtUTC *time.Time `json:"updatedAtUtc,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type SchemaGroupProperties. +func (s SchemaGroupProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateTimeRFC3339(objectMap, "createdAtUtc", s.CreatedAtUTC) + populate(objectMap, "eTag", s.ETag) + populate(objectMap, "groupProperties", s.GroupProperties) + populate(objectMap, "schemaCompatibility", s.SchemaCompatibility) + populate(objectMap, "schemaType", s.SchemaType) + populateTimeRFC3339(objectMap, "updatedAtUtc", s.UpdatedAtUTC) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SchemaGroupProperties. +func (s *SchemaGroupProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "createdAtUtc": + err = unpopulateTimeRFC3339(val, &s.CreatedAtUTC) + delete(rawMsg, key) + case "eTag": + err = unpopulate(val, &s.ETag) + delete(rawMsg, key) + case "groupProperties": + err = unpopulate(val, &s.GroupProperties) + delete(rawMsg, key) + case "schemaCompatibility": + err = unpopulate(val, &s.SchemaCompatibility) + delete(rawMsg, key) + case "schemaType": + err = unpopulate(val, &s.SchemaType) + delete(rawMsg, key) + case "updatedAtUtc": + err = unpopulateTimeRFC3339(val, &s.UpdatedAtUTC) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// SchemaRegistryCreateOrUpdateOptions contains the optional parameters for the SchemaRegistry.CreateOrUpdate method. +type SchemaRegistryCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// SchemaRegistryDeleteOptions contains the optional parameters for the SchemaRegistry.Delete method. +type SchemaRegistryDeleteOptions struct { + // placeholder for future optional parameters +} + +// SchemaRegistryGetOptions contains the optional parameters for the SchemaRegistry.Get method. +type SchemaRegistryGetOptions struct { + // placeholder for future optional parameters +} + +// SchemaRegistryListByNamespaceOptions contains the optional parameters for the SchemaRegistry.ListByNamespace method. +type SchemaRegistryListByNamespaceOptions struct { + // Skip is only used if a previous operation returned a partial result. If a previous response contains a nextLink element, the value of the nextLink element + // will include a skip parameter that specifies a starting point to use for subsequent calls. + Skip *int32 + // May be used to limit the number of results to the most recent N usageDetails. + Top *int32 +} + // Subnet - Properties supplied for Subnet type Subnet struct { // Resource ID of Virtual Network Subnet @@ -1353,10 +1499,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -1372,9 +1518,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -1383,9 +1527,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) diff --git a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_namespaces_client.go b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_namespaces_client.go index b8481d50f971..fb162b4aa37b 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_namespaces_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_namespaces_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NamespacesClient contains the methods for the Namespaces group. @@ -31,8 +31,15 @@ type NamespacesClient struct { } // NewNamespacesClient creates a new instance of NamespacesClient with the specified values. -func NewNamespacesClient(con *arm.Connection, subscriptionID string) *NamespacesClient { - return &NamespacesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNamespacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NamespacesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NamespacesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNameAvailability - Check the give Namespace name availability. @@ -64,7 +71,7 @@ func (client *NamespacesClient) checkNameAvailabilityCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -74,7 +81,7 @@ func (client *NamespacesClient) checkNameAvailabilityCreateRequest(ctx context.C func (client *NamespacesClient) checkNameAvailabilityHandleResponse(resp *http.Response) (NamespacesCheckNameAvailabilityResponse, error) { result := NamespacesCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResult); err != nil { - return NamespacesCheckNameAvailabilityResponse{}, err + return NamespacesCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -149,7 +156,7 @@ func (client *NamespacesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -209,7 +216,7 @@ func (client *NamespacesClient) createOrUpdateAuthorizationRuleCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -219,7 +226,7 @@ func (client *NamespacesClient) createOrUpdateAuthorizationRuleCreateRequest(ctx func (client *NamespacesClient) createOrUpdateAuthorizationRuleHandleResponse(resp *http.Response) (NamespacesCreateOrUpdateAuthorizationRuleResponse, error) { result := NamespacesCreateOrUpdateAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRule); err != nil { - return NamespacesCreateOrUpdateAuthorizationRuleResponse{}, err + return NamespacesCreateOrUpdateAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -274,7 +281,7 @@ func (client *NamespacesClient) createOrUpdateNetworkRuleSetCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -284,7 +291,7 @@ func (client *NamespacesClient) createOrUpdateNetworkRuleSetCreateRequest(ctx co func (client *NamespacesClient) createOrUpdateNetworkRuleSetHandleResponse(resp *http.Response) (NamespacesCreateOrUpdateNetworkRuleSetResponse, error) { result := NamespacesCreateOrUpdateNetworkRuleSetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkRuleSet); err != nil { - return NamespacesCreateOrUpdateNetworkRuleSetResponse{}, err + return NamespacesCreateOrUpdateNetworkRuleSetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -359,7 +366,7 @@ func (client *NamespacesClient) deleteCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -419,7 +426,7 @@ func (client *NamespacesClient) deleteAuthorizationRuleCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -475,7 +482,7 @@ func (client *NamespacesClient) getCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -485,7 +492,7 @@ func (client *NamespacesClient) getCreateRequest(ctx context.Context, resourceGr func (client *NamespacesClient) getHandleResponse(resp *http.Response) (NamespacesGetResponse, error) { result := NamespacesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EHNamespace); err != nil { - return NamespacesGetResponse{}, err + return NamespacesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -544,7 +551,7 @@ func (client *NamespacesClient) getAuthorizationRuleCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -554,7 +561,7 @@ func (client *NamespacesClient) getAuthorizationRuleCreateRequest(ctx context.Co func (client *NamespacesClient) getAuthorizationRuleHandleResponse(resp *http.Response) (NamespacesGetAuthorizationRuleResponse, error) { result := NamespacesGetAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRule); err != nil { - return NamespacesGetAuthorizationRuleResponse{}, err + return NamespacesGetAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -609,7 +616,7 @@ func (client *NamespacesClient) getNetworkRuleSetCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -619,7 +626,7 @@ func (client *NamespacesClient) getNetworkRuleSetCreateRequest(ctx context.Conte func (client *NamespacesClient) getNetworkRuleSetHandleResponse(resp *http.Response) (NamespacesGetNetworkRuleSetResponse, error) { result := NamespacesGetNetworkRuleSetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkRuleSet); err != nil { - return NamespacesGetNetworkRuleSetResponse{}, err + return NamespacesGetNetworkRuleSetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -663,7 +670,7 @@ func (client *NamespacesClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -673,7 +680,7 @@ func (client *NamespacesClient) listCreateRequest(ctx context.Context, options * func (client *NamespacesClient) listHandleResponse(resp *http.Response) (NamespacesListResponse, error) { result := NamespacesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EHNamespaceListResult); err != nil { - return NamespacesListResponse{}, err + return NamespacesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -725,7 +732,7 @@ func (client *NamespacesClient) listAuthorizationRulesCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -735,7 +742,7 @@ func (client *NamespacesClient) listAuthorizationRulesCreateRequest(ctx context. func (client *NamespacesClient) listAuthorizationRulesHandleResponse(resp *http.Response) (NamespacesListAuthorizationRulesResponse, error) { result := NamespacesListAuthorizationRulesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRuleListResult); err != nil { - return NamespacesListAuthorizationRulesResponse{}, err + return NamespacesListAuthorizationRulesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -783,7 +790,7 @@ func (client *NamespacesClient) listByResourceGroupCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -793,7 +800,7 @@ func (client *NamespacesClient) listByResourceGroupCreateRequest(ctx context.Con func (client *NamespacesClient) listByResourceGroupHandleResponse(resp *http.Response) (NamespacesListByResourceGroupResponse, error) { result := NamespacesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EHNamespaceListResult); err != nil { - return NamespacesListByResourceGroupResponse{}, err + return NamespacesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -852,7 +859,7 @@ func (client *NamespacesClient) listKeysCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -862,7 +869,7 @@ func (client *NamespacesClient) listKeysCreateRequest(ctx context.Context, resou func (client *NamespacesClient) listKeysHandleResponse(resp *http.Response) (NamespacesListKeysResponse, error) { result := NamespacesListKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { - return NamespacesListKeysResponse{}, err + return NamespacesListKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -880,6 +887,71 @@ func (client *NamespacesClient) listKeysHandleError(resp *http.Response) error { return runtime.NewResponseError(&errType, resp) } +// ListNetworkRuleSet - Gets NetworkRuleSet for a Namespace. +// If the operation fails it returns the *ErrorResponse error type. +func (client *NamespacesClient) ListNetworkRuleSet(ctx context.Context, resourceGroupName string, namespaceName string, options *NamespacesListNetworkRuleSetOptions) (NamespacesListNetworkRuleSetResponse, error) { + req, err := client.listNetworkRuleSetCreateRequest(ctx, resourceGroupName, namespaceName, options) + if err != nil { + return NamespacesListNetworkRuleSetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return NamespacesListNetworkRuleSetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return NamespacesListNetworkRuleSetResponse{}, client.listNetworkRuleSetHandleError(resp) + } + return client.listNetworkRuleSetHandleResponse(resp) +} + +// listNetworkRuleSetCreateRequest creates the ListNetworkRuleSet request. +func (client *NamespacesClient) listNetworkRuleSetCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, options *NamespacesListNetworkRuleSetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/networkRuleSets" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listNetworkRuleSetHandleResponse handles the ListNetworkRuleSet response. +func (client *NamespacesClient) listNetworkRuleSetHandleResponse(resp *http.Response) (NamespacesListNetworkRuleSetResponse, error) { + result := NamespacesListNetworkRuleSetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.NetworkRuleSetListResult); err != nil { + return NamespacesListNetworkRuleSetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listNetworkRuleSetHandleError handles the ListNetworkRuleSet error response. +func (client *NamespacesClient) listNetworkRuleSetHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + // RegenerateKeys - Regenerates the primary or secondary connection strings for the specified Namespace. // If the operation fails it returns the *ErrorResponse error type. func (client *NamespacesClient) RegenerateKeys(ctx context.Context, resourceGroupName string, namespaceName string, authorizationRuleName string, parameters RegenerateAccessKeyParameters, options *NamespacesRegenerateKeysOptions) (NamespacesRegenerateKeysResponse, error) { @@ -921,7 +993,7 @@ func (client *NamespacesClient) regenerateKeysCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -931,7 +1003,7 @@ func (client *NamespacesClient) regenerateKeysCreateRequest(ctx context.Context, func (client *NamespacesClient) regenerateKeysHandleResponse(resp *http.Response) (NamespacesRegenerateKeysResponse, error) { result := NamespacesRegenerateKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { - return NamespacesRegenerateKeysResponse{}, err + return NamespacesRegenerateKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -986,7 +1058,7 @@ func (client *NamespacesClient) updateCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -996,7 +1068,7 @@ func (client *NamespacesClient) updateCreateRequest(ctx context.Context, resourc func (client *NamespacesClient) updateHandleResponse(resp *http.Response) (NamespacesUpdateResponse, error) { result := NamespacesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EHNamespace); err != nil { - return NamespacesUpdateResponse{}, err + return NamespacesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_operations_client.go b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_operations_client.go index ff954354ad7f..421b6a9c909b 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_operations_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armeventhub import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available Event Hub REST API operations. @@ -52,7 +60,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_pagers.go b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_pagers.go index 4726612beb1b..2d2fd942ead2 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_pagers.go +++ b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armeventhub import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // ClustersListByResourceGroupPager provides operations for iterating over paged responses. @@ -664,3 +663,57 @@ func (p *PrivateEndpointConnectionsListPager) NextPage(ctx context.Context) bool func (p *PrivateEndpointConnectionsListPager) PageResponse() PrivateEndpointConnectionsListResponse { return p.current } + +// SchemaRegistryListByNamespacePager provides operations for iterating over paged responses. +type SchemaRegistryListByNamespacePager struct { + client *SchemaRegistryClient + current SchemaRegistryListByNamespaceResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, SchemaRegistryListByNamespaceResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *SchemaRegistryListByNamespacePager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *SchemaRegistryListByNamespacePager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.SchemaGroupListResult.NextLink == nil || len(*p.current.SchemaGroupListResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByNamespaceHandleError(resp) + return false + } + result, err := p.client.listByNamespaceHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current SchemaRegistryListByNamespaceResponse page. +func (p *SchemaRegistryListByNamespacePager) PageResponse() SchemaRegistryListByNamespaceResponse { + return p.current +} diff --git a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_pollers.go b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_pollers.go index e99bf5d3eb3f..f8688e296252 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_pollers.go +++ b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armeventhub import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // ClustersCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_privateendpointconnections_client.go index 75ac29e068f6..e17747ad7fae 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_privateendpointconnections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. @@ -31,8 +31,15 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { - return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates PrivateEndpointConnections of service namespace. @@ -76,7 +83,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -86,7 +93,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx func (client *PrivateEndpointConnectionsClient) createOrUpdateHandleResponse(resp *http.Response) (PrivateEndpointConnectionsCreateOrUpdateResponse, error) { result := PrivateEndpointConnectionsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsCreateOrUpdateResponse{}, err + return PrivateEndpointConnectionsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -165,7 +172,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -225,7 +232,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -235,7 +242,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsGetResponse{}, err + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -287,7 +294,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -297,7 +304,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListResponse, error) { result := PrivateEndpointConnectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionsListResponse{}, err + return PrivateEndpointConnectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_privatelinkresources_client.go index 0033b5a5403a..27320140008e 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_privatelinkresources_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. @@ -30,8 +31,15 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { - return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets lists of resources that supports Privatelinks. @@ -71,7 +79,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-06-01-preview") + reqQP.Set("api-version", "2021-11-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -81,7 +89,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesGetResponse, error) { result := PrivateLinkResourcesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourcesListResult); err != nil { - return PrivateLinkResourcesGetResponse{}, err + return PrivateLinkResourcesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_response_types.go b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_response_types.go index f8942bcac37c..428cf6d396f6 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_response_types.go +++ b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armeventhub import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // ClustersCreateOrUpdatePollerResponse contains the response from method Clusters.CreateOrUpdate. @@ -26,6 +25,8 @@ type ClustersCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ClustersCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClustersCreateOrUpdateResponse, error) { respType := ClustersCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Cluster) @@ -76,6 +77,8 @@ type ClustersDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ClustersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClustersDeleteResponse, error) { respType := ClustersDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -180,6 +183,8 @@ type ClustersUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ClustersUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClustersUpdateResponse, error) { respType := ClustersUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Cluster) @@ -542,6 +547,8 @@ type NamespacesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NamespacesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NamespacesCreateOrUpdateResponse, error) { respType := NamespacesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.EHNamespace) @@ -598,6 +605,8 @@ type NamespacesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NamespacesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NamespacesDeleteResponse, error) { respType := NamespacesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -704,6 +713,18 @@ type NamespacesListKeysResult struct { AccessKeys } +// NamespacesListNetworkRuleSetResponse contains the response from method Namespaces.ListNetworkRuleSet. +type NamespacesListNetworkRuleSetResponse struct { + NamespacesListNetworkRuleSetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// NamespacesListNetworkRuleSetResult contains the result from method Namespaces.ListNetworkRuleSet. +type NamespacesListNetworkRuleSetResult struct { + NetworkRuleSetListResult +} + // NamespacesListResponse contains the response from method Namespaces.List. type NamespacesListResponse struct { NamespacesListResult @@ -774,6 +795,8 @@ type PrivateEndpointConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsDeleteResponse, error) { respType := PrivateEndpointConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -843,3 +866,45 @@ type PrivateLinkResourcesGetResponse struct { type PrivateLinkResourcesGetResult struct { PrivateLinkResourcesListResult } + +// SchemaRegistryCreateOrUpdateResponse contains the response from method SchemaRegistry.CreateOrUpdate. +type SchemaRegistryCreateOrUpdateResponse struct { + SchemaRegistryCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SchemaRegistryCreateOrUpdateResult contains the result from method SchemaRegistry.CreateOrUpdate. +type SchemaRegistryCreateOrUpdateResult struct { + SchemaGroup +} + +// SchemaRegistryDeleteResponse contains the response from method SchemaRegistry.Delete. +type SchemaRegistryDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SchemaRegistryGetResponse contains the response from method SchemaRegistry.Get. +type SchemaRegistryGetResponse struct { + SchemaRegistryGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SchemaRegistryGetResult contains the result from method SchemaRegistry.Get. +type SchemaRegistryGetResult struct { + SchemaGroup +} + +// SchemaRegistryListByNamespaceResponse contains the response from method SchemaRegistry.ListByNamespace. +type SchemaRegistryListByNamespaceResponse struct { + SchemaRegistryListByNamespaceResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SchemaRegistryListByNamespaceResult contains the result from method SchemaRegistry.ListByNamespace. +type SchemaRegistryListByNamespaceResult struct { + SchemaGroupListResult +} diff --git a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_schemaregistry_client.go b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_schemaregistry_client.go new file mode 100644 index 000000000000..cfdb08623286 --- /dev/null +++ b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_schemaregistry_client.go @@ -0,0 +1,310 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armeventhub + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" +) + +// SchemaRegistryClient contains the methods for the SchemaRegistry group. +// Don't use this type directly, use NewSchemaRegistryClient() instead. +type SchemaRegistryClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewSchemaRegistryClient creates a new instance of SchemaRegistryClient with the specified values. +func NewSchemaRegistryClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SchemaRegistryClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SchemaRegistryClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// CreateOrUpdate - +// If the operation fails it returns the *ErrorResponse error type. +func (client *SchemaRegistryClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, namespaceName string, schemaGroupName string, parameters SchemaGroup, options *SchemaRegistryCreateOrUpdateOptions) (SchemaRegistryCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, namespaceName, schemaGroupName, parameters, options) + if err != nil { + return SchemaRegistryCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SchemaRegistryCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SchemaRegistryCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SchemaRegistryClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, schemaGroupName string, parameters SchemaGroup, options *SchemaRegistryCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/schemagroups/{schemaGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if schemaGroupName == "" { + return nil, errors.New("parameter schemaGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schemaGroupName}", url.PathEscape(schemaGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *SchemaRegistryClient) createOrUpdateHandleResponse(resp *http.Response) (SchemaRegistryCreateOrUpdateResponse, error) { + result := SchemaRegistryCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SchemaGroup); err != nil { + return SchemaRegistryCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *SchemaRegistryClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Delete - +// If the operation fails it returns the *ErrorResponse error type. +func (client *SchemaRegistryClient) Delete(ctx context.Context, resourceGroupName string, namespaceName string, schemaGroupName string, options *SchemaRegistryDeleteOptions) (SchemaRegistryDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, namespaceName, schemaGroupName, options) + if err != nil { + return SchemaRegistryDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SchemaRegistryDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return SchemaRegistryDeleteResponse{}, client.deleteHandleError(resp) + } + return SchemaRegistryDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SchemaRegistryClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, schemaGroupName string, options *SchemaRegistryDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/schemagroups/{schemaGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if schemaGroupName == "" { + return nil, errors.New("parameter schemaGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schemaGroupName}", url.PathEscape(schemaGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *SchemaRegistryClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - +// If the operation fails it returns the *ErrorResponse error type. +func (client *SchemaRegistryClient) Get(ctx context.Context, resourceGroupName string, namespaceName string, schemaGroupName string, options *SchemaRegistryGetOptions) (SchemaRegistryGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, namespaceName, schemaGroupName, options) + if err != nil { + return SchemaRegistryGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SchemaRegistryGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SchemaRegistryGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SchemaRegistryClient) getCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, schemaGroupName string, options *SchemaRegistryGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/schemagroups/{schemaGroupName}" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if schemaGroupName == "" { + return nil, errors.New("parameter schemaGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{schemaGroupName}", url.PathEscape(schemaGroupName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-11-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SchemaRegistryClient) getHandleResponse(resp *http.Response) (SchemaRegistryGetResponse, error) { + result := SchemaRegistryGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SchemaGroup); err != nil { + return SchemaRegistryGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *SchemaRegistryClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByNamespace - Gets all the Schema Groups in a Namespace. +// If the operation fails it returns the *ErrorResponse error type. +func (client *SchemaRegistryClient) ListByNamespace(resourceGroupName string, namespaceName string, options *SchemaRegistryListByNamespaceOptions) *SchemaRegistryListByNamespacePager { + return &SchemaRegistryListByNamespacePager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByNamespaceCreateRequest(ctx, resourceGroupName, namespaceName, options) + }, + advancer: func(ctx context.Context, resp SchemaRegistryListByNamespaceResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.SchemaGroupListResult.NextLink) + }, + } +} + +// listByNamespaceCreateRequest creates the ListByNamespace request. +func (client *SchemaRegistryClient) listByNamespaceCreateRequest(ctx context.Context, resourceGroupName string, namespaceName string, options *SchemaRegistryListByNamespaceOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.EventHub/namespaces/{namespaceName}/schemagroups" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if namespaceName == "" { + return nil, errors.New("parameter namespaceName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{namespaceName}", url.PathEscape(namespaceName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-11-01") + if options != nil && options.Skip != nil { + reqQP.Set("$skip", strconv.FormatInt(int64(*options.Skip), 10)) + } + if options != nil && options.Top != nil { + reqQP.Set("$top", strconv.FormatInt(int64(*options.Top), 10)) + } + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByNamespaceHandleResponse handles the ListByNamespace response. +func (client *SchemaRegistryClient) listByNamespaceHandleResponse(resp *http.Response) (SchemaRegistryListByNamespaceResponse, error) { + result := SchemaRegistryListByNamespaceResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SchemaGroupListResult); err != nil { + return SchemaRegistryListByNamespaceResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByNamespaceHandleError handles the ListByNamespace error response. +func (client *SchemaRegistryClient) listByNamespaceHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := ErrorResponse{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_time_rfc3339.go b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_time_rfc3339.go index 2a4ba39a2a72..9af5c61bf5c6 100644 --- a/sdk/resourcemanager/eventhub/armeventhub/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/eventhub/armeventhub/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armeventhub import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/iothub/armiothub/CHANGELOG.md b/sdk/resourcemanager/iothub/armiothub/CHANGELOG.md index 6cd92f6efa2d..149cd6a27361 100644 --- a/sdk/resourcemanager/iothub/armiothub/CHANGELOG.md +++ b/sdk/resourcemanager/iothub/armiothub/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-18) diff --git a/sdk/resourcemanager/iothub/armiothub/README.md b/sdk/resourcemanager/iothub/armiothub/README.md index 36be55aaf066..4f8edefc7b9f 100644 --- a/sdk/resourcemanager/iothub/armiothub/README.md +++ b/sdk/resourcemanager/iothub/armiothub/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure IoT Hub +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure IoT Hub modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armiothub.NewIotHubResourceClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure IoT Hub modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armiothub.NewIotHubResourceClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armiothub.NewIotHubResourceClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/iothub/armiothub/autorest.md b/sdk/resourcemanager/iothub/armiothub/autorest.md index d2ef2c1d94ea..3c833ff3647e 100644 --- a/sdk/resourcemanager/iothub/armiothub/autorest.md +++ b/sdk/resourcemanager/iothub/armiothub/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/a7e864e0ea1b7a3133d3f1def968985d117aa2f2/specification/iothub/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/a7e864e0ea1b7a3133d3f1def968985d117aa2f2/specification/iothub/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/iothub/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/iothub/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.1 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/iothub/armiothub/go.mod b/sdk/resourcemanager/iothub/armiothub/go.mod index c0f0900aeb4a..11fda12a4ea3 100644 --- a/sdk/resourcemanager/iothub/armiothub/go.mod +++ b/sdk/resourcemanager/iothub/armiothub/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/iothub/armiothub go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.1.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/iothub/armiothub/go.sum b/sdk/resourcemanager/iothub/armiothub/go.sum index f37ba2aef08b..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/iothub/armiothub/go.sum +++ b/sdk/resourcemanager/iothub/armiothub/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible h1:WFsr3Efy7uweykOAEfOHO3ACtuwIv+rrFmSn9K48VnA= -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_certificates_client.go b/sdk/resourcemanager/iothub/armiothub/zz_generated_certificates_client.go index ecc5ffe665f8..d075b3bebf8c 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_certificates_client.go +++ b/sdk/resourcemanager/iothub/armiothub/zz_generated_certificates_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CertificatesClient contains the methods for the Certificates group. @@ -30,8 +31,15 @@ type CertificatesClient struct { } // NewCertificatesClient creates a new instance of CertificatesClient with the specified values. -func NewCertificatesClient(con *arm.Connection, subscriptionID string) *CertificatesClient { - return &CertificatesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CertificatesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CertificatesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Adds new or replaces existing certificate. @@ -88,7 +96,7 @@ func (client *CertificatesClient) createOrUpdateCreateRequest(ctx context.Contex func (client *CertificatesClient) createOrUpdateHandleResponse(resp *http.Response) (CertificatesCreateOrUpdateResponse, error) { result := CertificatesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CertificateDescription); err != nil { - return CertificatesCreateOrUpdateResponse{}, err + return CertificatesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -219,7 +227,7 @@ func (client *CertificatesClient) generateVerificationCodeCreateRequest(ctx cont func (client *CertificatesClient) generateVerificationCodeHandleResponse(resp *http.Response) (CertificatesGenerateVerificationCodeResponse, error) { result := CertificatesGenerateVerificationCodeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CertificateWithNonceDescription); err != nil { - return CertificatesGenerateVerificationCodeResponse{}, err + return CertificatesGenerateVerificationCodeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -288,7 +296,7 @@ func (client *CertificatesClient) getCreateRequest(ctx context.Context, resource func (client *CertificatesClient) getHandleResponse(resp *http.Response) (CertificatesGetResponse, error) { result := CertificatesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CertificateDescription); err != nil { - return CertificatesGetResponse{}, err + return CertificatesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -353,7 +361,7 @@ func (client *CertificatesClient) listByIotHubCreateRequest(ctx context.Context, func (client *CertificatesClient) listByIotHubHandleResponse(resp *http.Response) (CertificatesListByIotHubResponse, error) { result := CertificatesListByIotHubResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CertificateListDescription); err != nil { - return CertificatesListByIotHubResponse{}, err + return CertificatesListByIotHubResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -423,7 +431,7 @@ func (client *CertificatesClient) verifyCreateRequest(ctx context.Context, resou func (client *CertificatesClient) verifyHandleResponse(resp *http.Response) (CertificatesVerifyResponse, error) { result := CertificatesVerifyResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CertificateDescription); err != nil { - return CertificatesVerifyResponse{}, err + return CertificatesVerifyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_constants.go b/sdk/resourcemanager/iothub/armiothub/zz_generated_constants.go index 1e4b9cf4ef19..8cbd571e7cdd 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_constants.go +++ b/sdk/resourcemanager/iothub/armiothub/zz_generated_constants.go @@ -10,7 +10,7 @@ package armiothub const ( module = "armiothub" - version = "v0.1.1" + version = "v0.2.0" ) // AccessRights - The permissions assigned to the shared access policy. diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_iothub_client.go b/sdk/resourcemanager/iothub/armiothub/zz_generated_iothub_client.go index d9bdba25a1fc..ac8ee531ff19 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_iothub_client.go +++ b/sdk/resourcemanager/iothub/armiothub/zz_generated_iothub_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // IotHubClient contains the methods for the IotHub group. @@ -31,8 +31,15 @@ type IotHubClient struct { } // NewIotHubClient creates a new instance of IotHubClient with the specified values. -func NewIotHubClient(con *arm.Connection, subscriptionID string) *IotHubClient { - return &IotHubClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIotHubClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IotHubClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IotHubClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginManualFailover - Manually initiate a failover for the IoT Hub to its secondary region. To learn more, see https://aka.ms/manualfailover diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_iothubresource_client.go b/sdk/resourcemanager/iothub/armiothub/zz_generated_iothubresource_client.go index 37a3a00eff47..cba5dbcd93cb 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_iothubresource_client.go +++ b/sdk/resourcemanager/iothub/armiothub/zz_generated_iothubresource_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // IotHubResourceClient contains the methods for the IotHubResource group. @@ -31,8 +31,15 @@ type IotHubResourceClient struct { } // NewIotHubResourceClient creates a new instance of IotHubResourceClient with the specified values. -func NewIotHubResourceClient(con *arm.Connection, subscriptionID string) *IotHubResourceClient { - return &IotHubResourceClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIotHubResourceClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IotHubResourceClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IotHubResourceClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNameAvailability - Check if an IoT hub name is available. @@ -74,7 +81,7 @@ func (client *IotHubResourceClient) checkNameAvailabilityCreateRequest(ctx conte func (client *IotHubResourceClient) checkNameAvailabilityHandleResponse(resp *http.Response) (IotHubResourceCheckNameAvailabilityResponse, error) { result := IotHubResourceCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IotHubNameAvailabilityInfo); err != nil { - return IotHubResourceCheckNameAvailabilityResponse{}, err + return IotHubResourceCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -147,7 +154,7 @@ func (client *IotHubResourceClient) createEventHubConsumerGroupCreateRequest(ctx func (client *IotHubResourceClient) createEventHubConsumerGroupHandleResponse(resp *http.Response) (IotHubResourceCreateEventHubConsumerGroupResponse, error) { result := IotHubResourceCreateEventHubConsumerGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventHubConsumerGroupInfo); err != nil { - return IotHubResourceCreateEventHubConsumerGroupResponse{}, err + return IotHubResourceCreateEventHubConsumerGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -438,7 +445,7 @@ func (client *IotHubResourceClient) exportDevicesCreateRequest(ctx context.Conte func (client *IotHubResourceClient) exportDevicesHandleResponse(resp *http.Response) (IotHubResourceExportDevicesResponse, error) { result := IotHubResourceExportDevicesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobResponse); err != nil { - return IotHubResourceExportDevicesResponse{}, err + return IotHubResourceExportDevicesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -503,7 +510,7 @@ func (client *IotHubResourceClient) getCreateRequest(ctx context.Context, resour func (client *IotHubResourceClient) getHandleResponse(resp *http.Response) (IotHubResourceGetResponse, error) { result := IotHubResourceGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IotHubDescription); err != nil { - return IotHubResourceGetResponse{}, err + return IotHubResourceGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -565,7 +572,7 @@ func (client *IotHubResourceClient) getEndpointHealthCreateRequest(ctx context.C func (client *IotHubResourceClient) getEndpointHealthHandleResponse(resp *http.Response) (IotHubResourceGetEndpointHealthResponse, error) { result := IotHubResourceGetEndpointHealthResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EndpointHealthDataListResult); err != nil { - return IotHubResourceGetEndpointHealthResponse{}, err + return IotHubResourceGetEndpointHealthResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -638,7 +645,7 @@ func (client *IotHubResourceClient) getEventHubConsumerGroupCreateRequest(ctx co func (client *IotHubResourceClient) getEventHubConsumerGroupHandleResponse(resp *http.Response) (IotHubResourceGetEventHubConsumerGroupResponse, error) { result := IotHubResourceGetEventHubConsumerGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventHubConsumerGroupInfo); err != nil { - return IotHubResourceGetEventHubConsumerGroupResponse{}, err + return IotHubResourceGetEventHubConsumerGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -707,7 +714,7 @@ func (client *IotHubResourceClient) getJobCreateRequest(ctx context.Context, res func (client *IotHubResourceClient) getJobHandleResponse(resp *http.Response) (IotHubResourceGetJobResponse, error) { result := IotHubResourceGetJobResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobResponse); err != nil { - return IotHubResourceGetJobResponse{}, err + return IotHubResourceGetJobResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -776,7 +783,7 @@ func (client *IotHubResourceClient) getKeysForKeyNameCreateRequest(ctx context.C func (client *IotHubResourceClient) getKeysForKeyNameHandleResponse(resp *http.Response) (IotHubResourceGetKeysForKeyNameResponse, error) { result := IotHubResourceGetKeysForKeyNameResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SharedAccessSignatureAuthorizationRule); err != nil { - return IotHubResourceGetKeysForKeyNameResponse{}, err + return IotHubResourceGetKeysForKeyNameResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -838,7 +845,7 @@ func (client *IotHubResourceClient) getQuotaMetricsCreateRequest(ctx context.Con func (client *IotHubResourceClient) getQuotaMetricsHandleResponse(resp *http.Response) (IotHubResourceGetQuotaMetricsResponse, error) { result := IotHubResourceGetQuotaMetricsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IotHubQuotaMetricInfoListResult); err != nil { - return IotHubResourceGetQuotaMetricsResponse{}, err + return IotHubResourceGetQuotaMetricsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -903,7 +910,7 @@ func (client *IotHubResourceClient) getStatsCreateRequest(ctx context.Context, r func (client *IotHubResourceClient) getStatsHandleResponse(resp *http.Response) (IotHubResourceGetStatsResponse, error) { result := IotHubResourceGetStatsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RegistryStatistics); err != nil { - return IotHubResourceGetStatsResponse{}, err + return IotHubResourceGetStatsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -965,7 +972,7 @@ func (client *IotHubResourceClient) getValidSKUsCreateRequest(ctx context.Contex func (client *IotHubResourceClient) getValidSKUsHandleResponse(resp *http.Response) (IotHubResourceGetValidSKUsResponse, error) { result := IotHubResourceGetValidSKUsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IotHubSKUDescriptionListResult); err != nil { - return IotHubResourceGetValidSKUsResponse{}, err + return IotHubResourceGetValidSKUsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1031,7 +1038,7 @@ func (client *IotHubResourceClient) importDevicesCreateRequest(ctx context.Conte func (client *IotHubResourceClient) importDevicesHandleResponse(resp *http.Response) (IotHubResourceImportDevicesResponse, error) { result := IotHubResourceImportDevicesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobResponse); err != nil { - return IotHubResourceImportDevicesResponse{}, err + return IotHubResourceImportDevicesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1089,7 +1096,7 @@ func (client *IotHubResourceClient) listByResourceGroupCreateRequest(ctx context func (client *IotHubResourceClient) listByResourceGroupHandleResponse(resp *http.Response) (IotHubResourceListByResourceGroupResponse, error) { result := IotHubResourceListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IotHubDescriptionListResult); err != nil { - return IotHubResourceListByResourceGroupResponse{}, err + return IotHubResourceListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1143,7 +1150,7 @@ func (client *IotHubResourceClient) listBySubscriptionCreateRequest(ctx context. func (client *IotHubResourceClient) listBySubscriptionHandleResponse(resp *http.Response) (IotHubResourceListBySubscriptionResponse, error) { result := IotHubResourceListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IotHubDescriptionListResult); err != nil { - return IotHubResourceListBySubscriptionResponse{}, err + return IotHubResourceListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1209,7 +1216,7 @@ func (client *IotHubResourceClient) listEventHubConsumerGroupsCreateRequest(ctx func (client *IotHubResourceClient) listEventHubConsumerGroupsHandleResponse(resp *http.Response) (IotHubResourceListEventHubConsumerGroupsResponse, error) { result := IotHubResourceListEventHubConsumerGroupsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventHubConsumerGroupsListResult); err != nil { - return IotHubResourceListEventHubConsumerGroupsResponse{}, err + return IotHubResourceListEventHubConsumerGroupsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1271,7 +1278,7 @@ func (client *IotHubResourceClient) listJobsCreateRequest(ctx context.Context, r func (client *IotHubResourceClient) listJobsHandleResponse(resp *http.Response) (IotHubResourceListJobsResponse, error) { result := IotHubResourceListJobsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobResponseListResult); err != nil { - return IotHubResourceListJobsResponse{}, err + return IotHubResourceListJobsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1333,7 +1340,7 @@ func (client *IotHubResourceClient) listKeysCreateRequest(ctx context.Context, r func (client *IotHubResourceClient) listKeysHandleResponse(resp *http.Response) (IotHubResourceListKeysResponse, error) { result := IotHubResourceListKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SharedAccessSignatureAuthorizationRuleListResult); err != nil { - return IotHubResourceListKeysResponse{}, err + return IotHubResourceListKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1398,7 +1405,7 @@ func (client *IotHubResourceClient) testAllRoutesCreateRequest(ctx context.Conte func (client *IotHubResourceClient) testAllRoutesHandleResponse(resp *http.Response) (IotHubResourceTestAllRoutesResponse, error) { result := IotHubResourceTestAllRoutesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TestAllRoutesResult); err != nil { - return IotHubResourceTestAllRoutesResponse{}, err + return IotHubResourceTestAllRoutesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1463,7 +1470,7 @@ func (client *IotHubResourceClient) testRouteCreateRequest(ctx context.Context, func (client *IotHubResourceClient) testRouteHandleResponse(resp *http.Response) (IotHubResourceTestRouteResponse, error) { result := IotHubResourceTestRouteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TestRouteResult); err != nil { - return IotHubResourceTestRouteResponse{}, err + return IotHubResourceTestRouteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_models.go b/sdk/resourcemanager/iothub/armiothub/zz_generated_models.go index 6d759d2aa212..d5325067b2ae 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_models.go +++ b/sdk/resourcemanager/iothub/armiothub/zz_generated_models.go @@ -10,10 +10,9 @@ package armiothub import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) type ArmIdentity struct { @@ -118,12 +117,12 @@ type CertificateProperties struct { func (c CertificateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "certificate", c.Certificate) - populate(objectMap, "created", (*timeRFC1123)(c.Created)) - populate(objectMap, "expiry", (*timeRFC1123)(c.Expiry)) + populateTimeRFC1123(objectMap, "created", c.Created) + populateTimeRFC1123(objectMap, "expiry", c.Expiry) populate(objectMap, "isVerified", c.IsVerified) populate(objectMap, "subject", c.Subject) populate(objectMap, "thumbprint", c.Thumbprint) - populate(objectMap, "updated", (*timeRFC1123)(c.Updated)) + populateTimeRFC1123(objectMap, "updated", c.Updated) return json.Marshal(objectMap) } @@ -140,14 +139,10 @@ func (c *CertificateProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.Certificate) delete(rawMsg, key) case "created": - var aux timeRFC1123 - err = unpopulate(val, &aux) - c.Created = (*time.Time)(&aux) + err = unpopulateTimeRFC1123(val, &c.Created) delete(rawMsg, key) case "expiry": - var aux timeRFC1123 - err = unpopulate(val, &aux) - c.Expiry = (*time.Time)(&aux) + err = unpopulateTimeRFC1123(val, &c.Expiry) delete(rawMsg, key) case "isVerified": err = unpopulate(val, &c.IsVerified) @@ -159,9 +154,7 @@ func (c *CertificateProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.Thumbprint) delete(rawMsg, key) case "updated": - var aux timeRFC1123 - err = unpopulate(val, &aux) - c.Updated = (*time.Time)(&aux) + err = unpopulateTimeRFC1123(val, &c.Updated) delete(rawMsg, key) } if err != nil { @@ -202,12 +195,12 @@ type CertificatePropertiesWithNonce struct { func (c CertificatePropertiesWithNonce) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "certificate", c.Certificate) - populate(objectMap, "created", (*timeRFC1123)(c.Created)) - populate(objectMap, "expiry", (*timeRFC1123)(c.Expiry)) + populateTimeRFC1123(objectMap, "created", c.Created) + populateTimeRFC1123(objectMap, "expiry", c.Expiry) populate(objectMap, "isVerified", c.IsVerified) populate(objectMap, "subject", c.Subject) populate(objectMap, "thumbprint", c.Thumbprint) - populate(objectMap, "updated", (*timeRFC1123)(c.Updated)) + populateTimeRFC1123(objectMap, "updated", c.Updated) populate(objectMap, "verificationCode", c.VerificationCode) return json.Marshal(objectMap) } @@ -225,14 +218,10 @@ func (c *CertificatePropertiesWithNonce) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.Certificate) delete(rawMsg, key) case "created": - var aux timeRFC1123 - err = unpopulate(val, &aux) - c.Created = (*time.Time)(&aux) + err = unpopulateTimeRFC1123(val, &c.Created) delete(rawMsg, key) case "expiry": - var aux timeRFC1123 - err = unpopulate(val, &aux) - c.Expiry = (*time.Time)(&aux) + err = unpopulateTimeRFC1123(val, &c.Expiry) delete(rawMsg, key) case "isVerified": err = unpopulate(val, &c.IsVerified) @@ -244,9 +233,7 @@ func (c *CertificatePropertiesWithNonce) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.Thumbprint) delete(rawMsg, key) case "updated": - var aux timeRFC1123 - err = unpopulate(val, &aux) - c.Updated = (*time.Time)(&aux) + err = unpopulateTimeRFC1123(val, &c.Updated) delete(rawMsg, key) case "verificationCode": err = unpopulate(val, &c.VerificationCode) @@ -360,9 +347,9 @@ func (e EndpointHealthData) MarshalJSON() ([]byte, error) { populate(objectMap, "endpointId", e.EndpointID) populate(objectMap, "healthStatus", e.HealthStatus) populate(objectMap, "lastKnownError", e.LastKnownError) - populate(objectMap, "lastKnownErrorTime", (*timeRFC1123)(e.LastKnownErrorTime)) - populate(objectMap, "lastSendAttemptTime", (*timeRFC1123)(e.LastSendAttemptTime)) - populate(objectMap, "lastSuccessfulSendAttemptTime", (*timeRFC1123)(e.LastSuccessfulSendAttemptTime)) + populateTimeRFC1123(objectMap, "lastKnownErrorTime", e.LastKnownErrorTime) + populateTimeRFC1123(objectMap, "lastSendAttemptTime", e.LastSendAttemptTime) + populateTimeRFC1123(objectMap, "lastSuccessfulSendAttemptTime", e.LastSuccessfulSendAttemptTime) return json.Marshal(objectMap) } @@ -385,19 +372,13 @@ func (e *EndpointHealthData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.LastKnownError) delete(rawMsg, key) case "lastKnownErrorTime": - var aux timeRFC1123 - err = unpopulate(val, &aux) - e.LastKnownErrorTime = (*time.Time)(&aux) + err = unpopulateTimeRFC1123(val, &e.LastKnownErrorTime) delete(rawMsg, key) case "lastSendAttemptTime": - var aux timeRFC1123 - err = unpopulate(val, &aux) - e.LastSendAttemptTime = (*time.Time)(&aux) + err = unpopulateTimeRFC1123(val, &e.LastSendAttemptTime) delete(rawMsg, key) case "lastSuccessfulSendAttemptTime": - var aux timeRFC1123 - err = unpopulate(val, &aux) - e.LastSuccessfulSendAttemptTime = (*time.Time)(&aux) + err = unpopulateTimeRFC1123(val, &e.LastSuccessfulSendAttemptTime) delete(rawMsg, key) } if err != nil { @@ -1113,11 +1094,11 @@ type JobResponse struct { // MarshalJSON implements the json.Marshaller interface for type JobResponse. func (j JobResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "endTimeUtc", (*timeRFC1123)(j.EndTimeUTC)) + populateTimeRFC1123(objectMap, "endTimeUtc", j.EndTimeUTC) populate(objectMap, "failureReason", j.FailureReason) populate(objectMap, "jobId", j.JobID) populate(objectMap, "parentJobId", j.ParentJobID) - populate(objectMap, "startTimeUtc", (*timeRFC1123)(j.StartTimeUTC)) + populateTimeRFC1123(objectMap, "startTimeUtc", j.StartTimeUTC) populate(objectMap, "status", j.Status) populate(objectMap, "statusMessage", j.StatusMessage) populate(objectMap, "type", j.Type) @@ -1134,9 +1115,7 @@ func (j *JobResponse) UnmarshalJSON(data []byte) error { var err error switch key { case "endTimeUtc": - var aux timeRFC1123 - err = unpopulate(val, &aux) - j.EndTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC1123(val, &j.EndTimeUTC) delete(rawMsg, key) case "failureReason": err = unpopulate(val, &j.FailureReason) @@ -1148,9 +1127,7 @@ func (j *JobResponse) UnmarshalJSON(data []byte) error { err = unpopulate(val, &j.ParentJobID) delete(rawMsg, key) case "startTimeUtc": - var aux timeRFC1123 - err = unpopulate(val, &aux) - j.StartTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC1123(val, &j.StartTimeUTC) delete(rawMsg, key) case "status": err = unpopulate(val, &j.Status) diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_operations_client.go b/sdk/resourcemanager/iothub/armiothub/zz_generated_operations_client.go index 4d3797972467..bdb7f9661fac 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_operations_client.go +++ b/sdk/resourcemanager/iothub/armiothub/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armiothub import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available IoT Hub REST API operations. @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_pagers.go b/sdk/resourcemanager/iothub/armiothub/zz_generated_pagers.go index 8d670667daa9..89e0692daef4 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_pagers.go +++ b/sdk/resourcemanager/iothub/armiothub/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armiothub import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // IotHubResourceGetEndpointHealthPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_pollers.go b/sdk/resourcemanager/iothub/armiothub/zz_generated_pollers.go index 9c6eba4cd484..a5363ad945d9 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_pollers.go +++ b/sdk/resourcemanager/iothub/armiothub/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armiothub import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // IotHubManualFailoverPoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/iothub/armiothub/zz_generated_privateendpointconnections_client.go index a430cb13b59a..2b3bd96a5fed 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/iothub/armiothub/zz_generated_privateendpointconnections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. @@ -31,8 +31,15 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { - return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginDelete - Delete private endpoint connection with the specified name @@ -166,7 +173,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsGetResponse{}, err + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -231,7 +238,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListResponse, error) { result := PrivateEndpointConnectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionArray); err != nil { - return PrivateEndpointConnectionsListResponse{}, err + return PrivateEndpointConnectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/iothub/armiothub/zz_generated_privatelinkresources_client.go index ca61204fb391..f652348991cb 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/iothub/armiothub/zz_generated_privatelinkresources_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. @@ -30,8 +31,15 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { - return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get the specified private link resource for the given IotHub @@ -85,7 +93,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesGetResponse, error) { result := PrivateLinkResourcesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GroupIDInformation); err != nil { - return PrivateLinkResourcesGetResponse{}, err + return PrivateLinkResourcesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -150,7 +158,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, func (client *PrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (PrivateLinkResourcesListResponse, error) { result := PrivateLinkResourcesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResources); err != nil { - return PrivateLinkResourcesListResponse{}, err + return PrivateLinkResourcesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_resourceprovidercommon_client.go b/sdk/resourcemanager/iothub/armiothub/zz_generated_resourceprovidercommon_client.go index 2ee32b7b4653..19ac36181a82 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_resourceprovidercommon_client.go +++ b/sdk/resourcemanager/iothub/armiothub/zz_generated_resourceprovidercommon_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ResourceProviderCommonClient contains the methods for the ResourceProviderCommon group. @@ -30,8 +31,15 @@ type ResourceProviderCommonClient struct { } // NewResourceProviderCommonClient creates a new instance of ResourceProviderCommonClient with the specified values. -func NewResourceProviderCommonClient(con *arm.Connection, subscriptionID string) *ResourceProviderCommonClient { - return &ResourceProviderCommonClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewResourceProviderCommonClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ResourceProviderCommonClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ResourceProviderCommonClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetSubscriptionQuota - Get the number of free and paid iot hubs in the subscription @@ -73,7 +81,7 @@ func (client *ResourceProviderCommonClient) getSubscriptionQuotaCreateRequest(ct func (client *ResourceProviderCommonClient) getSubscriptionQuotaHandleResponse(resp *http.Response) (ResourceProviderCommonGetSubscriptionQuotaResponse, error) { result := ResourceProviderCommonGetSubscriptionQuotaResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UserSubscriptionQuotaListResult); err != nil { - return ResourceProviderCommonGetSubscriptionQuotaResponse{}, err + return ResourceProviderCommonGetSubscriptionQuotaResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_response_types.go b/sdk/resourcemanager/iothub/armiothub/zz_generated_response_types.go index da7ce9360735..4fc782606afe 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_response_types.go +++ b/sdk/resourcemanager/iothub/armiothub/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armiothub import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // CertificatesCreateOrUpdateResponse contains the response from method Certificates.CreateOrUpdate. @@ -92,6 +91,8 @@ type IotHubManualFailoverPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l IotHubManualFailoverPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (IotHubManualFailoverResponse, error) { respType := IotHubManualFailoverResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -160,6 +161,8 @@ type IotHubResourceCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l IotHubResourceCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (IotHubResourceCreateOrUpdateResponse, error) { respType := IotHubResourceCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.IotHubDescription) @@ -216,6 +219,8 @@ type IotHubResourceDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l IotHubResourceDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (IotHubResourceDeleteResponse, error) { respType := IotHubResourceDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.IotHubDescription) @@ -470,6 +475,8 @@ type IotHubResourceUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l IotHubResourceUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (IotHubResourceUpdateResponse, error) { respType := IotHubResourceUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.IotHubDescription) @@ -532,6 +539,8 @@ type PrivateEndpointConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsDeleteResponse, error) { respType := PrivateEndpointConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) @@ -607,6 +616,8 @@ type PrivateEndpointConnectionsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsUpdateResponse, error) { respType := PrivateEndpointConnectionsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) diff --git a/sdk/resourcemanager/iothub/armiothub/zz_generated_time_rfc1123.go b/sdk/resourcemanager/iothub/armiothub/zz_generated_time_rfc1123.go index 0c601b152134..732209f247c6 100644 --- a/sdk/resourcemanager/iothub/armiothub/zz_generated_time_rfc1123.go +++ b/sdk/resourcemanager/iothub/armiothub/zz_generated_time_rfc1123.go @@ -9,6 +9,9 @@ package armiothub import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "strings" "time" ) @@ -40,3 +43,27 @@ func (t *timeRFC1123) UnmarshalText(data []byte) error { *t = timeRFC1123(p) return err } + +func populateTimeRFC1123(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC1123)(t) +} + +func unpopulateTimeRFC1123(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC1123 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md b/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md index a3c026ec81da..4a591cd3ada4 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md +++ b/sdk/resourcemanager/keyvault/armkeyvault/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-09-29) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/keyvault/armkeyvault") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/keyvault/armkeyvault/README.md b/sdk/resourcemanager/keyvault/armkeyvault/README.md index 5df081c0773b..88d81bd3acec 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/README.md +++ b/sdk/resourcemanager/keyvault/armkeyvault/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Key Vault +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Key Vault modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armkeyvault.NewKeysClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Key Vault modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armkeyvault.NewKeysClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armkeyvault.NewKeysClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/keyvault/armkeyvault/autorest.md b/sdk/resourcemanager/keyvault/armkeyvault/autorest.md index c6789992918f..569f433ff00c 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/autorest.md +++ b/sdk/resourcemanager/keyvault/armkeyvault/autorest.md @@ -5,10 +5,10 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7919a8694f46cea4259ea5b62b1e797573175e16/specification/keyvault/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7919a8694f46cea4259ea5b62b1e797573175e16/specification/keyvault/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/keyvault/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/keyvault/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 modelerfour: seal-single-value-enum-by-default: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/keyvault/armkeyvault/example_secrets_test.go b/sdk/resourcemanager/keyvault/armkeyvault/example_secrets_test.go index 745adcfae073..15cc04ada4ef 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/example_secrets_test.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/example_secrets_test.go @@ -10,7 +10,6 @@ import ( "context" "log" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" @@ -21,7 +20,7 @@ func ExampleSecretsClient_CreateOrUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armkeyvault.NewSecretsClient(arm.NewDefaultConnection(cred, nil), "") + client := armkeyvault.NewSecretsClient("", cred, nil) resp, err := client.CreateOrUpdate( context.Background(), "", diff --git a/sdk/resourcemanager/keyvault/armkeyvault/example_vaults_test.go b/sdk/resourcemanager/keyvault/armkeyvault/example_vaults_test.go index 2f93bb93560d..2b08515f6e7e 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/example_vaults_test.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/example_vaults_test.go @@ -11,7 +11,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvault" @@ -22,7 +21,7 @@ func ExampleVaultsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armkeyvault.NewVaultsClient(arm.NewDefaultConnection(cred, nil), "") + client := armkeyvault.NewVaultsClient("", cred, nil) poll, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -53,7 +52,7 @@ func ExampleVaultsClient_BeginCreateOrUpdate_withAccessPolicies() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armkeyvault.NewVaultsClient(arm.NewDefaultConnection(cred, nil), "") + client := armkeyvault.NewVaultsClient("", cred, nil) poll, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -100,7 +99,7 @@ func ExampleVaultsClient_BeginCreateOrUpdate_forDeployment() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armkeyvault.NewVaultsClient(arm.NewDefaultConnection(cred, nil), "") + client := armkeyvault.NewVaultsClient("", cred, nil) poll, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -149,7 +148,7 @@ func ExampleVaultsClient_Get() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armkeyvault.NewVaultsClient(arm.NewDefaultConnection(cred, nil), "") + client := armkeyvault.NewVaultsClient("subscription ID>", cred, nil) resp, err := client.Get(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to get the vault: %v", err) @@ -162,7 +161,7 @@ func ExampleVaultsClient_List() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armkeyvault.NewVaultsClient(arm.NewDefaultConnection(cred, nil), "") + client := armkeyvault.NewVaultsClient("", cred, nil) pager := client.List(nil) for pager.NextPage(context.Background()) { resp := pager.PageResponse() @@ -183,7 +182,7 @@ func ExampleVaultsClient_Delete() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armkeyvault.NewVaultsClient(arm.NewDefaultConnection(cred, nil), "") + client := armkeyvault.NewVaultsClient("", cred, nil) _, err = client.Delete(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to delete the vault: %v", err) diff --git a/sdk/resourcemanager/keyvault/armkeyvault/go.mod b/sdk/resourcemanager/keyvault/armkeyvault/go.mod index f5e43bfec4fe..fb04aa3ae45f 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/go.mod +++ b/sdk/resourcemanager/keyvault/armkeyvault/go.mod @@ -3,7 +3,9 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/keyvault/armkeyvaul go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.1.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0 ) + +replace github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0 => ../../../azidentity diff --git a/sdk/resourcemanager/keyvault/armkeyvault/go.sum b/sdk/resourcemanager/keyvault/armkeyvault/go.sum index c0f8422a0531..0a36ef05b718 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/go.sum +++ b/sdk/resourcemanager/keyvault/armkeyvault/go.sum @@ -1,15 +1,13 @@ -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible h1:WFsr3Efy7uweykOAEfOHO3ACtuwIv+rrFmSn9K48VnA= -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0 h1:OYa9vmRX2XC5GXRAzeggG12sF/z5D9Ahtdm9EJ00WN4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= @@ -19,22 +17,26 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_constants.go b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_constants.go index 46fc864c440a..a59b21894b08 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_constants.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_constants.go @@ -10,7 +10,7 @@ package armkeyvault const ( module = "armkeyvault" - version = "v0.1.0" + version = "v0.2.0" ) type AccessPolicyUpdateKind string diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_keys_client.go b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_keys_client.go index 889629215063..6fe75dc0eff3 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_keys_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_keys_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // KeysClient contains the methods for the Keys group. @@ -30,8 +31,15 @@ type KeysClient struct { } // NewKeysClient creates a new instance of KeysClient with the specified values. -func NewKeysClient(con *arm.Connection, subscriptionID string) *KeysClient { - return &KeysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *KeysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &KeysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateIfNotExist - Creates the first version of a new key if it does not exist. If it already exists, then the existing key is returned without any write @@ -87,7 +95,7 @@ func (client *KeysClient) createIfNotExistCreateRequest(ctx context.Context, res func (client *KeysClient) createIfNotExistHandleResponse(resp *http.Response) (KeysCreateIfNotExistResponse, error) { result := KeysCreateIfNotExistResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Key); err != nil { - return KeysCreateIfNotExistResponse{}, err + return KeysCreateIfNotExistResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -156,7 +164,7 @@ func (client *KeysClient) getCreateRequest(ctx context.Context, resourceGroupNam func (client *KeysClient) getHandleResponse(resp *http.Response) (KeysGetResponse, error) { result := KeysGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Key); err != nil { - return KeysGetResponse{}, err + return KeysGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -229,7 +237,7 @@ func (client *KeysClient) getVersionCreateRequest(ctx context.Context, resourceG func (client *KeysClient) getVersionHandleResponse(resp *http.Response) (KeysGetVersionResponse, error) { result := KeysGetVersionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Key); err != nil { - return KeysGetVersionResponse{}, err + return KeysGetVersionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -291,7 +299,7 @@ func (client *KeysClient) listCreateRequest(ctx context.Context, resourceGroupNa func (client *KeysClient) listHandleResponse(resp *http.Response) (KeysListResponse, error) { result := KeysListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.KeyListResult); err != nil { - return KeysListResponse{}, err + return KeysListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -357,7 +365,7 @@ func (client *KeysClient) listVersionsCreateRequest(ctx context.Context, resourc func (client *KeysClient) listVersionsHandleResponse(resp *http.Response) (KeysListVersionsResponse, error) { result := KeysListVersionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.KeyListResult); err != nil { - return KeysListVersionsResponse{}, err + return KeysListVersionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_managedhsms_client.go b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_managedhsms_client.go index 39f123a31a00..7373ac69313b 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_managedhsms_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_managedhsms_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // ManagedHsmsClient contains the methods for the ManagedHsms group. @@ -32,8 +32,15 @@ type ManagedHsmsClient struct { } // NewManagedHsmsClient creates a new instance of ManagedHsmsClient with the specified values. -func NewManagedHsmsClient(con *arm.Connection, subscriptionID string) *ManagedHsmsClient { - return &ManagedHsmsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedHsmsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedHsmsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedHsmsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update a managed HSM Pool in the specified subscription. @@ -235,7 +242,7 @@ func (client *ManagedHsmsClient) getCreateRequest(ctx context.Context, resourceG func (client *ManagedHsmsClient) getHandleResponse(resp *http.Response) (ManagedHsmsGetResponse, error) { result := ManagedHsmsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedHsm); err != nil { - return ManagedHsmsGetResponse{}, err + return ManagedHsmsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -300,7 +307,7 @@ func (client *ManagedHsmsClient) getDeletedCreateRequest(ctx context.Context, na func (client *ManagedHsmsClient) getDeletedHandleResponse(resp *http.Response) (ManagedHsmsGetDeletedResponse, error) { result := ManagedHsmsGetDeletedResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeletedManagedHsm); err != nil { - return ManagedHsmsGetDeletedResponse{}, err + return ManagedHsmsGetDeletedResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -362,7 +369,7 @@ func (client *ManagedHsmsClient) listByResourceGroupCreateRequest(ctx context.Co func (client *ManagedHsmsClient) listByResourceGroupHandleResponse(resp *http.Response) (ManagedHsmsListByResourceGroupResponse, error) { result := ManagedHsmsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedHsmListResult); err != nil { - return ManagedHsmsListByResourceGroupResponse{}, err + return ManagedHsmsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -419,7 +426,7 @@ func (client *ManagedHsmsClient) listBySubscriptionCreateRequest(ctx context.Con func (client *ManagedHsmsClient) listBySubscriptionHandleResponse(resp *http.Response) (ManagedHsmsListBySubscriptionResponse, error) { result := ManagedHsmsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedHsmListResult); err != nil { - return ManagedHsmsListBySubscriptionResponse{}, err + return ManagedHsmsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -473,7 +480,7 @@ func (client *ManagedHsmsClient) listDeletedCreateRequest(ctx context.Context, o func (client *ManagedHsmsClient) listDeletedHandleResponse(resp *http.Response) (ManagedHsmsListDeletedResponse, error) { result := ManagedHsmsListDeletedResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeletedManagedHsmListResult); err != nil { - return ManagedHsmsListDeletedResponse{}, err + return ManagedHsmsListDeletedResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_mhsmprivateendpointconnections_client.go b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_mhsmprivateendpointconnections_client.go index 605b3848b57b..3171eea8b5d9 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_mhsmprivateendpointconnections_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_mhsmprivateendpointconnections_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // MHSMPrivateEndpointConnectionsClient contains the methods for the MHSMPrivateEndpointConnections group. @@ -32,8 +32,15 @@ type MHSMPrivateEndpointConnectionsClient struct { } // NewMHSMPrivateEndpointConnectionsClient creates a new instance of MHSMPrivateEndpointConnectionsClient with the specified values. -func NewMHSMPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *MHSMPrivateEndpointConnectionsClient { - return &MHSMPrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewMHSMPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *MHSMPrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MHSMPrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginDelete - Deletes the specified private endpoint connection associated with the managed hsm pool. @@ -167,7 +174,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) getCreateRequest(ctx context func (client *MHSMPrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (MHSMPrivateEndpointConnectionsGetResponse, error) { result := MHSMPrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MHSMPrivateEndpointConnection); err != nil { - return MHSMPrivateEndpointConnectionsGetResponse{}, err + return MHSMPrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -229,7 +236,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) listByResourceCreateRequest( func (client *MHSMPrivateEndpointConnectionsClient) listByResourceHandleResponse(resp *http.Response) (MHSMPrivateEndpointConnectionsListByResourceResponse, error) { result := MHSMPrivateEndpointConnectionsListByResourceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MHSMPrivateEndpointConnectionsListResult); err != nil { - return MHSMPrivateEndpointConnectionsListByResourceResponse{}, err + return MHSMPrivateEndpointConnectionsListByResourceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -309,7 +316,7 @@ func (client *MHSMPrivateEndpointConnectionsClient) putHandleResponse(resp *http result.AzureAsyncOperation = &val } if err := runtime.UnmarshalAsJSON(resp, &result.MHSMPrivateEndpointConnection); err != nil { - return MHSMPrivateEndpointConnectionsPutResponse{}, err + return MHSMPrivateEndpointConnectionsPutResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_mhsmprivatelinkresources_client.go b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_mhsmprivatelinkresources_client.go index d21884601cd1..c713a4645eb9 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_mhsmprivatelinkresources_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_mhsmprivatelinkresources_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // MHSMPrivateLinkResourcesClient contains the methods for the MHSMPrivateLinkResources group. @@ -30,8 +31,15 @@ type MHSMPrivateLinkResourcesClient struct { } // NewMHSMPrivateLinkResourcesClient creates a new instance of MHSMPrivateLinkResourcesClient with the specified values. -func NewMHSMPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *MHSMPrivateLinkResourcesClient { - return &MHSMPrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewMHSMPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *MHSMPrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MHSMPrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByMHSMResource - Gets the private link resources supported for the managed hsm pool. @@ -81,7 +89,7 @@ func (client *MHSMPrivateLinkResourcesClient) listByMHSMResourceCreateRequest(ct func (client *MHSMPrivateLinkResourcesClient) listByMHSMResourceHandleResponse(resp *http.Response) (MHSMPrivateLinkResourcesListByMHSMResourceResponse, error) { result := MHSMPrivateLinkResourcesListByMHSMResourceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MHSMPrivateLinkResourceListResult); err != nil { - return MHSMPrivateLinkResourcesListByMHSMResourceResponse{}, err + return MHSMPrivateLinkResourcesListByMHSMResourceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_models.go b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_models.go index 046283295b48..31dc1b4c664a 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_models.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_models.go @@ -10,11 +10,10 @@ package armkeyvault import ( "encoding/json" - "reflect" - "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "reflect" + "time" ) // AccessPolicyEntry - An identity that have access to the key vault. All identities in the array must use the same tenant ID as the key vault's tenant @@ -74,11 +73,11 @@ func (a *Attributes) UnmarshalJSON(data []byte) error { } func (a Attributes) marshalInternal(objectMap map[string]interface{}) { - populate(objectMap, "created", (*timeUnix)(a.Created)) + populateTimeUnix(objectMap, "created", a.Created) populate(objectMap, "enabled", a.Enabled) - populate(objectMap, "exp", (*timeUnix)(a.Expires)) - populate(objectMap, "nbf", (*timeUnix)(a.NotBefore)) - populate(objectMap, "updated", (*timeUnix)(a.Updated)) + populateTimeUnix(objectMap, "exp", a.Expires) + populateTimeUnix(objectMap, "nbf", a.NotBefore) + populateTimeUnix(objectMap, "updated", a.Updated) } func (a *Attributes) unmarshalInternal(rawMsg map[string]json.RawMessage) error { @@ -86,27 +85,19 @@ func (a *Attributes) unmarshalInternal(rawMsg map[string]json.RawMessage) error var err error switch key { case "created": - var aux timeUnix - err = unpopulate(val, &aux) - a.Created = (*time.Time)(&aux) + err = unpopulateTimeUnix(val, &a.Created) delete(rawMsg, key) case "enabled": err = unpopulate(val, &a.Enabled) delete(rawMsg, key) case "exp": - var aux timeUnix - err = unpopulate(val, &aux) - a.Expires = (*time.Time)(&aux) + err = unpopulateTimeUnix(val, &a.Expires) delete(rawMsg, key) case "nbf": - var aux timeUnix - err = unpopulate(val, &aux) - a.NotBefore = (*time.Time)(&aux) + err = unpopulateTimeUnix(val, &a.NotBefore) delete(rawMsg, key) case "updated": - var aux timeUnix - err = unpopulate(val, &aux) - a.Updated = (*time.Time)(&aux) + err = unpopulateTimeUnix(val, &a.Updated) delete(rawMsg, key) } if err != nil { @@ -207,11 +198,11 @@ type DeletedManagedHsmProperties struct { // MarshalJSON implements the json.Marshaller interface for type DeletedManagedHsmProperties. func (d DeletedManagedHsmProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "deletionDate", (*timeRFC3339)(d.DeletionDate)) + populateTimeRFC3339(objectMap, "deletionDate", d.DeletionDate) populate(objectMap, "location", d.Location) populate(objectMap, "mhsmId", d.MhsmID) populate(objectMap, "purgeProtectionEnabled", d.PurgeProtectionEnabled) - populate(objectMap, "scheduledPurgeDate", (*timeRFC3339)(d.ScheduledPurgeDate)) + populateTimeRFC3339(objectMap, "scheduledPurgeDate", d.ScheduledPurgeDate) populate(objectMap, "tags", d.Tags) return json.Marshal(objectMap) } @@ -226,9 +217,7 @@ func (d *DeletedManagedHsmProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "deletionDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.DeletionDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.DeletionDate) delete(rawMsg, key) case "location": err = unpopulate(val, &d.Location) @@ -240,9 +229,7 @@ func (d *DeletedManagedHsmProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.PurgeProtectionEnabled) delete(rawMsg, key) case "scheduledPurgeDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.ScheduledPurgeDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.ScheduledPurgeDate) delete(rawMsg, key) case "tags": err = unpopulate(val, &d.Tags) @@ -311,10 +298,10 @@ type DeletedVaultProperties struct { // MarshalJSON implements the json.Marshaller interface for type DeletedVaultProperties. func (d DeletedVaultProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "deletionDate", (*timeRFC3339)(d.DeletionDate)) + populateTimeRFC3339(objectMap, "deletionDate", d.DeletionDate) populate(objectMap, "location", d.Location) populate(objectMap, "purgeProtectionEnabled", d.PurgeProtectionEnabled) - populate(objectMap, "scheduledPurgeDate", (*timeRFC3339)(d.ScheduledPurgeDate)) + populateTimeRFC3339(objectMap, "scheduledPurgeDate", d.ScheduledPurgeDate) populate(objectMap, "tags", d.Tags) populate(objectMap, "vaultId", d.VaultID) return json.Marshal(objectMap) @@ -330,9 +317,7 @@ func (d *DeletedVaultProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "deletionDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.DeletionDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.DeletionDate) delete(rawMsg, key) case "location": err = unpopulate(val, &d.Location) @@ -341,9 +326,7 @@ func (d *DeletedVaultProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.PurgeProtectionEnabled) delete(rawMsg, key) case "scheduledPurgeDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.ScheduledPurgeDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.ScheduledPurgeDate) delete(rawMsg, key) case "tags": err = unpopulate(val, &d.Tags) @@ -890,7 +873,7 @@ func (m ManagedHsmProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "privateEndpointConnections", m.PrivateEndpointConnections) populate(objectMap, "provisioningState", m.ProvisioningState) populate(objectMap, "publicNetworkAccess", m.PublicNetworkAccess) - populate(objectMap, "scheduledPurgeDate", (*timeRFC3339)(m.ScheduledPurgeDate)) + populateTimeRFC3339(objectMap, "scheduledPurgeDate", m.ScheduledPurgeDate) populate(objectMap, "softDeleteRetentionInDays", m.SoftDeleteRetentionInDays) populate(objectMap, "statusMessage", m.StatusMessage) populate(objectMap, "tenantId", m.TenantID) @@ -934,9 +917,7 @@ func (m *ManagedHsmProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.PublicNetworkAccess) delete(rawMsg, key) case "scheduledPurgeDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.ScheduledPurgeDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.ScheduledPurgeDate) delete(rawMsg, key) case "softDeleteRetentionInDays": err = unpopulate(val, &m.SoftDeleteRetentionInDays) @@ -1608,10 +1589,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -1627,9 +1608,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -1638,9 +1617,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_operations_client.go b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_operations_client.go index f119edda7adc..fab02c1a029d 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_operations_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armkeyvault import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available Key Vault Rest API operations. @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_pagers.go b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_pagers.go index 63694dbd2222..b6fea5a08f2a 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_pagers.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armkeyvault import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // KeysListPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_pollers.go b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_pollers.go index d7262f8f0106..362a87744c0d 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_pollers.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armkeyvault import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // MHSMPrivateEndpointConnectionsDeletePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_privateendpointconnections_client.go index 6c2b577033df..a34f774513d4 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_privateendpointconnections_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. @@ -32,8 +32,15 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { - return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginDelete - Deletes the specified private endpoint connection associated with the key vault. @@ -167,7 +174,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsGetResponse{}, err + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -229,7 +236,7 @@ func (client *PrivateEndpointConnectionsClient) listByResourceCreateRequest(ctx func (client *PrivateEndpointConnectionsClient) listByResourceHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListByResourceResponse, error) { result := PrivateEndpointConnectionsListByResourceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionsListByResourceResponse{}, err + return PrivateEndpointConnectionsListByResourceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -309,7 +316,7 @@ func (client *PrivateEndpointConnectionsClient) putHandleResponse(resp *http.Res result.AzureAsyncOperation = &val } if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsPutResponse{}, err + return PrivateEndpointConnectionsPutResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_privatelinkresources_client.go index f245f82a8431..f52250920bd7 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_privatelinkresources_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. @@ -30,8 +31,15 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { - return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByVault - Gets the private link resources supported for the key vault. @@ -81,7 +89,7 @@ func (client *PrivateLinkResourcesClient) listByVaultCreateRequest(ctx context.C func (client *PrivateLinkResourcesClient) listByVaultHandleResponse(resp *http.Response) (PrivateLinkResourcesListByVaultResponse, error) { result := PrivateLinkResourcesListByVaultResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { - return PrivateLinkResourcesListByVaultResponse{}, err + return PrivateLinkResourcesListByVaultResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_response_types.go b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_response_types.go index 2a7bad2588fa..721cf4b1a431 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_response_types.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armkeyvault import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // KeysCreateIfNotExistResponse contains the response from method Keys.CreateIfNotExist. @@ -86,6 +85,8 @@ type MHSMPrivateEndpointConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l MHSMPrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MHSMPrivateEndpointConnectionsDeleteResponse, error) { respType := MHSMPrivateEndpointConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.MHSMPrivateEndpointConnection) @@ -189,6 +190,8 @@ type ManagedHsmsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedHsmsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedHsmsCreateOrUpdateResponse, error) { respType := ManagedHsmsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedHsm) @@ -239,6 +242,8 @@ type ManagedHsmsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedHsmsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedHsmsDeleteResponse, error) { respType := ManagedHsmsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -343,6 +348,8 @@ type ManagedHsmsPurgeDeletedPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedHsmsPurgeDeletedPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedHsmsPurgeDeletedResponse, error) { respType := ManagedHsmsPurgeDeletedResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -387,6 +394,8 @@ type ManagedHsmsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedHsmsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedHsmsUpdateResponse, error) { respType := ManagedHsmsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedHsm) @@ -449,6 +458,8 @@ type PrivateEndpointConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsDeleteResponse, error) { respType := PrivateEndpointConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) @@ -612,6 +623,8 @@ type VaultsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VaultsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VaultsCreateOrUpdateResponse, error) { respType := VaultsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Vault) @@ -740,6 +753,8 @@ type VaultsPurgeDeletedPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VaultsPurgeDeletedPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VaultsPurgeDeletedResponse, error) { respType := VaultsPurgeDeletedResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_secrets_client.go b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_secrets_client.go index 745d8a116744..2b13a965e742 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_secrets_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_secrets_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // SecretsClient contains the methods for the Secrets group. @@ -31,8 +32,15 @@ type SecretsClient struct { } // NewSecretsClient creates a new instance of SecretsClient with the specified values. -func NewSecretsClient(con *arm.Connection, subscriptionID string) *SecretsClient { - return &SecretsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSecretsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SecretsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SecretsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update a secret in a key vault in the specified subscription. NOTE: This API is intended for internal use in ARM deployments. @@ -88,7 +96,7 @@ func (client *SecretsClient) createOrUpdateCreateRequest(ctx context.Context, re func (client *SecretsClient) createOrUpdateHandleResponse(resp *http.Response) (SecretsCreateOrUpdateResponse, error) { result := SecretsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Secret); err != nil { - return SecretsCreateOrUpdateResponse{}, err + return SecretsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -158,7 +166,7 @@ func (client *SecretsClient) getCreateRequest(ctx context.Context, resourceGroup func (client *SecretsClient) getHandleResponse(resp *http.Response) (SecretsGetResponse, error) { result := SecretsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Secret); err != nil { - return SecretsGetResponse{}, err + return SecretsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -225,7 +233,7 @@ func (client *SecretsClient) listCreateRequest(ctx context.Context, resourceGrou func (client *SecretsClient) listHandleResponse(resp *http.Response) (SecretsListResponse, error) { result := SecretsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecretListResult); err != nil { - return SecretsListResponse{}, err + return SecretsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -295,7 +303,7 @@ func (client *SecretsClient) updateCreateRequest(ctx context.Context, resourceGr func (client *SecretsClient) updateHandleResponse(resp *http.Response) (SecretsUpdateResponse, error) { result := SecretsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Secret); err != nil { - return SecretsUpdateResponse{}, err + return SecretsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_time_rfc3339.go b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_time_rfc3339.go index 7bdbd7f546cf..9b9dc73b399d 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armkeyvault import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_time_unix.go b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_time_unix.go index 3d851d7f08ea..7d0d3b0928b9 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_time_unix.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_time_unix.go @@ -11,6 +11,9 @@ package armkeyvault import ( "encoding/json" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "strings" "time" ) @@ -32,3 +35,27 @@ func (t *timeUnix) UnmarshalJSON(data []byte) error { func (t timeUnix) String() string { return fmt.Sprintf("%d", time.Time(t).Unix()) } + +func populateTimeUnix(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeUnix)(t) +} + +func unpopulateTimeUnix(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeUnix + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_vaults_client.go b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_vaults_client.go index 28d756528dcf..b34649cb118f 100644 --- a/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_vaults_client.go +++ b/sdk/resourcemanager/keyvault/armkeyvault/zz_generated_vaults_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // VaultsClient contains the methods for the Vaults group. @@ -32,8 +32,15 @@ type VaultsClient struct { } // NewVaultsClient creates a new instance of VaultsClient with the specified values. -func NewVaultsClient(con *arm.Connection, subscriptionID string) *VaultsClient { - return &VaultsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVaultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VaultsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VaultsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNameAvailability - Checks that the vault name is valid and is not already in use. @@ -75,7 +82,7 @@ func (client *VaultsClient) checkNameAvailabilityCreateRequest(ctx context.Conte func (client *VaultsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (VaultsCheckNameAvailabilityResponse, error) { result := VaultsCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResult); err != nil { - return VaultsCheckNameAvailabilityResponse{}, err + return VaultsCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -272,7 +279,7 @@ func (client *VaultsClient) getCreateRequest(ctx context.Context, resourceGroupN func (client *VaultsClient) getHandleResponse(resp *http.Response) (VaultsGetResponse, error) { result := VaultsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Vault); err != nil { - return VaultsGetResponse{}, err + return VaultsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -337,7 +344,7 @@ func (client *VaultsClient) getDeletedCreateRequest(ctx context.Context, vaultNa func (client *VaultsClient) getDeletedHandleResponse(resp *http.Response) (VaultsGetDeletedResponse, error) { result := VaultsGetDeletedResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeletedVault); err != nil { - return VaultsGetDeletedResponse{}, err + return VaultsGetDeletedResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -395,7 +402,7 @@ func (client *VaultsClient) listCreateRequest(ctx context.Context, options *Vaul func (client *VaultsClient) listHandleResponse(resp *http.Response) (VaultsListResponse, error) { result := VaultsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { - return VaultsListResponse{}, err + return VaultsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -456,7 +463,7 @@ func (client *VaultsClient) listByResourceGroupCreateRequest(ctx context.Context func (client *VaultsClient) listByResourceGroupHandleResponse(resp *http.Response) (VaultsListByResourceGroupResponse, error) { result := VaultsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VaultListResult); err != nil { - return VaultsListByResourceGroupResponse{}, err + return VaultsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -513,7 +520,7 @@ func (client *VaultsClient) listBySubscriptionCreateRequest(ctx context.Context, func (client *VaultsClient) listBySubscriptionHandleResponse(resp *http.Response) (VaultsListBySubscriptionResponse, error) { result := VaultsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VaultListResult); err != nil { - return VaultsListBySubscriptionResponse{}, err + return VaultsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -567,7 +574,7 @@ func (client *VaultsClient) listDeletedCreateRequest(ctx context.Context, option func (client *VaultsClient) listDeletedHandleResponse(resp *http.Response) (VaultsListDeletedResponse, error) { result := VaultsListDeletedResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeletedVaultListResult); err != nil { - return VaultsListDeletedResponse{}, err + return VaultsListDeletedResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -586,8 +593,7 @@ func (client *VaultsClient) listDeletedHandleError(resp *http.Response) error { } // BeginPurgeDeleted - Permanently deletes the specified vault. aka Purges the deleted Azure key vault. -// If the operation fails it returns one of the following error types. -// - *CloudError, *CloudError +// If the operation fails it returns the *CloudError error type. func (client *VaultsClient) BeginPurgeDeleted(ctx context.Context, vaultName string, location string, options *VaultsBeginPurgeDeletedOptions) (VaultsPurgeDeletedPollerResponse, error) { resp, err := client.purgeDeleted(ctx, vaultName, location, options) if err != nil { @@ -607,8 +613,7 @@ func (client *VaultsClient) BeginPurgeDeleted(ctx context.Context, vaultName str } // PurgeDeleted - Permanently deletes the specified vault. aka Purges the deleted Azure key vault. -// If the operation fails it returns one of the following error types. -// - *CloudError, *CloudError +// If the operation fails it returns the *CloudError error type. func (client *VaultsClient) purgeDeleted(ctx context.Context, vaultName string, location string, options *VaultsBeginPurgeDeletedOptions) (*http.Response, error) { req, err := client.purgeDeletedCreateRequest(ctx, vaultName, location, options) if err != nil { @@ -710,7 +715,7 @@ func (client *VaultsClient) updateCreateRequest(ctx context.Context, resourceGro func (client *VaultsClient) updateHandleResponse(resp *http.Response) (VaultsUpdateResponse, error) { result := VaultsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Vault); err != nil { - return VaultsUpdateResponse{}, err + return VaultsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -729,8 +734,7 @@ func (client *VaultsClient) updateHandleError(resp *http.Response) error { } // UpdateAccessPolicy - Update access policies in a key vault in the specified subscription. -// If the operation fails it returns one of the following error types. -// - *CloudError, *CloudError +// If the operation fails it returns the *CloudError error type. func (client *VaultsClient) UpdateAccessPolicy(ctx context.Context, resourceGroupName string, vaultName string, operationKind AccessPolicyUpdateKind, parameters VaultAccessPolicyParameters, options *VaultsUpdateAccessPolicyOptions) (VaultsUpdateAccessPolicyResponse, error) { req, err := client.updateAccessPolicyCreateRequest(ctx, resourceGroupName, vaultName, operationKind, parameters, options) if err != nil { @@ -780,7 +784,7 @@ func (client *VaultsClient) updateAccessPolicyCreateRequest(ctx context.Context, func (client *VaultsClient) updateAccessPolicyHandleResponse(resp *http.Response) (VaultsUpdateAccessPolicyResponse, error) { result := VaultsUpdateAccessPolicyResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VaultAccessPolicyParameters); err != nil { - return VaultsUpdateAccessPolicyResponse{}, err + return VaultsUpdateAccessPolicyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/CHANGELOG.md b/sdk/resourcemanager/logic/armlogic/CHANGELOG.md index 6cd92f6efa2d..149cd6a27361 100644 --- a/sdk/resourcemanager/logic/armlogic/CHANGELOG.md +++ b/sdk/resourcemanager/logic/armlogic/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-18) diff --git a/sdk/resourcemanager/logic/armlogic/README.md b/sdk/resourcemanager/logic/armlogic/README.md index e098977a84a4..44024b5ae5e6 100644 --- a/sdk/resourcemanager/logic/armlogic/README.md +++ b/sdk/resourcemanager/logic/armlogic/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Logic Apps +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Logic Apps modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armlogic.NewWorkflowsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Logic Apps modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armlogic.NewWorkflowsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armlogic.NewWorkflowsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/logic/armlogic/autorest.md b/sdk/resourcemanager/logic/armlogic/autorest.md index bd24ff7a4656..66b1b222a07f 100644 --- a/sdk/resourcemanager/logic/armlogic/autorest.md +++ b/sdk/resourcemanager/logic/armlogic/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/3eaa729b3686f20817145e771a8ab707c739dbbd/specification/logic/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/3eaa729b3686f20817145e771a8ab707c739dbbd/specification/logic/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/logic/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/logic/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.1 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/logic/armlogic/go.mod b/sdk/resourcemanager/logic/armlogic/go.mod index aecee81749cf..d9f688027547 100644 --- a/sdk/resourcemanager/logic/armlogic/go.mod +++ b/sdk/resourcemanager/logic/armlogic/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/logic/armlogic go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.1.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/logic/armlogic/go.sum b/sdk/resourcemanager/logic/armlogic/go.sum index f37ba2aef08b..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/logic/armlogic/go.sum +++ b/sdk/resourcemanager/logic/armlogic/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible h1:WFsr3Efy7uweykOAEfOHO3ACtuwIv+rrFmSn9K48VnA= -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_constants.go b/sdk/resourcemanager/logic/armlogic/zz_generated_constants.go index b3c215499a49..5a7bfec8c599 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_constants.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_constants.go @@ -10,7 +10,7 @@ package armlogic const ( module = "armlogic" - version = "v0.1.1" + version = "v0.2.0" ) // APIDeploymentParameterVisibility - The Api deployment parameter visibility. diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountagreements_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountagreements_client.go index 802f15623fc5..4f563772e6f9 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountagreements_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountagreements_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // IntegrationAccountAgreementsClient contains the methods for the IntegrationAccountAgreements group. @@ -31,8 +32,15 @@ type IntegrationAccountAgreementsClient struct { } // NewIntegrationAccountAgreementsClient creates a new instance of IntegrationAccountAgreementsClient with the specified values. -func NewIntegrationAccountAgreementsClient(con *arm.Connection, subscriptionID string) *IntegrationAccountAgreementsClient { - return &IntegrationAccountAgreementsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIntegrationAccountAgreementsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IntegrationAccountAgreementsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IntegrationAccountAgreementsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates an integration account agreement. @@ -86,7 +94,7 @@ func (client *IntegrationAccountAgreementsClient) createOrUpdateCreateRequest(ct func (client *IntegrationAccountAgreementsClient) createOrUpdateHandleResponse(resp *http.Response) (IntegrationAccountAgreementsCreateOrUpdateResponse, error) { result := IntegrationAccountAgreementsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountAgreement); err != nil { - return IntegrationAccountAgreementsCreateOrUpdateResponse{}, err + return IntegrationAccountAgreementsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -215,7 +223,7 @@ func (client *IntegrationAccountAgreementsClient) getCreateRequest(ctx context.C func (client *IntegrationAccountAgreementsClient) getHandleResponse(resp *http.Response) (IntegrationAccountAgreementsGetResponse, error) { result := IntegrationAccountAgreementsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountAgreement); err != nil { - return IntegrationAccountAgreementsGetResponse{}, err + return IntegrationAccountAgreementsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -283,7 +291,7 @@ func (client *IntegrationAccountAgreementsClient) listCreateRequest(ctx context. func (client *IntegrationAccountAgreementsClient) listHandleResponse(resp *http.Response) (IntegrationAccountAgreementsListResponse, error) { result := IntegrationAccountAgreementsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountAgreementListResult); err != nil { - return IntegrationAccountAgreementsListResponse{}, err + return IntegrationAccountAgreementsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -352,7 +360,7 @@ func (client *IntegrationAccountAgreementsClient) listContentCallbackURLCreateRe func (client *IntegrationAccountAgreementsClient) listContentCallbackURLHandleResponse(resp *http.Response) (IntegrationAccountAgreementsListContentCallbackURLResponse, error) { result := IntegrationAccountAgreementsListContentCallbackURLResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowTriggerCallbackURL); err != nil { - return IntegrationAccountAgreementsListContentCallbackURLResponse{}, err + return IntegrationAccountAgreementsListContentCallbackURLResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountassemblies_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountassemblies_client.go index f078640cf3f2..c597b660c9c0 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountassemblies_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountassemblies_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // IntegrationAccountAssembliesClient contains the methods for the IntegrationAccountAssemblies group. @@ -30,8 +31,15 @@ type IntegrationAccountAssembliesClient struct { } // NewIntegrationAccountAssembliesClient creates a new instance of IntegrationAccountAssembliesClient with the specified values. -func NewIntegrationAccountAssembliesClient(con *arm.Connection, subscriptionID string) *IntegrationAccountAssembliesClient { - return &IntegrationAccountAssembliesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIntegrationAccountAssembliesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IntegrationAccountAssembliesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IntegrationAccountAssembliesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update an assembly for an integration account. @@ -85,7 +93,7 @@ func (client *IntegrationAccountAssembliesClient) createOrUpdateCreateRequest(ct func (client *IntegrationAccountAssembliesClient) createOrUpdateHandleResponse(resp *http.Response) (IntegrationAccountAssembliesCreateOrUpdateResponse, error) { result := IntegrationAccountAssembliesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AssemblyDefinition); err != nil { - return IntegrationAccountAssembliesCreateOrUpdateResponse{}, err + return IntegrationAccountAssembliesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *IntegrationAccountAssembliesClient) getCreateRequest(ctx context.C func (client *IntegrationAccountAssembliesClient) getHandleResponse(resp *http.Response) (IntegrationAccountAssembliesGetResponse, error) { result := IntegrationAccountAssembliesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AssemblyDefinition); err != nil { - return IntegrationAccountAssembliesGetResponse{}, err + return IntegrationAccountAssembliesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -279,7 +287,7 @@ func (client *IntegrationAccountAssembliesClient) listCreateRequest(ctx context. func (client *IntegrationAccountAssembliesClient) listHandleResponse(resp *http.Response) (IntegrationAccountAssembliesListResponse, error) { result := IntegrationAccountAssembliesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AssemblyCollection); err != nil { - return IntegrationAccountAssembliesListResponse{}, err + return IntegrationAccountAssembliesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -348,7 +356,7 @@ func (client *IntegrationAccountAssembliesClient) listContentCallbackURLCreateRe func (client *IntegrationAccountAssembliesClient) listContentCallbackURLHandleResponse(resp *http.Response) (IntegrationAccountAssembliesListContentCallbackURLResponse, error) { result := IntegrationAccountAssembliesListContentCallbackURLResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowTriggerCallbackURL); err != nil { - return IntegrationAccountAssembliesListContentCallbackURLResponse{}, err + return IntegrationAccountAssembliesListContentCallbackURLResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountbatchconfigurations_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountbatchconfigurations_client.go index cf73791aaf91..c2f82c3717e5 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountbatchconfigurations_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountbatchconfigurations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // IntegrationAccountBatchConfigurationsClient contains the methods for the IntegrationAccountBatchConfigurations group. @@ -30,8 +31,15 @@ type IntegrationAccountBatchConfigurationsClient struct { } // NewIntegrationAccountBatchConfigurationsClient creates a new instance of IntegrationAccountBatchConfigurationsClient with the specified values. -func NewIntegrationAccountBatchConfigurationsClient(con *arm.Connection, subscriptionID string) *IntegrationAccountBatchConfigurationsClient { - return &IntegrationAccountBatchConfigurationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIntegrationAccountBatchConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IntegrationAccountBatchConfigurationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IntegrationAccountBatchConfigurationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update a batch configuration for an integration account. @@ -85,7 +93,7 @@ func (client *IntegrationAccountBatchConfigurationsClient) createOrUpdateCreateR func (client *IntegrationAccountBatchConfigurationsClient) createOrUpdateHandleResponse(resp *http.Response) (IntegrationAccountBatchConfigurationsCreateOrUpdateResponse, error) { result := IntegrationAccountBatchConfigurationsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BatchConfiguration); err != nil { - return IntegrationAccountBatchConfigurationsCreateOrUpdateResponse{}, err + return IntegrationAccountBatchConfigurationsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *IntegrationAccountBatchConfigurationsClient) getCreateRequest(ctx func (client *IntegrationAccountBatchConfigurationsClient) getHandleResponse(resp *http.Response) (IntegrationAccountBatchConfigurationsGetResponse, error) { result := IntegrationAccountBatchConfigurationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BatchConfiguration); err != nil { - return IntegrationAccountBatchConfigurationsGetResponse{}, err + return IntegrationAccountBatchConfigurationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -279,7 +287,7 @@ func (client *IntegrationAccountBatchConfigurationsClient) listCreateRequest(ctx func (client *IntegrationAccountBatchConfigurationsClient) listHandleResponse(resp *http.Response) (IntegrationAccountBatchConfigurationsListResponse, error) { result := IntegrationAccountBatchConfigurationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BatchConfigurationCollection); err != nil { - return IntegrationAccountBatchConfigurationsListResponse{}, err + return IntegrationAccountBatchConfigurationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountcertificates_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountcertificates_client.go index ba6f313a61f0..b1b386b33f13 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountcertificates_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountcertificates_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // IntegrationAccountCertificatesClient contains the methods for the IntegrationAccountCertificates group. @@ -31,8 +32,15 @@ type IntegrationAccountCertificatesClient struct { } // NewIntegrationAccountCertificatesClient creates a new instance of IntegrationAccountCertificatesClient with the specified values. -func NewIntegrationAccountCertificatesClient(con *arm.Connection, subscriptionID string) *IntegrationAccountCertificatesClient { - return &IntegrationAccountCertificatesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIntegrationAccountCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IntegrationAccountCertificatesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IntegrationAccountCertificatesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates an integration account certificate. @@ -86,7 +94,7 @@ func (client *IntegrationAccountCertificatesClient) createOrUpdateCreateRequest( func (client *IntegrationAccountCertificatesClient) createOrUpdateHandleResponse(resp *http.Response) (IntegrationAccountCertificatesCreateOrUpdateResponse, error) { result := IntegrationAccountCertificatesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountCertificate); err != nil { - return IntegrationAccountCertificatesCreateOrUpdateResponse{}, err + return IntegrationAccountCertificatesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -215,7 +223,7 @@ func (client *IntegrationAccountCertificatesClient) getCreateRequest(ctx context func (client *IntegrationAccountCertificatesClient) getHandleResponse(resp *http.Response) (IntegrationAccountCertificatesGetResponse, error) { result := IntegrationAccountCertificatesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountCertificate); err != nil { - return IntegrationAccountCertificatesGetResponse{}, err + return IntegrationAccountCertificatesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -280,7 +288,7 @@ func (client *IntegrationAccountCertificatesClient) listCreateRequest(ctx contex func (client *IntegrationAccountCertificatesClient) listHandleResponse(resp *http.Response) (IntegrationAccountCertificatesListResponse, error) { result := IntegrationAccountCertificatesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountCertificateListResult); err != nil { - return IntegrationAccountCertificatesListResponse{}, err + return IntegrationAccountCertificatesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountmaps_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountmaps_client.go index 20858a3700f7..c13dd39905f6 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountmaps_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountmaps_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // IntegrationAccountMapsClient contains the methods for the IntegrationAccountMaps group. @@ -31,8 +32,15 @@ type IntegrationAccountMapsClient struct { } // NewIntegrationAccountMapsClient creates a new instance of IntegrationAccountMapsClient with the specified values. -func NewIntegrationAccountMapsClient(con *arm.Connection, subscriptionID string) *IntegrationAccountMapsClient { - return &IntegrationAccountMapsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIntegrationAccountMapsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IntegrationAccountMapsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IntegrationAccountMapsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates an integration account map. @@ -86,7 +94,7 @@ func (client *IntegrationAccountMapsClient) createOrUpdateCreateRequest(ctx cont func (client *IntegrationAccountMapsClient) createOrUpdateHandleResponse(resp *http.Response) (IntegrationAccountMapsCreateOrUpdateResponse, error) { result := IntegrationAccountMapsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountMap); err != nil { - return IntegrationAccountMapsCreateOrUpdateResponse{}, err + return IntegrationAccountMapsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -215,7 +223,7 @@ func (client *IntegrationAccountMapsClient) getCreateRequest(ctx context.Context func (client *IntegrationAccountMapsClient) getHandleResponse(resp *http.Response) (IntegrationAccountMapsGetResponse, error) { result := IntegrationAccountMapsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountMap); err != nil { - return IntegrationAccountMapsGetResponse{}, err + return IntegrationAccountMapsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -283,7 +291,7 @@ func (client *IntegrationAccountMapsClient) listCreateRequest(ctx context.Contex func (client *IntegrationAccountMapsClient) listHandleResponse(resp *http.Response) (IntegrationAccountMapsListResponse, error) { result := IntegrationAccountMapsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountMapListResult); err != nil { - return IntegrationAccountMapsListResponse{}, err + return IntegrationAccountMapsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -352,7 +360,7 @@ func (client *IntegrationAccountMapsClient) listContentCallbackURLCreateRequest( func (client *IntegrationAccountMapsClient) listContentCallbackURLHandleResponse(resp *http.Response) (IntegrationAccountMapsListContentCallbackURLResponse, error) { result := IntegrationAccountMapsListContentCallbackURLResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowTriggerCallbackURL); err != nil { - return IntegrationAccountMapsListContentCallbackURLResponse{}, err + return IntegrationAccountMapsListContentCallbackURLResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountpartners_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountpartners_client.go index 480475699a02..d2e77145c763 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountpartners_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountpartners_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // IntegrationAccountPartnersClient contains the methods for the IntegrationAccountPartners group. @@ -31,8 +32,15 @@ type IntegrationAccountPartnersClient struct { } // NewIntegrationAccountPartnersClient creates a new instance of IntegrationAccountPartnersClient with the specified values. -func NewIntegrationAccountPartnersClient(con *arm.Connection, subscriptionID string) *IntegrationAccountPartnersClient { - return &IntegrationAccountPartnersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIntegrationAccountPartnersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IntegrationAccountPartnersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IntegrationAccountPartnersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates an integration account partner. @@ -86,7 +94,7 @@ func (client *IntegrationAccountPartnersClient) createOrUpdateCreateRequest(ctx func (client *IntegrationAccountPartnersClient) createOrUpdateHandleResponse(resp *http.Response) (IntegrationAccountPartnersCreateOrUpdateResponse, error) { result := IntegrationAccountPartnersCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountPartner); err != nil { - return IntegrationAccountPartnersCreateOrUpdateResponse{}, err + return IntegrationAccountPartnersCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -215,7 +223,7 @@ func (client *IntegrationAccountPartnersClient) getCreateRequest(ctx context.Con func (client *IntegrationAccountPartnersClient) getHandleResponse(resp *http.Response) (IntegrationAccountPartnersGetResponse, error) { result := IntegrationAccountPartnersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountPartner); err != nil { - return IntegrationAccountPartnersGetResponse{}, err + return IntegrationAccountPartnersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -283,7 +291,7 @@ func (client *IntegrationAccountPartnersClient) listCreateRequest(ctx context.Co func (client *IntegrationAccountPartnersClient) listHandleResponse(resp *http.Response) (IntegrationAccountPartnersListResponse, error) { result := IntegrationAccountPartnersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountPartnerListResult); err != nil { - return IntegrationAccountPartnersListResponse{}, err + return IntegrationAccountPartnersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -352,7 +360,7 @@ func (client *IntegrationAccountPartnersClient) listContentCallbackURLCreateRequ func (client *IntegrationAccountPartnersClient) listContentCallbackURLHandleResponse(resp *http.Response) (IntegrationAccountPartnersListContentCallbackURLResponse, error) { result := IntegrationAccountPartnersListContentCallbackURLResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowTriggerCallbackURL); err != nil { - return IntegrationAccountPartnersListContentCallbackURLResponse{}, err + return IntegrationAccountPartnersListContentCallbackURLResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccounts_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccounts_client.go index 5a4731955b02..89a5d9a57209 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccounts_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccounts_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // IntegrationAccountsClient contains the methods for the IntegrationAccounts group. @@ -31,8 +32,15 @@ type IntegrationAccountsClient struct { } // NewIntegrationAccountsClient creates a new instance of IntegrationAccountsClient with the specified values. -func NewIntegrationAccountsClient(con *arm.Connection, subscriptionID string) *IntegrationAccountsClient { - return &IntegrationAccountsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIntegrationAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IntegrationAccountsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IntegrationAccountsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates an integration account. @@ -82,7 +90,7 @@ func (client *IntegrationAccountsClient) createOrUpdateCreateRequest(ctx context func (client *IntegrationAccountsClient) createOrUpdateHandleResponse(resp *http.Response) (IntegrationAccountsCreateOrUpdateResponse, error) { result := IntegrationAccountsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccount); err != nil { - return IntegrationAccountsCreateOrUpdateResponse{}, err + return IntegrationAccountsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -203,7 +211,7 @@ func (client *IntegrationAccountsClient) getCreateRequest(ctx context.Context, r func (client *IntegrationAccountsClient) getHandleResponse(resp *http.Response) (IntegrationAccountsGetResponse, error) { result := IntegrationAccountsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccount); err != nil { - return IntegrationAccountsGetResponse{}, err + return IntegrationAccountsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -264,7 +272,7 @@ func (client *IntegrationAccountsClient) listByResourceGroupCreateRequest(ctx co func (client *IntegrationAccountsClient) listByResourceGroupHandleResponse(resp *http.Response) (IntegrationAccountsListByResourceGroupResponse, error) { result := IntegrationAccountsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountListResult); err != nil { - return IntegrationAccountsListByResourceGroupResponse{}, err + return IntegrationAccountsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -321,7 +329,7 @@ func (client *IntegrationAccountsClient) listBySubscriptionCreateRequest(ctx con func (client *IntegrationAccountsClient) listBySubscriptionHandleResponse(resp *http.Response) (IntegrationAccountsListBySubscriptionResponse, error) { result := IntegrationAccountsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountListResult); err != nil { - return IntegrationAccountsListBySubscriptionResponse{}, err + return IntegrationAccountsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -386,7 +394,7 @@ func (client *IntegrationAccountsClient) listCallbackURLCreateRequest(ctx contex func (client *IntegrationAccountsClient) listCallbackURLHandleResponse(resp *http.Response) (IntegrationAccountsListCallbackURLResponse, error) { result := IntegrationAccountsListCallbackURLResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CallbackURL); err != nil { - return IntegrationAccountsListCallbackURLResponse{}, err + return IntegrationAccountsListCallbackURLResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -451,7 +459,7 @@ func (client *IntegrationAccountsClient) listKeyVaultKeysCreateRequest(ctx conte func (client *IntegrationAccountsClient) listKeyVaultKeysHandleResponse(resp *http.Response) (IntegrationAccountsListKeyVaultKeysResponse, error) { result := IntegrationAccountsListKeyVaultKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.KeyVaultKeyCollection); err != nil { - return IntegrationAccountsListKeyVaultKeysResponse{}, err + return IntegrationAccountsListKeyVaultKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -572,7 +580,7 @@ func (client *IntegrationAccountsClient) regenerateAccessKeyCreateRequest(ctx co func (client *IntegrationAccountsClient) regenerateAccessKeyHandleResponse(resp *http.Response) (IntegrationAccountsRegenerateAccessKeyResponse, error) { result := IntegrationAccountsRegenerateAccessKeyResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccount); err != nil { - return IntegrationAccountsRegenerateAccessKeyResponse{}, err + return IntegrationAccountsRegenerateAccessKeyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -637,7 +645,7 @@ func (client *IntegrationAccountsClient) updateCreateRequest(ctx context.Context func (client *IntegrationAccountsClient) updateHandleResponse(resp *http.Response) (IntegrationAccountsUpdateResponse, error) { result := IntegrationAccountsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccount); err != nil { - return IntegrationAccountsUpdateResponse{}, err + return IntegrationAccountsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountschemas_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountschemas_client.go index 623da706c779..59f883ba6f2e 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountschemas_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountschemas_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // IntegrationAccountSchemasClient contains the methods for the IntegrationAccountSchemas group. @@ -31,8 +32,15 @@ type IntegrationAccountSchemasClient struct { } // NewIntegrationAccountSchemasClient creates a new instance of IntegrationAccountSchemasClient with the specified values. -func NewIntegrationAccountSchemasClient(con *arm.Connection, subscriptionID string) *IntegrationAccountSchemasClient { - return &IntegrationAccountSchemasClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIntegrationAccountSchemasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IntegrationAccountSchemasClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IntegrationAccountSchemasClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates an integration account schema. @@ -86,7 +94,7 @@ func (client *IntegrationAccountSchemasClient) createOrUpdateCreateRequest(ctx c func (client *IntegrationAccountSchemasClient) createOrUpdateHandleResponse(resp *http.Response) (IntegrationAccountSchemasCreateOrUpdateResponse, error) { result := IntegrationAccountSchemasCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountSchema); err != nil { - return IntegrationAccountSchemasCreateOrUpdateResponse{}, err + return IntegrationAccountSchemasCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -215,7 +223,7 @@ func (client *IntegrationAccountSchemasClient) getCreateRequest(ctx context.Cont func (client *IntegrationAccountSchemasClient) getHandleResponse(resp *http.Response) (IntegrationAccountSchemasGetResponse, error) { result := IntegrationAccountSchemasGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountSchema); err != nil { - return IntegrationAccountSchemasGetResponse{}, err + return IntegrationAccountSchemasGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -283,7 +291,7 @@ func (client *IntegrationAccountSchemasClient) listCreateRequest(ctx context.Con func (client *IntegrationAccountSchemasClient) listHandleResponse(resp *http.Response) (IntegrationAccountSchemasListResponse, error) { result := IntegrationAccountSchemasListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountSchemaListResult); err != nil { - return IntegrationAccountSchemasListResponse{}, err + return IntegrationAccountSchemasListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -352,7 +360,7 @@ func (client *IntegrationAccountSchemasClient) listContentCallbackURLCreateReque func (client *IntegrationAccountSchemasClient) listContentCallbackURLHandleResponse(resp *http.Response) (IntegrationAccountSchemasListContentCallbackURLResponse, error) { result := IntegrationAccountSchemasListContentCallbackURLResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowTriggerCallbackURL); err != nil { - return IntegrationAccountSchemasListContentCallbackURLResponse{}, err + return IntegrationAccountSchemasListContentCallbackURLResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountsessions_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountsessions_client.go index cddc0d82a20f..b041cbdb3342 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountsessions_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationaccountsessions_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // IntegrationAccountSessionsClient contains the methods for the IntegrationAccountSessions group. @@ -31,8 +32,15 @@ type IntegrationAccountSessionsClient struct { } // NewIntegrationAccountSessionsClient creates a new instance of IntegrationAccountSessionsClient with the specified values. -func NewIntegrationAccountSessionsClient(con *arm.Connection, subscriptionID string) *IntegrationAccountSessionsClient { - return &IntegrationAccountSessionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIntegrationAccountSessionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IntegrationAccountSessionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IntegrationAccountSessionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates an integration account session. @@ -86,7 +94,7 @@ func (client *IntegrationAccountSessionsClient) createOrUpdateCreateRequest(ctx func (client *IntegrationAccountSessionsClient) createOrUpdateHandleResponse(resp *http.Response) (IntegrationAccountSessionsCreateOrUpdateResponse, error) { result := IntegrationAccountSessionsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountSession); err != nil { - return IntegrationAccountSessionsCreateOrUpdateResponse{}, err + return IntegrationAccountSessionsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -215,7 +223,7 @@ func (client *IntegrationAccountSessionsClient) getCreateRequest(ctx context.Con func (client *IntegrationAccountSessionsClient) getHandleResponse(resp *http.Response) (IntegrationAccountSessionsGetResponse, error) { result := IntegrationAccountSessionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountSession); err != nil { - return IntegrationAccountSessionsGetResponse{}, err + return IntegrationAccountSessionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -283,7 +291,7 @@ func (client *IntegrationAccountSessionsClient) listCreateRequest(ctx context.Co func (client *IntegrationAccountSessionsClient) listHandleResponse(resp *http.Response) (IntegrationAccountSessionsListResponse, error) { result := IntegrationAccountSessionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationAccountSessionListResult); err != nil { - return IntegrationAccountSessionsListResponse{}, err + return IntegrationAccountSessionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironmentmanagedapioperations_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironmentmanagedapioperations_client.go index 8542a1089996..487b090cffce 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironmentmanagedapioperations_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironmentmanagedapioperations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // IntegrationServiceEnvironmentManagedAPIOperationsClient contains the methods for the IntegrationServiceEnvironmentManagedAPIOperations group. @@ -30,8 +31,15 @@ type IntegrationServiceEnvironmentManagedAPIOperationsClient struct { } // NewIntegrationServiceEnvironmentManagedAPIOperationsClient creates a new instance of IntegrationServiceEnvironmentManagedAPIOperationsClient with the specified values. -func NewIntegrationServiceEnvironmentManagedAPIOperationsClient(con *arm.Connection, subscriptionID string) *IntegrationServiceEnvironmentManagedAPIOperationsClient { - return &IntegrationServiceEnvironmentManagedAPIOperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIntegrationServiceEnvironmentManagedAPIOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IntegrationServiceEnvironmentManagedAPIOperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IntegrationServiceEnvironmentManagedAPIOperationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets the managed Api operations. @@ -82,7 +90,7 @@ func (client *IntegrationServiceEnvironmentManagedAPIOperationsClient) listCreat func (client *IntegrationServiceEnvironmentManagedAPIOperationsClient) listHandleResponse(resp *http.Response) (IntegrationServiceEnvironmentManagedAPIOperationsListResponse, error) { result := IntegrationServiceEnvironmentManagedAPIOperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIOperationListResult); err != nil { - return IntegrationServiceEnvironmentManagedAPIOperationsListResponse{}, err + return IntegrationServiceEnvironmentManagedAPIOperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironmentmanagedapis_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironmentmanagedapis_client.go index 473154f26ac8..45677637eb15 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironmentmanagedapis_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironmentmanagedapis_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // IntegrationServiceEnvironmentManagedApisClient contains the methods for the IntegrationServiceEnvironmentManagedApis group. @@ -31,8 +31,15 @@ type IntegrationServiceEnvironmentManagedApisClient struct { } // NewIntegrationServiceEnvironmentManagedApisClient creates a new instance of IntegrationServiceEnvironmentManagedApisClient with the specified values. -func NewIntegrationServiceEnvironmentManagedApisClient(con *arm.Connection, subscriptionID string) *IntegrationServiceEnvironmentManagedApisClient { - return &IntegrationServiceEnvironmentManagedApisClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIntegrationServiceEnvironmentManagedApisClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IntegrationServiceEnvironmentManagedApisClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IntegrationServiceEnvironmentManagedApisClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginDelete - Deletes the integration service environment managed Api. @@ -166,7 +173,7 @@ func (client *IntegrationServiceEnvironmentManagedApisClient) getCreateRequest(c func (client *IntegrationServiceEnvironmentManagedApisClient) getHandleResponse(resp *http.Response) (IntegrationServiceEnvironmentManagedApisGetResponse, error) { result := IntegrationServiceEnvironmentManagedApisGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationServiceEnvironmentManagedAPI); err != nil { - return IntegrationServiceEnvironmentManagedApisGetResponse{}, err + return IntegrationServiceEnvironmentManagedApisGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -228,7 +235,7 @@ func (client *IntegrationServiceEnvironmentManagedApisClient) listCreateRequest( func (client *IntegrationServiceEnvironmentManagedApisClient) listHandleResponse(resp *http.Response) (IntegrationServiceEnvironmentManagedApisListResponse, error) { result := IntegrationServiceEnvironmentManagedApisListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationServiceEnvironmentManagedAPIListResult); err != nil { - return IntegrationServiceEnvironmentManagedApisListResponse{}, err + return IntegrationServiceEnvironmentManagedApisListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironmentnetworkhealth_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironmentnetworkhealth_client.go index 105bc63d503f..405d13671894 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironmentnetworkhealth_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironmentnetworkhealth_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // IntegrationServiceEnvironmentNetworkHealthClient contains the methods for the IntegrationServiceEnvironmentNetworkHealth group. @@ -30,8 +31,15 @@ type IntegrationServiceEnvironmentNetworkHealthClient struct { } // NewIntegrationServiceEnvironmentNetworkHealthClient creates a new instance of IntegrationServiceEnvironmentNetworkHealthClient with the specified values. -func NewIntegrationServiceEnvironmentNetworkHealthClient(con *arm.Connection, subscriptionID string) *IntegrationServiceEnvironmentNetworkHealthClient { - return &IntegrationServiceEnvironmentNetworkHealthClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIntegrationServiceEnvironmentNetworkHealthClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IntegrationServiceEnvironmentNetworkHealthClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IntegrationServiceEnvironmentNetworkHealthClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the integration service environment network health. @@ -81,7 +89,7 @@ func (client *IntegrationServiceEnvironmentNetworkHealthClient) getCreateRequest func (client *IntegrationServiceEnvironmentNetworkHealthClient) getHandleResponse(resp *http.Response) (IntegrationServiceEnvironmentNetworkHealthGetResponse, error) { result := IntegrationServiceEnvironmentNetworkHealthGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Value); err != nil { - return IntegrationServiceEnvironmentNetworkHealthGetResponse{}, err + return IntegrationServiceEnvironmentNetworkHealthGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironments_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironments_client.go index c2e5538c8415..44f8f630dfab 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironments_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironments_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // IntegrationServiceEnvironmentsClient contains the methods for the IntegrationServiceEnvironments group. @@ -32,8 +32,15 @@ type IntegrationServiceEnvironmentsClient struct { } // NewIntegrationServiceEnvironmentsClient creates a new instance of IntegrationServiceEnvironmentsClient with the specified values. -func NewIntegrationServiceEnvironmentsClient(con *arm.Connection, subscriptionID string) *IntegrationServiceEnvironmentsClient { - return &IntegrationServiceEnvironmentsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIntegrationServiceEnvironmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IntegrationServiceEnvironmentsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IntegrationServiceEnvironmentsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates an integration service environment. @@ -215,7 +222,7 @@ func (client *IntegrationServiceEnvironmentsClient) getCreateRequest(ctx context func (client *IntegrationServiceEnvironmentsClient) getHandleResponse(resp *http.Response) (IntegrationServiceEnvironmentsGetResponse, error) { result := IntegrationServiceEnvironmentsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationServiceEnvironment); err != nil { - return IntegrationServiceEnvironmentsGetResponse{}, err + return IntegrationServiceEnvironmentsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -276,7 +283,7 @@ func (client *IntegrationServiceEnvironmentsClient) listByResourceGroupCreateReq func (client *IntegrationServiceEnvironmentsClient) listByResourceGroupHandleResponse(resp *http.Response) (IntegrationServiceEnvironmentsListByResourceGroupResponse, error) { result := IntegrationServiceEnvironmentsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationServiceEnvironmentListResult); err != nil { - return IntegrationServiceEnvironmentsListByResourceGroupResponse{}, err + return IntegrationServiceEnvironmentsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -333,7 +340,7 @@ func (client *IntegrationServiceEnvironmentsClient) listBySubscriptionCreateRequ func (client *IntegrationServiceEnvironmentsClient) listBySubscriptionHandleResponse(resp *http.Response) (IntegrationServiceEnvironmentsListBySubscriptionResponse, error) { result := IntegrationServiceEnvironmentsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationServiceEnvironmentListResult); err != nil { - return IntegrationServiceEnvironmentsListBySubscriptionResponse{}, err + return IntegrationServiceEnvironmentsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironmentskus_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironmentskus_client.go index fc1d9fc618be..e413781658d4 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironmentskus_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_integrationserviceenvironmentskus_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // IntegrationServiceEnvironmentSKUsClient contains the methods for the IntegrationServiceEnvironmentSKUs group. @@ -30,8 +31,15 @@ type IntegrationServiceEnvironmentSKUsClient struct { } // NewIntegrationServiceEnvironmentSKUsClient creates a new instance of IntegrationServiceEnvironmentSKUsClient with the specified values. -func NewIntegrationServiceEnvironmentSKUsClient(con *arm.Connection, subscriptionID string) *IntegrationServiceEnvironmentSKUsClient { - return &IntegrationServiceEnvironmentSKUsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIntegrationServiceEnvironmentSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IntegrationServiceEnvironmentSKUsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IntegrationServiceEnvironmentSKUsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets a list of integration service environment Skus. @@ -78,7 +86,7 @@ func (client *IntegrationServiceEnvironmentSKUsClient) listCreateRequest(ctx con func (client *IntegrationServiceEnvironmentSKUsClient) listHandleResponse(resp *http.Response) (IntegrationServiceEnvironmentSKUsListResponse, error) { result := IntegrationServiceEnvironmentSKUsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntegrationServiceEnvironmentSKUList); err != nil { - return IntegrationServiceEnvironmentSKUsListResponse{}, err + return IntegrationServiceEnvironmentSKUsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_models.go b/sdk/resourcemanager/logic/armlogic/zz_generated_models.go index 56be8bea251d..8da5ebd69f9b 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_models.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_models.go @@ -10,10 +10,9 @@ package armlogic import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // APIDeploymentParameterMetadata - The API deployment parameter metadata. @@ -627,8 +626,8 @@ func (a *ArtifactProperties) UnmarshalJSON(data []byte) error { } func (a ArtifactProperties) marshalInternal(objectMap map[string]interface{}) { - populate(objectMap, "changedTime", (*timeRFC3339)(a.ChangedTime)) - populate(objectMap, "createdTime", (*timeRFC3339)(a.CreatedTime)) + populateTimeRFC3339(objectMap, "changedTime", a.ChangedTime) + populateTimeRFC3339(objectMap, "createdTime", a.CreatedTime) populate(objectMap, "metadata", a.Metadata) } @@ -637,14 +636,10 @@ func (a *ArtifactProperties) unmarshalInternal(rawMsg map[string]json.RawMessage var err error switch key { case "changedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.ChangedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.ChangedTime) delete(rawMsg, key) case "createdTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.CreatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.CreatedTime) delete(rawMsg, key) case "metadata": err = unpopulate(val, &a.Metadata) @@ -1575,7 +1570,7 @@ type GetCallbackURLParameters struct { func (g GetCallbackURLParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "keyType", g.KeyType) - populate(objectMap, "notAfter", (*timeRFC3339)(g.NotAfter)) + populateTimeRFC3339(objectMap, "notAfter", g.NotAfter) return json.Marshal(objectMap) } @@ -1592,9 +1587,7 @@ func (g *GetCallbackURLParameters) UnmarshalJSON(data []byte) error { err = unpopulate(val, &g.KeyType) delete(rawMsg, key) case "notAfter": - var aux timeRFC3339 - err = unpopulate(val, &aux) - g.NotAfter = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &g.NotAfter) delete(rawMsg, key) } if err != nil { @@ -1707,9 +1700,9 @@ type IntegrationAccountAgreementProperties struct { func (i IntegrationAccountAgreementProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "agreementType", i.AgreementType) - populate(objectMap, "changedTime", (*timeRFC3339)(i.ChangedTime)) + populateTimeRFC3339(objectMap, "changedTime", i.ChangedTime) populate(objectMap, "content", i.Content) - populate(objectMap, "createdTime", (*timeRFC3339)(i.CreatedTime)) + populateTimeRFC3339(objectMap, "createdTime", i.CreatedTime) populate(objectMap, "guestIdentity", i.GuestIdentity) populate(objectMap, "guestPartner", i.GuestPartner) populate(objectMap, "hostIdentity", i.HostIdentity) @@ -1731,17 +1724,13 @@ func (i *IntegrationAccountAgreementProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, &i.AgreementType) delete(rawMsg, key) case "changedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.ChangedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.ChangedTime) delete(rawMsg, key) case "content": err = unpopulate(val, &i.Content) delete(rawMsg, key) case "createdTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.CreatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.CreatedTime) delete(rawMsg, key) case "guestIdentity": err = unpopulate(val, &i.GuestIdentity) @@ -1895,8 +1884,8 @@ type IntegrationAccountCertificateProperties struct { // MarshalJSON implements the json.Marshaller interface for type IntegrationAccountCertificateProperties. func (i IntegrationAccountCertificateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "changedTime", (*timeRFC3339)(i.ChangedTime)) - populate(objectMap, "createdTime", (*timeRFC3339)(i.CreatedTime)) + populateTimeRFC3339(objectMap, "changedTime", i.ChangedTime) + populateTimeRFC3339(objectMap, "createdTime", i.CreatedTime) populate(objectMap, "key", i.Key) populate(objectMap, "metadata", i.Metadata) populate(objectMap, "publicCertificate", i.PublicCertificate) @@ -1913,14 +1902,10 @@ func (i *IntegrationAccountCertificateProperties) UnmarshalJSON(data []byte) err var err error switch key { case "changedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.ChangedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.ChangedTime) delete(rawMsg, key) case "createdTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.CreatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.CreatedTime) delete(rawMsg, key) case "key": err = unpopulate(val, &i.Key) @@ -2045,11 +2030,11 @@ type IntegrationAccountMapProperties struct { // MarshalJSON implements the json.Marshaller interface for type IntegrationAccountMapProperties. func (i IntegrationAccountMapProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "changedTime", (*timeRFC3339)(i.ChangedTime)) + populateTimeRFC3339(objectMap, "changedTime", i.ChangedTime) populate(objectMap, "content", i.Content) populate(objectMap, "contentLink", i.ContentLink) populate(objectMap, "contentType", i.ContentType) - populate(objectMap, "createdTime", (*timeRFC3339)(i.CreatedTime)) + populateTimeRFC3339(objectMap, "createdTime", i.CreatedTime) populate(objectMap, "mapType", i.MapType) populate(objectMap, "metadata", i.Metadata) populate(objectMap, "parametersSchema", i.ParametersSchema) @@ -2066,9 +2051,7 @@ func (i *IntegrationAccountMapProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "changedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.ChangedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.ChangedTime) delete(rawMsg, key) case "content": err = unpopulate(val, &i.Content) @@ -2080,9 +2063,7 @@ func (i *IntegrationAccountMapProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &i.ContentType) delete(rawMsg, key) case "createdTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.CreatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.CreatedTime) delete(rawMsg, key) case "mapType": err = unpopulate(val, &i.MapType) @@ -2194,9 +2175,9 @@ type IntegrationAccountPartnerProperties struct { // MarshalJSON implements the json.Marshaller interface for type IntegrationAccountPartnerProperties. func (i IntegrationAccountPartnerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "changedTime", (*timeRFC3339)(i.ChangedTime)) + populateTimeRFC3339(objectMap, "changedTime", i.ChangedTime) populate(objectMap, "content", i.Content) - populate(objectMap, "createdTime", (*timeRFC3339)(i.CreatedTime)) + populateTimeRFC3339(objectMap, "createdTime", i.CreatedTime) populate(objectMap, "metadata", i.Metadata) populate(objectMap, "partnerType", i.PartnerType) return json.Marshal(objectMap) @@ -2212,17 +2193,13 @@ func (i *IntegrationAccountPartnerProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "changedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.ChangedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.ChangedTime) delete(rawMsg, key) case "content": err = unpopulate(val, &i.Content) delete(rawMsg, key) case "createdTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.CreatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.CreatedTime) delete(rawMsg, key) case "metadata": err = unpopulate(val, &i.Metadata) @@ -2355,11 +2332,11 @@ type IntegrationAccountSchemaProperties struct { // MarshalJSON implements the json.Marshaller interface for type IntegrationAccountSchemaProperties. func (i IntegrationAccountSchemaProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "changedTime", (*timeRFC3339)(i.ChangedTime)) + populateTimeRFC3339(objectMap, "changedTime", i.ChangedTime) populate(objectMap, "content", i.Content) populate(objectMap, "contentLink", i.ContentLink) populate(objectMap, "contentType", i.ContentType) - populate(objectMap, "createdTime", (*timeRFC3339)(i.CreatedTime)) + populateTimeRFC3339(objectMap, "createdTime", i.CreatedTime) populate(objectMap, "documentName", i.DocumentName) populate(objectMap, "fileName", i.FileName) populate(objectMap, "metadata", i.Metadata) @@ -2378,9 +2355,7 @@ func (i *IntegrationAccountSchemaProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "changedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.ChangedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.ChangedTime) delete(rawMsg, key) case "content": err = unpopulate(val, &i.Content) @@ -2392,9 +2367,7 @@ func (i *IntegrationAccountSchemaProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &i.ContentType) delete(rawMsg, key) case "createdTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.CreatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.CreatedTime) delete(rawMsg, key) case "documentName": err = unpopulate(val, &i.DocumentName) @@ -2471,7 +2444,7 @@ type IntegrationAccountSessionFilter struct { // MarshalJSON implements the json.Marshaller interface for type IntegrationAccountSessionFilter. func (i IntegrationAccountSessionFilter) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "changedTime", (*timeRFC3339)(i.ChangedTime)) + populateTimeRFC3339(objectMap, "changedTime", i.ChangedTime) return json.Marshal(objectMap) } @@ -2485,9 +2458,7 @@ func (i *IntegrationAccountSessionFilter) UnmarshalJSON(data []byte) error { var err error switch key { case "changedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.ChangedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.ChangedTime) delete(rawMsg, key) } if err != nil { @@ -2529,9 +2500,9 @@ type IntegrationAccountSessionProperties struct { // MarshalJSON implements the json.Marshaller interface for type IntegrationAccountSessionProperties. func (i IntegrationAccountSessionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "changedTime", (*timeRFC3339)(i.ChangedTime)) + populateTimeRFC3339(objectMap, "changedTime", i.ChangedTime) populate(objectMap, "content", i.Content) - populate(objectMap, "createdTime", (*timeRFC3339)(i.CreatedTime)) + populateTimeRFC3339(objectMap, "createdTime", i.CreatedTime) return json.Marshal(objectMap) } @@ -2545,17 +2516,13 @@ func (i *IntegrationAccountSessionProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "changedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.ChangedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.ChangedTime) delete(rawMsg, key) case "content": err = unpopulate(val, &i.Content) delete(rawMsg, key) case "createdTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.CreatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.CreatedTime) delete(rawMsg, key) } if err != nil { @@ -3371,9 +3338,9 @@ func (o *OperationResultProperties) UnmarshalJSON(data []byte) error { func (o OperationResultProperties) marshalInternal(objectMap map[string]interface{}) { populate(objectMap, "code", o.Code) populate(objectMap, "correlation", o.Correlation) - populate(objectMap, "endTime", (*timeRFC3339)(o.EndTime)) + populateTimeRFC3339(objectMap, "endTime", o.EndTime) populate(objectMap, "error", o.Error) - populate(objectMap, "startTime", (*timeRFC3339)(o.StartTime)) + populateTimeRFC3339(objectMap, "startTime", o.StartTime) populate(objectMap, "status", o.Status) } @@ -3388,17 +3355,13 @@ func (o *OperationResultProperties) unmarshalInternal(rawMsg map[string]json.Raw err = unpopulate(val, &o.Correlation) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - o.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &o.EndTime) delete(rawMsg, key) case "error": err = unpopulate(val, &o.Error) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - o.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &o.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &o.Status) @@ -3537,10 +3500,10 @@ type RequestHistoryProperties struct { // MarshalJSON implements the json.Marshaller interface for type RequestHistoryProperties. func (r RequestHistoryProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "endTime", (*timeRFC3339)(r.EndTime)) + populateTimeRFC3339(objectMap, "endTime", r.EndTime) populate(objectMap, "request", r.Request) populate(objectMap, "response", r.Response) - populate(objectMap, "startTime", (*timeRFC3339)(r.StartTime)) + populateTimeRFC3339(objectMap, "startTime", r.StartTime) return json.Marshal(objectMap) } @@ -3554,9 +3517,7 @@ func (r *RequestHistoryProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.EndTime) delete(rawMsg, key) case "request": err = unpopulate(val, &r.Request) @@ -3565,9 +3526,7 @@ func (r *RequestHistoryProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.Response) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.StartTime) delete(rawMsg, key) } if err != nil { @@ -3660,10 +3619,10 @@ func (r RetryHistory) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "clientRequestId", r.ClientRequestID) populate(objectMap, "code", r.Code) - populate(objectMap, "endTime", (*timeRFC3339)(r.EndTime)) + populateTimeRFC3339(objectMap, "endTime", r.EndTime) populate(objectMap, "error", r.Error) populate(objectMap, "serviceRequestId", r.ServiceRequestID) - populate(objectMap, "startTime", (*timeRFC3339)(r.StartTime)) + populateTimeRFC3339(objectMap, "startTime", r.StartTime) return json.Marshal(objectMap) } @@ -3683,9 +3642,7 @@ func (r *RetryHistory) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.Code) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.EndTime) delete(rawMsg, key) case "error": err = unpopulate(val, &r.Error) @@ -3694,9 +3651,7 @@ func (r *RetryHistory) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.ServiceRequestID) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.StartTime) delete(rawMsg, key) } if err != nil { @@ -4081,7 +4036,7 @@ func (t TrackingEvent) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "error", t.Error) populate(objectMap, "eventLevel", t.EventLevel) - populate(objectMap, "eventTime", (*timeRFC3339)(t.EventTime)) + populateTimeRFC3339(objectMap, "eventTime", t.EventTime) populate(objectMap, "record", t.Record) populate(objectMap, "recordType", t.RecordType) return json.Marshal(objectMap) @@ -4103,9 +4058,7 @@ func (t *TrackingEvent) UnmarshalJSON(data []byte) error { err = unpopulate(val, &t.EventLevel) delete(rawMsg, key) case "eventTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.EventTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.EventTime) delete(rawMsg, key) case "record": err = unpopulate(val, &t.Record) @@ -4271,8 +4224,8 @@ func (w WorkflowProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "accessControl", w.AccessControl) populate(objectMap, "accessEndpoint", w.AccessEndpoint) - populate(objectMap, "changedTime", (*timeRFC3339)(w.ChangedTime)) - populate(objectMap, "createdTime", (*timeRFC3339)(w.CreatedTime)) + populateTimeRFC3339(objectMap, "changedTime", w.ChangedTime) + populateTimeRFC3339(objectMap, "createdTime", w.CreatedTime) populate(objectMap, "definition", w.Definition) populate(objectMap, "endpointsConfiguration", w.EndpointsConfiguration) populate(objectMap, "integrationAccount", w.IntegrationAccount) @@ -4301,14 +4254,10 @@ func (w *WorkflowProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.AccessEndpoint) delete(rawMsg, key) case "changedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.ChangedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.ChangedTime) delete(rawMsg, key) case "createdTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.CreatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.CreatedTime) delete(rawMsg, key) case "definition": err = unpopulate(val, &w.Definition) @@ -4440,12 +4389,12 @@ func (w WorkflowRunActionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "code", w.Code) populate(objectMap, "correlation", w.Correlation) - populate(objectMap, "endTime", (*timeRFC3339)(w.EndTime)) + populateTimeRFC3339(objectMap, "endTime", w.EndTime) populate(objectMap, "error", w.Error) populate(objectMap, "inputsLink", w.InputsLink) populate(objectMap, "outputsLink", w.OutputsLink) populate(objectMap, "retryHistory", w.RetryHistory) - populate(objectMap, "startTime", (*timeRFC3339)(w.StartTime)) + populateTimeRFC3339(objectMap, "startTime", w.StartTime) populate(objectMap, "status", w.Status) populate(objectMap, "trackedProperties", w.TrackedProperties) populate(objectMap, "trackingId", w.TrackingID) @@ -4468,9 +4417,7 @@ func (w *WorkflowRunActionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.Correlation) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.EndTime) delete(rawMsg, key) case "error": err = unpopulate(val, &w.Error) @@ -4485,9 +4432,7 @@ func (w *WorkflowRunActionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.RetryHistory) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &w.Status) @@ -4710,14 +4655,14 @@ func (w WorkflowRunProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "code", w.Code) populate(objectMap, "correlation", w.Correlation) populate(objectMap, "correlationId", w.CorrelationID) - populate(objectMap, "endTime", (*timeRFC3339)(w.EndTime)) + populateTimeRFC3339(objectMap, "endTime", w.EndTime) populate(objectMap, "error", w.Error) populate(objectMap, "outputs", w.Outputs) populate(objectMap, "response", w.Response) - populate(objectMap, "startTime", (*timeRFC3339)(w.StartTime)) + populateTimeRFC3339(objectMap, "startTime", w.StartTime) populate(objectMap, "status", w.Status) populate(objectMap, "trigger", w.Trigger) - populate(objectMap, "waitEndTime", (*timeRFC3339)(w.WaitEndTime)) + populateTimeRFC3339(objectMap, "waitEndTime", w.WaitEndTime) populate(objectMap, "workflow", w.Workflow) return json.Marshal(objectMap) } @@ -4741,9 +4686,7 @@ func (w *WorkflowRunProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.CorrelationID) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.EndTime) delete(rawMsg, key) case "error": err = unpopulate(val, &w.Error) @@ -4755,9 +4698,7 @@ func (w *WorkflowRunProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.Response) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &w.Status) @@ -4766,9 +4707,7 @@ func (w *WorkflowRunProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.Trigger) delete(rawMsg, key) case "waitEndTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.WaitEndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.WaitEndTime) delete(rawMsg, key) case "workflow": err = unpopulate(val, &w.Workflow) @@ -4831,15 +4770,15 @@ func (w WorkflowRunTrigger) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "code", w.Code) populate(objectMap, "correlation", w.Correlation) - populate(objectMap, "endTime", (*timeRFC3339)(w.EndTime)) + populateTimeRFC3339(objectMap, "endTime", w.EndTime) populate(objectMap, "error", w.Error) populate(objectMap, "inputs", w.Inputs) populate(objectMap, "inputsLink", w.InputsLink) populate(objectMap, "name", w.Name) populate(objectMap, "outputs", w.Outputs) populate(objectMap, "outputsLink", w.OutputsLink) - populate(objectMap, "scheduledTime", (*timeRFC3339)(w.ScheduledTime)) - populate(objectMap, "startTime", (*timeRFC3339)(w.StartTime)) + populateTimeRFC3339(objectMap, "scheduledTime", w.ScheduledTime) + populateTimeRFC3339(objectMap, "startTime", w.StartTime) populate(objectMap, "status", w.Status) populate(objectMap, "trackedProperties", w.TrackedProperties) populate(objectMap, "trackingId", w.TrackingID) @@ -4862,9 +4801,7 @@ func (w *WorkflowRunTrigger) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.Correlation) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.EndTime) delete(rawMsg, key) case "error": err = unpopulate(val, &w.Error) @@ -4885,14 +4822,10 @@ func (w *WorkflowRunTrigger) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.OutputsLink) delete(rawMsg, key) case "scheduledTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.ScheduledTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.ScheduledTime) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &w.Status) @@ -5079,14 +5012,14 @@ func (w WorkflowTriggerHistoryProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "code", w.Code) populate(objectMap, "correlation", w.Correlation) - populate(objectMap, "endTime", (*timeRFC3339)(w.EndTime)) + populateTimeRFC3339(objectMap, "endTime", w.EndTime) populate(objectMap, "error", w.Error) populate(objectMap, "fired", w.Fired) populate(objectMap, "inputsLink", w.InputsLink) populate(objectMap, "outputsLink", w.OutputsLink) populate(objectMap, "run", w.Run) - populate(objectMap, "scheduledTime", (*timeRFC3339)(w.ScheduledTime)) - populate(objectMap, "startTime", (*timeRFC3339)(w.StartTime)) + populateTimeRFC3339(objectMap, "scheduledTime", w.ScheduledTime) + populateTimeRFC3339(objectMap, "startTime", w.StartTime) populate(objectMap, "status", w.Status) populate(objectMap, "trackingId", w.TrackingID) return json.Marshal(objectMap) @@ -5108,9 +5041,7 @@ func (w *WorkflowTriggerHistoryProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.Correlation) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.EndTime) delete(rawMsg, key) case "error": err = unpopulate(val, &w.Error) @@ -5128,14 +5059,10 @@ func (w *WorkflowTriggerHistoryProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.Run) delete(rawMsg, key) case "scheduledTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.ScheduledTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.ScheduledTime) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &w.Status) @@ -5219,10 +5146,10 @@ type WorkflowTriggerProperties struct { // MarshalJSON implements the json.Marshaller interface for type WorkflowTriggerProperties. func (w WorkflowTriggerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "changedTime", (*timeRFC3339)(w.ChangedTime)) - populate(objectMap, "createdTime", (*timeRFC3339)(w.CreatedTime)) - populate(objectMap, "lastExecutionTime", (*timeRFC3339)(w.LastExecutionTime)) - populate(objectMap, "nextExecutionTime", (*timeRFC3339)(w.NextExecutionTime)) + populateTimeRFC3339(objectMap, "changedTime", w.ChangedTime) + populateTimeRFC3339(objectMap, "createdTime", w.CreatedTime) + populateTimeRFC3339(objectMap, "lastExecutionTime", w.LastExecutionTime) + populateTimeRFC3339(objectMap, "nextExecutionTime", w.NextExecutionTime) populate(objectMap, "provisioningState", w.ProvisioningState) populate(objectMap, "recurrence", w.Recurrence) populate(objectMap, "state", w.State) @@ -5241,24 +5168,16 @@ func (w *WorkflowTriggerProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "changedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.ChangedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.ChangedTime) delete(rawMsg, key) case "createdTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.CreatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.CreatedTime) delete(rawMsg, key) case "lastExecutionTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.LastExecutionTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.LastExecutionTime) delete(rawMsg, key) case "nextExecutionTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.NextExecutionTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.NextExecutionTime) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, &w.ProvisioningState) @@ -5428,8 +5347,8 @@ func (w WorkflowVersionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "accessControl", w.AccessControl) populate(objectMap, "accessEndpoint", w.AccessEndpoint) - populate(objectMap, "changedTime", (*timeRFC3339)(w.ChangedTime)) - populate(objectMap, "createdTime", (*timeRFC3339)(w.CreatedTime)) + populateTimeRFC3339(objectMap, "changedTime", w.ChangedTime) + populateTimeRFC3339(objectMap, "createdTime", w.CreatedTime) populate(objectMap, "definition", w.Definition) populate(objectMap, "endpointsConfiguration", w.EndpointsConfiguration) populate(objectMap, "integrationAccount", w.IntegrationAccount) @@ -5457,14 +5376,10 @@ func (w *WorkflowVersionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.AccessEndpoint) delete(rawMsg, key) case "changedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.ChangedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.ChangedTime) delete(rawMsg, key) case "createdTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.CreatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.CreatedTime) delete(rawMsg, key) case "definition": err = unpopulate(val, &w.Definition) diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_operations_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_operations_client.go index b81161edfa0b..1e67aa107500 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_operations_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armlogic import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available Logic REST API operations. @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_pagers.go b/sdk/resourcemanager/logic/armlogic/zz_generated_pagers.go index 767c3b155e7c..0a276e71c1af 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_pagers.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armlogic import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // IntegrationAccountAgreementsListPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_pollers.go b/sdk/resourcemanager/logic/armlogic/zz_generated_pollers.go index 76bfc7c7d249..e32623a14e24 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_pollers.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armlogic import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // IntegrationServiceEnvironmentManagedApisDeletePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_response_types.go b/sdk/resourcemanager/logic/armlogic/zz_generated_response_types.go index f2036f016363..a8cfaf2ab325 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_response_types.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armlogic import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // IntegrationAccountAgreementsCreateOrUpdateResponse contains the response from method IntegrationAccountAgreements.CreateOrUpdate. @@ -542,6 +541,8 @@ type IntegrationServiceEnvironmentManagedApisDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l IntegrationServiceEnvironmentManagedApisDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (IntegrationServiceEnvironmentManagedApisDeleteResponse, error) { respType := IntegrationServiceEnvironmentManagedApisDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -610,6 +611,8 @@ type IntegrationServiceEnvironmentManagedApisPutPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l IntegrationServiceEnvironmentManagedApisPutPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (IntegrationServiceEnvironmentManagedApisPutResponse, error) { respType := IntegrationServiceEnvironmentManagedApisPutResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.IntegrationServiceEnvironmentManagedAPI) @@ -685,6 +688,8 @@ type IntegrationServiceEnvironmentsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l IntegrationServiceEnvironmentsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (IntegrationServiceEnvironmentsCreateOrUpdateResponse, error) { respType := IntegrationServiceEnvironmentsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.IntegrationServiceEnvironment) @@ -783,6 +788,8 @@ type IntegrationServiceEnvironmentsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l IntegrationServiceEnvironmentsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (IntegrationServiceEnvironmentsUpdateResponse, error) { respType := IntegrationServiceEnvironmentsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.IntegrationServiceEnvironment) @@ -1267,6 +1274,8 @@ type WorkflowsMovePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WorkflowsMovePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WorkflowsMoveResponse, error) { respType := WorkflowsMoveResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_time_rfc3339.go b/sdk/resourcemanager/logic/armlogic/zz_generated_time_rfc3339.go index 6d412ae8192d..12f3a6911dc6 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armlogic import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactionrepetitions_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactionrepetitions_client.go index 8972a111f4a1..d73e57cbad1d 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactionrepetitions_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactionrepetitions_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // WorkflowRunActionRepetitionsClient contains the methods for the WorkflowRunActionRepetitions group. @@ -30,8 +31,15 @@ type WorkflowRunActionRepetitionsClient struct { } // NewWorkflowRunActionRepetitionsClient creates a new instance of WorkflowRunActionRepetitionsClient with the specified values. -func NewWorkflowRunActionRepetitionsClient(con *arm.Connection, subscriptionID string) *WorkflowRunActionRepetitionsClient { - return &WorkflowRunActionRepetitionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWorkflowRunActionRepetitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkflowRunActionRepetitionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WorkflowRunActionRepetitionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get a workflow run action repetition. @@ -93,7 +101,7 @@ func (client *WorkflowRunActionRepetitionsClient) getCreateRequest(ctx context.C func (client *WorkflowRunActionRepetitionsClient) getHandleResponse(resp *http.Response) (WorkflowRunActionRepetitionsGetResponse, error) { result := WorkflowRunActionRepetitionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowRunActionRepetitionDefinition); err != nil { - return WorkflowRunActionRepetitionsGetResponse{}, err + return WorkflowRunActionRepetitionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -166,7 +174,7 @@ func (client *WorkflowRunActionRepetitionsClient) listCreateRequest(ctx context. func (client *WorkflowRunActionRepetitionsClient) listHandleResponse(resp *http.Response) (WorkflowRunActionRepetitionsListResponse, error) { result := WorkflowRunActionRepetitionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowRunActionRepetitionDefinitionCollection); err != nil { - return WorkflowRunActionRepetitionsListResponse{}, err + return WorkflowRunActionRepetitionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -243,7 +251,7 @@ func (client *WorkflowRunActionRepetitionsClient) listExpressionTracesCreateRequ func (client *WorkflowRunActionRepetitionsClient) listExpressionTracesHandleResponse(resp *http.Response) (WorkflowRunActionRepetitionsListExpressionTracesResponse, error) { result := WorkflowRunActionRepetitionsListExpressionTracesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressionTraces); err != nil { - return WorkflowRunActionRepetitionsListExpressionTracesResponse{}, err + return WorkflowRunActionRepetitionsListExpressionTracesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactionrepetitionsrequesthistories_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactionrepetitionsrequesthistories_client.go index 67766802fcef..29d5b1402687 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactionrepetitionsrequesthistories_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactionrepetitionsrequesthistories_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // WorkflowRunActionRepetitionsRequestHistoriesClient contains the methods for the WorkflowRunActionRepetitionsRequestHistories group. @@ -30,8 +31,15 @@ type WorkflowRunActionRepetitionsRequestHistoriesClient struct { } // NewWorkflowRunActionRepetitionsRequestHistoriesClient creates a new instance of WorkflowRunActionRepetitionsRequestHistoriesClient with the specified values. -func NewWorkflowRunActionRepetitionsRequestHistoriesClient(con *arm.Connection, subscriptionID string) *WorkflowRunActionRepetitionsRequestHistoriesClient { - return &WorkflowRunActionRepetitionsRequestHistoriesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWorkflowRunActionRepetitionsRequestHistoriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkflowRunActionRepetitionsRequestHistoriesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WorkflowRunActionRepetitionsRequestHistoriesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a workflow run repetition request history. @@ -97,7 +105,7 @@ func (client *WorkflowRunActionRepetitionsRequestHistoriesClient) getCreateReque func (client *WorkflowRunActionRepetitionsRequestHistoriesClient) getHandleResponse(resp *http.Response) (WorkflowRunActionRepetitionsRequestHistoriesGetResponse, error) { result := WorkflowRunActionRepetitionsRequestHistoriesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RequestHistory); err != nil { - return WorkflowRunActionRepetitionsRequestHistoriesGetResponse{}, err + return WorkflowRunActionRepetitionsRequestHistoriesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -171,7 +179,7 @@ func (client *WorkflowRunActionRepetitionsRequestHistoriesClient) listCreateRequ func (client *WorkflowRunActionRepetitionsRequestHistoriesClient) listHandleResponse(resp *http.Response) (WorkflowRunActionRepetitionsRequestHistoriesListResponse, error) { result := WorkflowRunActionRepetitionsRequestHistoriesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RequestHistoryListResult); err != nil { - return WorkflowRunActionRepetitionsRequestHistoriesListResponse{}, err + return WorkflowRunActionRepetitionsRequestHistoriesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactionrequesthistories_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactionrequesthistories_client.go index 73dfc5f6e5a5..2bae6cd2e436 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactionrequesthistories_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactionrequesthistories_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // WorkflowRunActionRequestHistoriesClient contains the methods for the WorkflowRunActionRequestHistories group. @@ -30,8 +31,15 @@ type WorkflowRunActionRequestHistoriesClient struct { } // NewWorkflowRunActionRequestHistoriesClient creates a new instance of WorkflowRunActionRequestHistoriesClient with the specified values. -func NewWorkflowRunActionRequestHistoriesClient(con *arm.Connection, subscriptionID string) *WorkflowRunActionRequestHistoriesClient { - return &WorkflowRunActionRequestHistoriesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWorkflowRunActionRequestHistoriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkflowRunActionRequestHistoriesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WorkflowRunActionRequestHistoriesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a workflow run request history. @@ -93,7 +101,7 @@ func (client *WorkflowRunActionRequestHistoriesClient) getCreateRequest(ctx cont func (client *WorkflowRunActionRequestHistoriesClient) getHandleResponse(resp *http.Response) (WorkflowRunActionRequestHistoriesGetResponse, error) { result := WorkflowRunActionRequestHistoriesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RequestHistory); err != nil { - return WorkflowRunActionRequestHistoriesGetResponse{}, err + return WorkflowRunActionRequestHistoriesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -163,7 +171,7 @@ func (client *WorkflowRunActionRequestHistoriesClient) listCreateRequest(ctx con func (client *WorkflowRunActionRequestHistoriesClient) listHandleResponse(resp *http.Response) (WorkflowRunActionRequestHistoriesListResponse, error) { result := WorkflowRunActionRequestHistoriesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RequestHistoryListResult); err != nil { - return WorkflowRunActionRequestHistoriesListResponse{}, err + return WorkflowRunActionRequestHistoriesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactions_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactions_client.go index 04faa318430e..1ceab9850b0f 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactions_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactions_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // WorkflowRunActionsClient contains the methods for the WorkflowRunActions group. @@ -31,8 +32,15 @@ type WorkflowRunActionsClient struct { } // NewWorkflowRunActionsClient creates a new instance of WorkflowRunActionsClient with the specified values. -func NewWorkflowRunActionsClient(con *arm.Connection, subscriptionID string) *WorkflowRunActionsClient { - return &WorkflowRunActionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWorkflowRunActionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkflowRunActionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WorkflowRunActionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a workflow run action. @@ -90,7 +98,7 @@ func (client *WorkflowRunActionsClient) getCreateRequest(ctx context.Context, re func (client *WorkflowRunActionsClient) getHandleResponse(resp *http.Response) (WorkflowRunActionsGetResponse, error) { result := WorkflowRunActionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowRunAction); err != nil { - return WorkflowRunActionsGetResponse{}, err + return WorkflowRunActionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -162,7 +170,7 @@ func (client *WorkflowRunActionsClient) listCreateRequest(ctx context.Context, r func (client *WorkflowRunActionsClient) listHandleResponse(resp *http.Response) (WorkflowRunActionsListResponse, error) { result := WorkflowRunActionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowRunActionListResult); err != nil { - return WorkflowRunActionsListResponse{}, err + return WorkflowRunActionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -235,7 +243,7 @@ func (client *WorkflowRunActionsClient) listExpressionTracesCreateRequest(ctx co func (client *WorkflowRunActionsClient) listExpressionTracesHandleResponse(resp *http.Response) (WorkflowRunActionsListExpressionTracesResponse, error) { result := WorkflowRunActionsListExpressionTracesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressionTraces); err != nil { - return WorkflowRunActionsListExpressionTracesResponse{}, err + return WorkflowRunActionsListExpressionTracesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactionscoperepetitions_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactionscoperepetitions_client.go index e944d36dad60..126b9bf448b0 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactionscoperepetitions_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunactionscoperepetitions_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // WorkflowRunActionScopeRepetitionsClient contains the methods for the WorkflowRunActionScopeRepetitions group. @@ -30,8 +31,15 @@ type WorkflowRunActionScopeRepetitionsClient struct { } // NewWorkflowRunActionScopeRepetitionsClient creates a new instance of WorkflowRunActionScopeRepetitionsClient with the specified values. -func NewWorkflowRunActionScopeRepetitionsClient(con *arm.Connection, subscriptionID string) *WorkflowRunActionScopeRepetitionsClient { - return &WorkflowRunActionScopeRepetitionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWorkflowRunActionScopeRepetitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkflowRunActionScopeRepetitionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WorkflowRunActionScopeRepetitionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get a workflow run action scoped repetition. @@ -93,7 +101,7 @@ func (client *WorkflowRunActionScopeRepetitionsClient) getCreateRequest(ctx cont func (client *WorkflowRunActionScopeRepetitionsClient) getHandleResponse(resp *http.Response) (WorkflowRunActionScopeRepetitionsGetResponse, error) { result := WorkflowRunActionScopeRepetitionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowRunActionRepetitionDefinition); err != nil { - return WorkflowRunActionScopeRepetitionsGetResponse{}, err + return WorkflowRunActionScopeRepetitionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -166,7 +174,7 @@ func (client *WorkflowRunActionScopeRepetitionsClient) listCreateRequest(ctx con func (client *WorkflowRunActionScopeRepetitionsClient) listHandleResponse(resp *http.Response) (WorkflowRunActionScopeRepetitionsListResponse, error) { result := WorkflowRunActionScopeRepetitionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowRunActionRepetitionDefinitionCollection); err != nil { - return WorkflowRunActionScopeRepetitionsListResponse{}, err + return WorkflowRunActionScopeRepetitionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunoperations_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunoperations_client.go index 063183b8c93f..0c3bd9d4d9e0 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunoperations_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowrunoperations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // WorkflowRunOperationsClient contains the methods for the WorkflowRunOperations group. @@ -30,8 +31,15 @@ type WorkflowRunOperationsClient struct { } // NewWorkflowRunOperationsClient creates a new instance of WorkflowRunOperationsClient with the specified values. -func NewWorkflowRunOperationsClient(con *arm.Connection, subscriptionID string) *WorkflowRunOperationsClient { - return &WorkflowRunOperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWorkflowRunOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkflowRunOperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WorkflowRunOperationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets an operation for a run. @@ -89,7 +97,7 @@ func (client *WorkflowRunOperationsClient) getCreateRequest(ctx context.Context, func (client *WorkflowRunOperationsClient) getHandleResponse(resp *http.Response) (WorkflowRunOperationsGetResponse, error) { result := WorkflowRunOperationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowRun); err != nil { - return WorkflowRunOperationsGetResponse{}, err + return WorkflowRunOperationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowruns_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowruns_client.go index efda41ede4d7..8c1423102557 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowruns_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowruns_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // WorkflowRunsClient contains the methods for the WorkflowRuns group. @@ -31,8 +32,15 @@ type WorkflowRunsClient struct { } // NewWorkflowRunsClient creates a new instance of WorkflowRunsClient with the specified values. -func NewWorkflowRunsClient(con *arm.Connection, subscriptionID string) *WorkflowRunsClient { - return &WorkflowRunsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWorkflowRunsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkflowRunsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WorkflowRunsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Cancel - Cancels a workflow run. @@ -146,7 +154,7 @@ func (client *WorkflowRunsClient) getCreateRequest(ctx context.Context, resource func (client *WorkflowRunsClient) getHandleResponse(resp *http.Response) (WorkflowRunsGetResponse, error) { result := WorkflowRunsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowRun); err != nil { - return WorkflowRunsGetResponse{}, err + return WorkflowRunsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *WorkflowRunsClient) listCreateRequest(ctx context.Context, resourc func (client *WorkflowRunsClient) listHandleResponse(resp *http.Response) (WorkflowRunsListResponse, error) { result := WorkflowRunsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowRunListResult); err != nil { - return WorkflowRunsListResponse{}, err + return WorkflowRunsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_workflows_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_workflows_client.go index 233f8ac9473d..a457edc695e7 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_workflows_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_workflows_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // WorkflowsClient contains the methods for the Workflows group. @@ -32,8 +32,15 @@ type WorkflowsClient struct { } // NewWorkflowsClient creates a new instance of WorkflowsClient with the specified values. -func NewWorkflowsClient(con *arm.Connection, subscriptionID string) *WorkflowsClient { - return &WorkflowsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWorkflowsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkflowsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WorkflowsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a workflow. @@ -83,7 +90,7 @@ func (client *WorkflowsClient) createOrUpdateCreateRequest(ctx context.Context, func (client *WorkflowsClient) createOrUpdateHandleResponse(resp *http.Response) (WorkflowsCreateOrUpdateResponse, error) { result := WorkflowsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Workflow); err != nil { - return WorkflowsCreateOrUpdateResponse{}, err + return WorkflowsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -316,7 +323,7 @@ func (client *WorkflowsClient) generateUpgradedDefinitionCreateRequest(ctx conte func (client *WorkflowsClient) generateUpgradedDefinitionHandleResponse(resp *http.Response) (WorkflowsGenerateUpgradedDefinitionResponse, error) { result := WorkflowsGenerateUpgradedDefinitionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Object); err != nil { - return WorkflowsGenerateUpgradedDefinitionResponse{}, err + return WorkflowsGenerateUpgradedDefinitionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -381,7 +388,7 @@ func (client *WorkflowsClient) getCreateRequest(ctx context.Context, resourceGro func (client *WorkflowsClient) getHandleResponse(resp *http.Response) (WorkflowsGetResponse, error) { result := WorkflowsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Workflow); err != nil { - return WorkflowsGetResponse{}, err + return WorkflowsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -445,7 +452,7 @@ func (client *WorkflowsClient) listByResourceGroupCreateRequest(ctx context.Cont func (client *WorkflowsClient) listByResourceGroupHandleResponse(resp *http.Response) (WorkflowsListByResourceGroupResponse, error) { result := WorkflowsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowListResult); err != nil { - return WorkflowsListByResourceGroupResponse{}, err + return WorkflowsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -505,7 +512,7 @@ func (client *WorkflowsClient) listBySubscriptionCreateRequest(ctx context.Conte func (client *WorkflowsClient) listBySubscriptionHandleResponse(resp *http.Response) (WorkflowsListBySubscriptionResponse, error) { result := WorkflowsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowListResult); err != nil { - return WorkflowsListBySubscriptionResponse{}, err + return WorkflowsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -570,7 +577,7 @@ func (client *WorkflowsClient) listCallbackURLCreateRequest(ctx context.Context, func (client *WorkflowsClient) listCallbackURLHandleResponse(resp *http.Response) (WorkflowsListCallbackURLResponse, error) { result := WorkflowsListCallbackURLResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowTriggerCallbackURL); err != nil { - return WorkflowsListCallbackURLResponse{}, err + return WorkflowsListCallbackURLResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -635,7 +642,7 @@ func (client *WorkflowsClient) listSwaggerCreateRequest(ctx context.Context, res func (client *WorkflowsClient) listSwaggerHandleResponse(resp *http.Response) (WorkflowsListSwaggerResponse, error) { result := WorkflowsListSwaggerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Object); err != nil { - return WorkflowsListSwaggerResponse{}, err + return WorkflowsListSwaggerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -832,7 +839,7 @@ func (client *WorkflowsClient) updateCreateRequest(ctx context.Context, resource func (client *WorkflowsClient) updateHandleResponse(resp *http.Response) (WorkflowsUpdateResponse, error) { result := WorkflowsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Workflow); err != nil { - return WorkflowsUpdateResponse{}, err + return WorkflowsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowtriggerhistories_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowtriggerhistories_client.go index d442f29f2cd8..a8814a0e481b 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowtriggerhistories_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowtriggerhistories_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // WorkflowTriggerHistoriesClient contains the methods for the WorkflowTriggerHistories group. @@ -31,8 +32,15 @@ type WorkflowTriggerHistoriesClient struct { } // NewWorkflowTriggerHistoriesClient creates a new instance of WorkflowTriggerHistoriesClient with the specified values. -func NewWorkflowTriggerHistoriesClient(con *arm.Connection, subscriptionID string) *WorkflowTriggerHistoriesClient { - return &WorkflowTriggerHistoriesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWorkflowTriggerHistoriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkflowTriggerHistoriesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WorkflowTriggerHistoriesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a workflow trigger history. @@ -90,7 +98,7 @@ func (client *WorkflowTriggerHistoriesClient) getCreateRequest(ctx context.Conte func (client *WorkflowTriggerHistoriesClient) getHandleResponse(resp *http.Response) (WorkflowTriggerHistoriesGetResponse, error) { result := WorkflowTriggerHistoriesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowTriggerHistory); err != nil { - return WorkflowTriggerHistoriesGetResponse{}, err + return WorkflowTriggerHistoriesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -162,7 +170,7 @@ func (client *WorkflowTriggerHistoriesClient) listCreateRequest(ctx context.Cont func (client *WorkflowTriggerHistoriesClient) listHandleResponse(resp *http.Response) (WorkflowTriggerHistoriesListResponse, error) { result := WorkflowTriggerHistoriesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowTriggerHistoryListResult); err != nil { - return WorkflowTriggerHistoriesListResponse{}, err + return WorkflowTriggerHistoriesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowtriggers_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowtriggers_client.go index 25588be65d61..b9d62cd17b37 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowtriggers_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowtriggers_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // WorkflowTriggersClient contains the methods for the WorkflowTriggers group. @@ -31,8 +32,15 @@ type WorkflowTriggersClient struct { } // NewWorkflowTriggersClient creates a new instance of WorkflowTriggersClient with the specified values. -func NewWorkflowTriggersClient(con *arm.Connection, subscriptionID string) *WorkflowTriggersClient { - return &WorkflowTriggersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWorkflowTriggersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkflowTriggersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WorkflowTriggersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a workflow trigger. @@ -86,7 +94,7 @@ func (client *WorkflowTriggersClient) getCreateRequest(ctx context.Context, reso func (client *WorkflowTriggersClient) getHandleResponse(resp *http.Response) (WorkflowTriggersGetResponse, error) { result := WorkflowTriggersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowTrigger); err != nil { - return WorkflowTriggersGetResponse{}, err + return WorkflowTriggersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -155,7 +163,7 @@ func (client *WorkflowTriggersClient) getSchemaJSONCreateRequest(ctx context.Con func (client *WorkflowTriggersClient) getSchemaJSONHandleResponse(resp *http.Response) (WorkflowTriggersGetSchemaJSONResponse, error) { result := WorkflowTriggersGetSchemaJSONResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JSONSchema); err != nil { - return WorkflowTriggersGetSchemaJSONResponse{}, err + return WorkflowTriggersGetSchemaJSONResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -223,7 +231,7 @@ func (client *WorkflowTriggersClient) listCreateRequest(ctx context.Context, res func (client *WorkflowTriggersClient) listHandleResponse(resp *http.Response) (WorkflowTriggersListResponse, error) { result := WorkflowTriggersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowTriggerListResult); err != nil { - return WorkflowTriggersListResponse{}, err + return WorkflowTriggersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -292,7 +300,7 @@ func (client *WorkflowTriggersClient) listCallbackURLCreateRequest(ctx context.C func (client *WorkflowTriggersClient) listCallbackURLHandleResponse(resp *http.Response) (WorkflowTriggersListCallbackURLResponse, error) { result := WorkflowTriggersListCallbackURLResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowTriggerCallbackURL); err != nil { - return WorkflowTriggersListCallbackURLResponse{}, err + return WorkflowTriggersListCallbackURLResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowversions_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowversions_client.go index b60099e95824..f06d00ab3f13 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowversions_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowversions_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // WorkflowVersionsClient contains the methods for the WorkflowVersions group. @@ -31,8 +32,15 @@ type WorkflowVersionsClient struct { } // NewWorkflowVersionsClient creates a new instance of WorkflowVersionsClient with the specified values. -func NewWorkflowVersionsClient(con *arm.Connection, subscriptionID string) *WorkflowVersionsClient { - return &WorkflowVersionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWorkflowVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkflowVersionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WorkflowVersionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a workflow version. @@ -86,7 +94,7 @@ func (client *WorkflowVersionsClient) getCreateRequest(ctx context.Context, reso func (client *WorkflowVersionsClient) getHandleResponse(resp *http.Response) (WorkflowVersionsGetResponse, error) { result := WorkflowVersionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowVersion); err != nil { - return WorkflowVersionsGetResponse{}, err + return WorkflowVersionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -151,7 +159,7 @@ func (client *WorkflowVersionsClient) listCreateRequest(ctx context.Context, res func (client *WorkflowVersionsClient) listHandleResponse(resp *http.Response) (WorkflowVersionsListResponse, error) { result := WorkflowVersionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowVersionListResult); err != nil { - return WorkflowVersionsListResponse{}, err + return WorkflowVersionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowversiontriggers_client.go b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowversiontriggers_client.go index e605ac5a7165..62c75b43c0c5 100644 --- a/sdk/resourcemanager/logic/armlogic/zz_generated_workflowversiontriggers_client.go +++ b/sdk/resourcemanager/logic/armlogic/zz_generated_workflowversiontriggers_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // WorkflowVersionTriggersClient contains the methods for the WorkflowVersionTriggers group. @@ -30,8 +31,15 @@ type WorkflowVersionTriggersClient struct { } // NewWorkflowVersionTriggersClient creates a new instance of WorkflowVersionTriggersClient with the specified values. -func NewWorkflowVersionTriggersClient(con *arm.Connection, subscriptionID string) *WorkflowVersionTriggersClient { - return &WorkflowVersionTriggersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWorkflowVersionTriggersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkflowVersionTriggersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WorkflowVersionTriggersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListCallbackURL - Get the callback url for a trigger of a workflow version. @@ -92,7 +100,7 @@ func (client *WorkflowVersionTriggersClient) listCallbackURLCreateRequest(ctx co func (client *WorkflowVersionTriggersClient) listCallbackURLHandleResponse(resp *http.Response) (WorkflowVersionTriggersListCallbackURLResponse, error) { result := WorkflowVersionTriggersListCallbackURLResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkflowTriggerCallbackURL); err != nil { - return WorkflowVersionTriggersListCallbackURLResponse{}, err + return WorkflowVersionTriggersListCallbackURLResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/CHANGELOG.md b/sdk/resourcemanager/managementgroups/armmanagementgroups/CHANGELOG.md index e4f3d9f035c1..6ee9f3587c1a 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/CHANGELOG.md +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-26) diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/README.md b/sdk/resourcemanager/managementgroups/armmanagementgroups/README.md index 512caf665c88..fb3f76c6b7d8 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/README.md +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Management Groups +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Management Groups modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armmanagementgroups.NewOperationsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Management Groups modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armmanagementgroups.NewOperationsClient(con) +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armmanagementgroups.NewOperationsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/autorest.md b/sdk/resourcemanager/managementgroups/armmanagementgroups/autorest.md index 8fcc2434a01c..e792fe98981f 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/autorest.md +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/4aebac1bd77282ae8efe3dd2886e864537d31762/specification/managementgroups/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/4aebac1bd77282ae8efe3dd2886e864537d31762/specification/managementgroups/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/managementgroups/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/managementgroups/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/go.mod b/sdk/resourcemanager/managementgroups/armmanagementgroups/go.mod index 9fb28f78dd96..63d4cb3f6e32 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/go.mod +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/managementgroups/ar go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.3.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/go.sum b/sdk/resourcemanager/managementgroups/armmanagementgroups/go.sum index af10d0f1292e..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/go.sum +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.3.0+incompatible h1:lb9OWePNuJMiibdxg9XvdbiOldR0Yifge37L4LoOxIs= -github.com/Azure/azure-sdk-for-go v58.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_constants.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_constants.go index 87a102b52d41..458eed868d59 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_constants.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_constants.go @@ -10,7 +10,7 @@ package armmanagementgroups const ( module = "armmanagementgroups" - version = "v0.1.1" + version = "v0.2.0" ) type Enum0 string diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_entities_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_entities_client.go index 796b709ae3f4..b807814ca94d 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_entities_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_entities_client.go @@ -11,12 +11,13 @@ package armmanagementgroups import ( "context" "fmt" - "net/http" - "strconv" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strconv" ) // EntitiesClient contains the methods for the Entities group. @@ -27,8 +28,15 @@ type EntitiesClient struct { } // NewEntitiesClient creates a new instance of EntitiesClient with the specified values. -func NewEntitiesClient(con *arm.Connection) *EntitiesClient { - return &EntitiesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewEntitiesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *EntitiesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &EntitiesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - List all entities (Management Groups, Subscriptions, etc.) for the authenticated user. @@ -90,7 +98,7 @@ func (client *EntitiesClient) listCreateRequest(ctx context.Context, options *En func (client *EntitiesClient) listHandleResponse(resp *http.Response) (EntitiesListResponse, error) { result := EntitiesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EntityListResult); err != nil { - return EntitiesListResponse{}, err + return EntitiesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_hierarchysettings_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_hierarchysettings_client.go index 93a98163ad68..b4ecf32961f9 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_hierarchysettings_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_hierarchysettings_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // HierarchySettingsClient contains the methods for the HierarchySettings group. @@ -29,8 +30,15 @@ type HierarchySettingsClient struct { } // NewHierarchySettingsClient creates a new instance of HierarchySettingsClient with the specified values. -func NewHierarchySettingsClient(con *arm.Connection) *HierarchySettingsClient { - return &HierarchySettingsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewHierarchySettingsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *HierarchySettingsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &HierarchySettingsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the hierarchy settings defined at the Management Group level. @@ -72,7 +80,7 @@ func (client *HierarchySettingsClient) createOrUpdateCreateRequest(ctx context.C func (client *HierarchySettingsClient) createOrUpdateHandleResponse(resp *http.Response) (HierarchySettingsCreateOrUpdateResponse, error) { result := HierarchySettingsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HierarchySettings); err != nil { - return HierarchySettingsCreateOrUpdateResponse{}, err + return HierarchySettingsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -177,7 +185,7 @@ func (client *HierarchySettingsClient) getCreateRequest(ctx context.Context, gro func (client *HierarchySettingsClient) getHandleResponse(resp *http.Response) (HierarchySettingsGetResponse, error) { result := HierarchySettingsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HierarchySettings); err != nil { - return HierarchySettingsGetResponse{}, err + return HierarchySettingsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -234,7 +242,7 @@ func (client *HierarchySettingsClient) listCreateRequest(ctx context.Context, gr func (client *HierarchySettingsClient) listHandleResponse(resp *http.Response) (HierarchySettingsListResponse, error) { result := HierarchySettingsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HierarchySettingsList); err != nil { - return HierarchySettingsListResponse{}, err + return HierarchySettingsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -291,7 +299,7 @@ func (client *HierarchySettingsClient) updateCreateRequest(ctx context.Context, func (client *HierarchySettingsClient) updateHandleResponse(resp *http.Response) (HierarchySettingsUpdateResponse, error) { result := HierarchySettingsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HierarchySettings); err != nil { - return HierarchySettingsUpdateResponse{}, err + return HierarchySettingsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_managementgroups_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_managementgroups_client.go index 6a85cd1aa352..915a7d2c34ff 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_managementgroups_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_managementgroups_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // ManagementGroupsClient contains the methods for the ManagementGroups group. @@ -31,8 +31,15 @@ type ManagementGroupsClient struct { } // NewManagementGroupsClient creates a new instance of ManagementGroupsClient with the specified values. -func NewManagementGroupsClient(con *arm.Connection) *ManagementGroupsClient { - return &ManagementGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewManagementGroupsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ManagementGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagementGroupsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update a management group. If a management group is already created and a subsequent create request is issued with different @@ -230,7 +237,7 @@ func (client *ManagementGroupsClient) getCreateRequest(ctx context.Context, grou func (client *ManagementGroupsClient) getHandleResponse(resp *http.Response) (ManagementGroupsGetResponse, error) { result := ManagementGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagementGroup); err != nil { - return ManagementGroupsGetResponse{}, err + return ManagementGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -290,7 +297,7 @@ func (client *ManagementGroupsClient) getDescendantsCreateRequest(ctx context.Co func (client *ManagementGroupsClient) getDescendantsHandleResponse(resp *http.Response) (ManagementGroupsGetDescendantsResponse, error) { result := ManagementGroupsGetDescendantsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DescendantListResult); err != nil { - return ManagementGroupsGetDescendantsResponse{}, err + return ManagementGroupsGetDescendantsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -346,7 +353,7 @@ func (client *ManagementGroupsClient) listCreateRequest(ctx context.Context, opt func (client *ManagementGroupsClient) listHandleResponse(resp *http.Response) (ManagementGroupsListResponse, error) { result := ManagementGroupsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagementGroupListResult); err != nil { - return ManagementGroupsListResponse{}, err + return ManagementGroupsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -406,7 +413,7 @@ func (client *ManagementGroupsClient) updateCreateRequest(ctx context.Context, g func (client *ManagementGroupsClient) updateHandleResponse(resp *http.Response) (ManagementGroupsUpdateResponse, error) { result := ManagementGroupsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagementGroup); err != nil { - return ManagementGroupsUpdateResponse{}, err + return ManagementGroupsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_managementgroupsapi_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_managementgroupsapi_client.go index 84fa10a06def..adb87bce3910 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_managementgroupsapi_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_managementgroupsapi_client.go @@ -11,11 +11,12 @@ package armmanagementgroups import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // ManagementGroupsAPIClient contains the methods for the ManagementGroupsAPI group. @@ -26,8 +27,15 @@ type ManagementGroupsAPIClient struct { } // NewManagementGroupsAPIClient creates a new instance of ManagementGroupsAPIClient with the specified values. -func NewManagementGroupsAPIClient(con *arm.Connection) *ManagementGroupsAPIClient { - return &ManagementGroupsAPIClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewManagementGroupsAPIClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ManagementGroupsAPIClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagementGroupsAPIClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNameAvailability - Checks if the specified management group name is valid and unique @@ -65,7 +73,7 @@ func (client *ManagementGroupsAPIClient) checkNameAvailabilityCreateRequest(ctx func (client *ManagementGroupsAPIClient) checkNameAvailabilityHandleResponse(resp *http.Response) (ManagementGroupsAPICheckNameAvailabilityResponse, error) { result := ManagementGroupsAPICheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResult); err != nil { - return ManagementGroupsAPICheckNameAvailabilityResponse{}, err + return ManagementGroupsAPICheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -118,7 +126,7 @@ func (client *ManagementGroupsAPIClient) startTenantBackfillCreateRequest(ctx co func (client *ManagementGroupsAPIClient) startTenantBackfillHandleResponse(resp *http.Response) (ManagementGroupsAPIStartTenantBackfillResponse, error) { result := ManagementGroupsAPIStartTenantBackfillResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TenantBackfillStatusResult); err != nil { - return ManagementGroupsAPIStartTenantBackfillResponse{}, err + return ManagementGroupsAPIStartTenantBackfillResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -171,7 +179,7 @@ func (client *ManagementGroupsAPIClient) tenantBackfillStatusCreateRequest(ctx c func (client *ManagementGroupsAPIClient) tenantBackfillStatusHandleResponse(resp *http.Response) (ManagementGroupsAPITenantBackfillStatusResponse, error) { result := ManagementGroupsAPITenantBackfillStatusResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TenantBackfillStatusResult); err != nil { - return ManagementGroupsAPITenantBackfillStatusResponse{}, err + return ManagementGroupsAPITenantBackfillStatusResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_managementgroupsubscriptions_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_managementgroupsubscriptions_client.go index d9d4f84c13a4..751efb0e4ee4 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_managementgroupsubscriptions_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_managementgroupsubscriptions_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagementGroupSubscriptionsClient contains the methods for the ManagementGroupSubscriptions group. @@ -29,8 +30,15 @@ type ManagementGroupSubscriptionsClient struct { } // NewManagementGroupSubscriptionsClient creates a new instance of ManagementGroupSubscriptionsClient with the specified values. -func NewManagementGroupSubscriptionsClient(con *arm.Connection) *ManagementGroupSubscriptionsClient { - return &ManagementGroupSubscriptionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewManagementGroupSubscriptionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ManagementGroupSubscriptionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagementGroupSubscriptionsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Associates existing subscription with the management group. @@ -79,7 +87,7 @@ func (client *ManagementGroupSubscriptionsClient) createCreateRequest(ctx contex func (client *ManagementGroupSubscriptionsClient) createHandleResponse(resp *http.Response) (ManagementGroupSubscriptionsCreateResponse, error) { result := ManagementGroupSubscriptionsCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionUnderManagementGroup); err != nil { - return ManagementGroupSubscriptionsCreateResponse{}, err + return ManagementGroupSubscriptionsCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -198,7 +206,7 @@ func (client *ManagementGroupSubscriptionsClient) getSubscriptionCreateRequest(c func (client *ManagementGroupSubscriptionsClient) getSubscriptionHandleResponse(resp *http.Response) (ManagementGroupSubscriptionsGetSubscriptionResponse, error) { result := ManagementGroupSubscriptionsGetSubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionUnderManagementGroup); err != nil { - return ManagementGroupSubscriptionsGetSubscriptionResponse{}, err + return ManagementGroupSubscriptionsGetSubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -255,7 +263,7 @@ func (client *ManagementGroupSubscriptionsClient) getSubscriptionsUnderManagemen func (client *ManagementGroupSubscriptionsClient) getSubscriptionsUnderManagementGroupHandleResponse(resp *http.Response) (ManagementGroupSubscriptionsGetSubscriptionsUnderManagementGroupResponse, error) { result := ManagementGroupSubscriptionsGetSubscriptionsUnderManagementGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListSubscriptionUnderManagementGroup); err != nil { - return ManagementGroupSubscriptionsGetSubscriptionsUnderManagementGroupResponse{}, err + return ManagementGroupSubscriptionsGetSubscriptionsUnderManagementGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_models.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_models.go index 0a8991f58bcc..6a7963fb7c47 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_models.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_models.go @@ -10,10 +10,9 @@ package armmanagementgroups import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // AzureAsyncOperationResults - The results of Azure-AsyncOperation. @@ -108,7 +107,7 @@ func (c CreateManagementGroupDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "parent", c.Parent) populate(objectMap, "updatedBy", c.UpdatedBy) - populate(objectMap, "updatedTime", (*timeRFC3339)(c.UpdatedTime)) + populateTimeRFC3339(objectMap, "updatedTime", c.UpdatedTime) populate(objectMap, "version", c.Version) return json.Marshal(objectMap) } @@ -129,9 +128,7 @@ func (c *CreateManagementGroupDetails) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.UpdatedBy) delete(rawMsg, key) case "updatedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.UpdatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.UpdatedTime) delete(rawMsg, key) case "version": err = unpopulate(val, &c.Version) @@ -637,7 +634,7 @@ func (m ManagementGroupDetails) MarshalJSON() ([]byte, error) { populate(objectMap, "parent", m.Parent) populate(objectMap, "path", m.Path) populate(objectMap, "updatedBy", m.UpdatedBy) - populate(objectMap, "updatedTime", (*timeRFC3339)(m.UpdatedTime)) + populateTimeRFC3339(objectMap, "updatedTime", m.UpdatedTime) populate(objectMap, "version", m.Version) return json.Marshal(objectMap) } @@ -667,9 +664,7 @@ func (m *ManagementGroupDetails) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.UpdatedBy) delete(rawMsg, key) case "updatedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.UpdatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.UpdatedTime) delete(rawMsg, key) case "version": err = unpopulate(val, &m.Version) diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_operations_client.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_operations_client.go index 7b1f9955d427..3b4f7094f276 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_operations_client.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armmanagementgroups import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available Management REST API operations. @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_pagers.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_pagers.go index f8ee85597c9e..101aea8cf552 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_pagers.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armmanagementgroups import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // EntitiesListPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_pollers.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_pollers.go index d3656a55e60e..f9482a4ed5f6 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_pollers.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armmanagementgroups import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // ManagementGroupsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_response_types.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_response_types.go index ee1026b5fcda..0624eebae7d0 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_response_types.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armmanagementgroups import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // EntitiesListResponse contains the response from method Entities.List. @@ -170,6 +169,8 @@ type ManagementGroupsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagementGroupsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagementGroupsCreateOrUpdateResponse, error) { respType := ManagementGroupsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagementGroup) @@ -220,6 +221,8 @@ type ManagementGroupsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagementGroupsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagementGroupsDeleteResponse, error) { respType := ManagementGroupsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AzureAsyncOperationResults) diff --git a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_time_rfc3339.go b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_time_rfc3339.go index c23b6f58e1cc..91ad309b0af7 100644 --- a/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/managementgroups/armmanagementgroups/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armmanagementgroups import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/CHANGELOG.md b/sdk/resourcemanager/mediaservices/armmediaservices/CHANGELOG.md index e4f3d9f035c1..6ee9f3587c1a 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/CHANGELOG.md +++ b/sdk/resourcemanager/mediaservices/armmediaservices/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-26) diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/README.md b/sdk/resourcemanager/mediaservices/armmediaservices/README.md index 59d2b3101e54..0999a5e6ef49 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/README.md +++ b/sdk/resourcemanager/mediaservices/armmediaservices/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Media Services +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Media Services modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armmediaservices.NewMediaservicesClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Media Services modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armmediaservices.NewMediaservicesClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armmediaservices.NewMediaservicesClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/autorest.md b/sdk/resourcemanager/mediaservices/armmediaservices/autorest.md index b7fc4b3f3366..a2f61200a365 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/autorest.md +++ b/sdk/resourcemanager/mediaservices/armmediaservices/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/c4d19b8362dfa8001c78062659ab88c529ece7b6/specification/mediaservices/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/c4d19b8362dfa8001c78062659ab88c529ece7b6/specification/mediaservices/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/mediaservices/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/mediaservices/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/go.mod b/sdk/resourcemanager/mediaservices/armmediaservices/go.mod index 25a425916f0e..961d4190f06d 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/go.mod +++ b/sdk/resourcemanager/mediaservices/armmediaservices/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mediaservices/armme go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.2.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/go.sum b/sdk/resourcemanager/mediaservices/armmediaservices/go.sum index c8ff7a2143ad..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/go.sum +++ b/sdk/resourcemanager/mediaservices/armmediaservices/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible h1:iCb2tuoEm3N7ZpUDOvu1Yxl1B3iOVDmaD6weaRuIPzs= -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_accountfilters_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_accountfilters_client.go index a8009fff16ea..9e21f49d928c 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_accountfilters_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_accountfilters_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AccountFiltersClient contains the methods for the AccountFilters group. @@ -30,8 +31,15 @@ type AccountFiltersClient struct { } // NewAccountFiltersClient creates a new instance of AccountFiltersClient with the specified values. -func NewAccountFiltersClient(con *arm.Connection, subscriptionID string) *AccountFiltersClient { - return &AccountFiltersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAccountFiltersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AccountFiltersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AccountFiltersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates an Account Filter in the Media Services account. @@ -85,7 +93,7 @@ func (client *AccountFiltersClient) createOrUpdateCreateRequest(ctx context.Cont func (client *AccountFiltersClient) createOrUpdateHandleResponse(resp *http.Response) (AccountFiltersCreateOrUpdateResponse, error) { result := AccountFiltersCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccountFilter); err != nil { - return AccountFiltersCreateOrUpdateResponse{}, err + return AccountFiltersCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *AccountFiltersClient) getCreateRequest(ctx context.Context, resour func (client *AccountFiltersClient) getHandleResponse(resp *http.Response) (AccountFiltersGetResponse, error) { result := AccountFiltersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccountFilter); err != nil { - return AccountFiltersGetResponse{}, err + return AccountFiltersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -276,7 +284,7 @@ func (client *AccountFiltersClient) listCreateRequest(ctx context.Context, resou func (client *AccountFiltersClient) listHandleResponse(resp *http.Response) (AccountFiltersListResponse, error) { result := AccountFiltersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccountFilterCollection); err != nil { - return AccountFiltersListResponse{}, err + return AccountFiltersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -345,7 +353,7 @@ func (client *AccountFiltersClient) updateCreateRequest(ctx context.Context, res func (client *AccountFiltersClient) updateHandleResponse(resp *http.Response) (AccountFiltersUpdateResponse, error) { result := AccountFiltersUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccountFilter); err != nil { - return AccountFiltersUpdateResponse{}, err + return AccountFiltersUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assetfilters_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assetfilters_client.go index fbdc8ce546fd..94f74601022c 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assetfilters_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assetfilters_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AssetFiltersClient contains the methods for the AssetFilters group. @@ -30,8 +31,15 @@ type AssetFiltersClient struct { } // NewAssetFiltersClient creates a new instance of AssetFiltersClient with the specified values. -func NewAssetFiltersClient(con *arm.Connection, subscriptionID string) *AssetFiltersClient { - return &AssetFiltersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAssetFiltersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AssetFiltersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AssetFiltersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates an Asset Filter associated with the specified Asset. @@ -89,7 +97,7 @@ func (client *AssetFiltersClient) createOrUpdateCreateRequest(ctx context.Contex func (client *AssetFiltersClient) createOrUpdateHandleResponse(resp *http.Response) (AssetFiltersCreateOrUpdateResponse, error) { result := AssetFiltersCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AssetFilter); err != nil { - return AssetFiltersCreateOrUpdateResponse{}, err + return AssetFiltersCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -226,7 +234,7 @@ func (client *AssetFiltersClient) getCreateRequest(ctx context.Context, resource func (client *AssetFiltersClient) getHandleResponse(resp *http.Response) (AssetFiltersGetResponse, error) { result := AssetFiltersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AssetFilter); err != nil { - return AssetFiltersGetResponse{}, err + return AssetFiltersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -292,7 +300,7 @@ func (client *AssetFiltersClient) listCreateRequest(ctx context.Context, resourc func (client *AssetFiltersClient) listHandleResponse(resp *http.Response) (AssetFiltersListResponse, error) { result := AssetFiltersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AssetFilterCollection); err != nil { - return AssetFiltersListResponse{}, err + return AssetFiltersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -365,7 +373,7 @@ func (client *AssetFiltersClient) updateCreateRequest(ctx context.Context, resou func (client *AssetFiltersClient) updateHandleResponse(resp *http.Response) (AssetFiltersUpdateResponse, error) { result := AssetFiltersUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AssetFilter); err != nil { - return AssetFiltersUpdateResponse{}, err + return AssetFiltersUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assets_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assets_client.go index b22519a586ea..1afe0cfefa86 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assets_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_assets_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // AssetsClient contains the methods for the Assets group. @@ -31,8 +32,15 @@ type AssetsClient struct { } // NewAssetsClient creates a new instance of AssetsClient with the specified values. -func NewAssetsClient(con *arm.Connection, subscriptionID string) *AssetsClient { - return &AssetsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAssetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AssetsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AssetsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates an Asset in the Media Services account @@ -86,7 +94,7 @@ func (client *AssetsClient) createOrUpdateCreateRequest(ctx context.Context, res func (client *AssetsClient) createOrUpdateHandleResponse(resp *http.Response) (AssetsCreateOrUpdateResponse, error) { result := AssetsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Asset); err != nil { - return AssetsCreateOrUpdateResponse{}, err + return AssetsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -215,7 +223,7 @@ func (client *AssetsClient) getCreateRequest(ctx context.Context, resourceGroupN func (client *AssetsClient) getHandleResponse(resp *http.Response) (AssetsGetResponse, error) { result := AssetsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Asset); err != nil { - return AssetsGetResponse{}, err + return AssetsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -284,7 +292,7 @@ func (client *AssetsClient) getEncryptionKeyCreateRequest(ctx context.Context, r func (client *AssetsClient) getEncryptionKeyHandleResponse(resp *http.Response) (AssetsGetEncryptionKeyResponse, error) { result := AssetsGetEncryptionKeyResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StorageEncryptedAssetDecryptionData); err != nil { - return AssetsGetEncryptionKeyResponse{}, err + return AssetsGetEncryptionKeyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -355,7 +363,7 @@ func (client *AssetsClient) listCreateRequest(ctx context.Context, resourceGroup func (client *AssetsClient) listHandleResponse(resp *http.Response) (AssetsListResponse, error) { result := AssetsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AssetCollection); err != nil { - return AssetsListResponse{}, err + return AssetsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -425,7 +433,7 @@ func (client *AssetsClient) listContainerSasCreateRequest(ctx context.Context, r func (client *AssetsClient) listContainerSasHandleResponse(resp *http.Response) (AssetsListContainerSasResponse, error) { result := AssetsListContainerSasResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AssetContainerSas); err != nil { - return AssetsListContainerSasResponse{}, err + return AssetsListContainerSasResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -494,7 +502,7 @@ func (client *AssetsClient) listStreamingLocatorsCreateRequest(ctx context.Conte func (client *AssetsClient) listStreamingLocatorsHandleResponse(resp *http.Response) (AssetsListStreamingLocatorsResponse, error) { result := AssetsListStreamingLocatorsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListStreamingLocatorsResponse); err != nil { - return AssetsListStreamingLocatorsResponse{}, err + return AssetsListStreamingLocatorsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -563,7 +571,7 @@ func (client *AssetsClient) updateCreateRequest(ctx context.Context, resourceGro func (client *AssetsClient) updateHandleResponse(resp *http.Response) (AssetsUpdateResponse, error) { result := AssetsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Asset); err != nil { - return AssetsUpdateResponse{}, err + return AssetsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_constants.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_constants.go index 444387ff1ed8..b57af9559ead 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_constants.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_constants.go @@ -10,7 +10,7 @@ package armmediaservices const ( module = "armmediaservices" - version = "v0.1.1" + version = "v0.2.0" ) // AacAudioProfile - The encoding profile to be used when encoding audio with AAC. diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_contentkeypolicies_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_contentkeypolicies_client.go index 7f5f56cf06fc..b7f5797e326c 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_contentkeypolicies_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_contentkeypolicies_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // ContentKeyPoliciesClient contains the methods for the ContentKeyPolicies group. @@ -31,8 +32,15 @@ type ContentKeyPoliciesClient struct { } // NewContentKeyPoliciesClient creates a new instance of ContentKeyPoliciesClient with the specified values. -func NewContentKeyPoliciesClient(con *arm.Connection, subscriptionID string) *ContentKeyPoliciesClient { - return &ContentKeyPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewContentKeyPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ContentKeyPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ContentKeyPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update a Content Key Policy in the Media Services account @@ -86,7 +94,7 @@ func (client *ContentKeyPoliciesClient) createOrUpdateCreateRequest(ctx context. func (client *ContentKeyPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (ContentKeyPoliciesCreateOrUpdateResponse, error) { result := ContentKeyPoliciesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ContentKeyPolicy); err != nil { - return ContentKeyPoliciesCreateOrUpdateResponse{}, err + return ContentKeyPoliciesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -215,7 +223,7 @@ func (client *ContentKeyPoliciesClient) getCreateRequest(ctx context.Context, re func (client *ContentKeyPoliciesClient) getHandleResponse(resp *http.Response) (ContentKeyPoliciesGetResponse, error) { result := ContentKeyPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ContentKeyPolicy); err != nil { - return ContentKeyPoliciesGetResponse{}, err + return ContentKeyPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -284,7 +292,7 @@ func (client *ContentKeyPoliciesClient) getPolicyPropertiesWithSecretsCreateRequ func (client *ContentKeyPoliciesClient) getPolicyPropertiesWithSecretsHandleResponse(resp *http.Response) (ContentKeyPoliciesGetPolicyPropertiesWithSecretsResponse, error) { result := ContentKeyPoliciesGetPolicyPropertiesWithSecretsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ContentKeyPolicyProperties); err != nil { - return ContentKeyPoliciesGetPolicyPropertiesWithSecretsResponse{}, err + return ContentKeyPoliciesGetPolicyPropertiesWithSecretsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -355,7 +363,7 @@ func (client *ContentKeyPoliciesClient) listCreateRequest(ctx context.Context, r func (client *ContentKeyPoliciesClient) listHandleResponse(resp *http.Response) (ContentKeyPoliciesListResponse, error) { result := ContentKeyPoliciesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ContentKeyPolicyCollection); err != nil { - return ContentKeyPoliciesListResponse{}, err + return ContentKeyPoliciesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -424,7 +432,7 @@ func (client *ContentKeyPoliciesClient) updateCreateRequest(ctx context.Context, func (client *ContentKeyPoliciesClient) updateHandleResponse(resp *http.Response) (ContentKeyPoliciesUpdateResponse, error) { result := ContentKeyPoliciesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ContentKeyPolicy); err != nil { - return ContentKeyPoliciesUpdateResponse{}, err + return ContentKeyPoliciesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_jobs_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_jobs_client.go index 5fece488786b..a60b93f5a7c6 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_jobs_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_jobs_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // JobsClient contains the methods for the Jobs group. @@ -30,8 +31,15 @@ type JobsClient struct { } // NewJobsClient creates a new instance of JobsClient with the specified values. -func NewJobsClient(con *arm.Connection, subscriptionID string) *JobsClient { - return &JobsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *JobsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &JobsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CancelJob - Cancel a Job. @@ -153,7 +161,7 @@ func (client *JobsClient) createCreateRequest(ctx context.Context, resourceGroup func (client *JobsClient) createHandleResponse(resp *http.Response) (JobsCreateResponse, error) { result := JobsCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Job); err != nil { - return JobsCreateResponse{}, err + return JobsCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -290,7 +298,7 @@ func (client *JobsClient) getCreateRequest(ctx context.Context, resourceGroupNam func (client *JobsClient) getHandleResponse(resp *http.Response) (JobsGetResponse, error) { result := JobsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Job); err != nil { - return JobsGetResponse{}, err + return JobsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -362,7 +370,7 @@ func (client *JobsClient) listCreateRequest(ctx context.Context, resourceGroupNa func (client *JobsClient) listHandleResponse(resp *http.Response) (JobsListResponse, error) { result := JobsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobCollection); err != nil { - return JobsListResponse{}, err + return JobsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -436,7 +444,7 @@ func (client *JobsClient) updateCreateRequest(ctx context.Context, resourceGroup func (client *JobsClient) updateHandleResponse(resp *http.Response) (JobsUpdateResponse, error) { result := JobsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Job); err != nil { - return JobsUpdateResponse{}, err + return JobsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveevents_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveevents_client.go index 31a0ae015960..c2d724aee2aa 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveevents_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveevents_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // LiveEventsClient contains the methods for the LiveEvents group. @@ -32,8 +32,15 @@ type LiveEventsClient struct { } // NewLiveEventsClient creates a new instance of LiveEventsClient with the specified values. -func NewLiveEventsClient(con *arm.Connection, subscriptionID string) *LiveEventsClient { - return &LiveEventsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLiveEventsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LiveEventsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LiveEventsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginAllocate - A live event is in StandBy state after allocation completes, and is ready to start. @@ -330,7 +337,7 @@ func (client *LiveEventsClient) getCreateRequest(ctx context.Context, resourceGr func (client *LiveEventsClient) getHandleResponse(resp *http.Response) (LiveEventsGetResponse, error) { result := LiveEventsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LiveEvent); err != nil { - return LiveEventsGetResponse{}, err + return LiveEventsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -392,7 +399,7 @@ func (client *LiveEventsClient) listCreateRequest(ctx context.Context, resourceG func (client *LiveEventsClient) listHandleResponse(resp *http.Response) (LiveEventsListResponse, error) { result := LiveEventsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LiveEventListResult); err != nil { - return LiveEventsListResponse{}, err + return LiveEventsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveoutputs_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveoutputs_client.go index cc45d148de56..d5fa8d33d030 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveoutputs_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_liveoutputs_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LiveOutputsClient contains the methods for the LiveOutputs group. @@ -31,8 +31,15 @@ type LiveOutputsClient struct { } // NewLiveOutputsClient creates a new instance of LiveOutputsClient with the specified values. -func NewLiveOutputsClient(con *arm.Connection, subscriptionID string) *LiveOutputsClient { - return &LiveOutputsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLiveOutputsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LiveOutputsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LiveOutputsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new live output. @@ -258,7 +265,7 @@ func (client *LiveOutputsClient) getCreateRequest(ctx context.Context, resourceG func (client *LiveOutputsClient) getHandleResponse(resp *http.Response) (LiveOutputsGetResponse, error) { result := LiveOutputsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LiveOutput); err != nil { - return LiveOutputsGetResponse{}, err + return LiveOutputsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -324,7 +331,7 @@ func (client *LiveOutputsClient) listCreateRequest(ctx context.Context, resource func (client *LiveOutputsClient) listHandleResponse(resp *http.Response) (LiveOutputsListResponse, error) { result := LiveOutputsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LiveOutputListResult); err != nil { - return LiveOutputsListResponse{}, err + return LiveOutputsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_locations_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_locations_client.go index fa702a4739f2..0c636303f1bd 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_locations_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_locations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LocationsClient contains the methods for the Locations group. @@ -30,8 +31,15 @@ type LocationsClient struct { } // NewLocationsClient creates a new instance of LocationsClient with the specified values. -func NewLocationsClient(con *arm.Connection, subscriptionID string) *LocationsClient { - return &LocationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LocationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LocationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNameAvailability - Checks whether the Media Service resource name is available. @@ -77,7 +85,7 @@ func (client *LocationsClient) checkNameAvailabilityCreateRequest(ctx context.Co func (client *LocationsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (LocationsCheckNameAvailabilityResponse, error) { result := LocationsCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EntityNameAvailabilityCheckOutput); err != nil { - return LocationsCheckNameAvailabilityResponse{}, err + return LocationsCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_mediaservices_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_mediaservices_client.go index f0eb62f58d18..1fa9a2bd57fb 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_mediaservices_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_mediaservices_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // MediaservicesClient contains the methods for the Mediaservices group. @@ -30,8 +31,15 @@ type MediaservicesClient struct { } // NewMediaservicesClient creates a new instance of MediaservicesClient with the specified values. -func NewMediaservicesClient(con *arm.Connection, subscriptionID string) *MediaservicesClient { - return &MediaservicesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewMediaservicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *MediaservicesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MediaservicesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a Media Services account @@ -81,7 +89,7 @@ func (client *MediaservicesClient) createOrUpdateCreateRequest(ctx context.Conte func (client *MediaservicesClient) createOrUpdateHandleResponse(resp *http.Response) (MediaservicesCreateOrUpdateResponse, error) { result := MediaservicesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MediaService); err != nil { - return MediaservicesCreateOrUpdateResponse{}, err + return MediaservicesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -202,7 +210,7 @@ func (client *MediaservicesClient) getCreateRequest(ctx context.Context, resourc func (client *MediaservicesClient) getHandleResponse(resp *http.Response) (MediaservicesGetResponse, error) { result := MediaservicesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MediaService); err != nil { - return MediaservicesGetResponse{}, err + return MediaservicesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -260,7 +268,7 @@ func (client *MediaservicesClient) listCreateRequest(ctx context.Context, resour func (client *MediaservicesClient) listHandleResponse(resp *http.Response) (MediaservicesListResponse, error) { result := MediaservicesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MediaServiceCollection); err != nil { - return MediaservicesListResponse{}, err + return MediaservicesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -314,7 +322,7 @@ func (client *MediaservicesClient) listBySubscriptionCreateRequest(ctx context.C func (client *MediaservicesClient) listBySubscriptionHandleResponse(resp *http.Response) (MediaservicesListBySubscriptionResponse, error) { result := MediaservicesListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MediaServiceCollection); err != nil { - return MediaservicesListBySubscriptionResponse{}, err + return MediaservicesListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -379,7 +387,7 @@ func (client *MediaservicesClient) listEdgePoliciesCreateRequest(ctx context.Con func (client *MediaservicesClient) listEdgePoliciesHandleResponse(resp *http.Response) (MediaservicesListEdgePoliciesResponse, error) { result := MediaservicesListEdgePoliciesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EdgePolicies); err != nil { - return MediaservicesListEdgePoliciesResponse{}, err + return MediaservicesListEdgePoliciesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -500,7 +508,7 @@ func (client *MediaservicesClient) updateCreateRequest(ctx context.Context, reso func (client *MediaservicesClient) updateHandleResponse(resp *http.Response) (MediaservicesUpdateResponse, error) { result := MediaservicesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MediaService); err != nil { - return MediaservicesUpdateResponse{}, err + return MediaservicesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_models.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_models.go index ac8501a2c873..eb404da0be72 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_models.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_models.go @@ -10,11 +10,10 @@ package armmediaservices import ( "encoding/json" - "reflect" - "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "reflect" + "time" ) // AacAudio - Describes Advanced Audio Codec (AAC) audio encoding settings. @@ -214,7 +213,7 @@ type AkamaiSignatureHeaderAuthenticationKey struct { func (a AkamaiSignatureHeaderAuthenticationKey) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "base64Key", a.Base64Key) - populate(objectMap, "expiration", (*timeRFC3339)(a.Expiration)) + populateTimeRFC3339(objectMap, "expiration", a.Expiration) populate(objectMap, "identifier", a.Identifier) return json.Marshal(objectMap) } @@ -232,9 +231,7 @@ func (a *AkamaiSignatureHeaderAuthenticationKey) UnmarshalJSON(data []byte) erro err = unpopulate(val, &a.Base64Key) delete(rawMsg, key) case "expiration": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.Expiration = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.Expiration) delete(rawMsg, key) case "identifier": err = unpopulate(val, &a.Identifier) @@ -402,9 +399,9 @@ func (a AssetProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "alternateId", a.AlternateID) populate(objectMap, "assetId", a.AssetID) populate(objectMap, "container", a.Container) - populate(objectMap, "created", (*timeRFC3339)(a.Created)) + populateTimeRFC3339(objectMap, "created", a.Created) populate(objectMap, "description", a.Description) - populate(objectMap, "lastModified", (*timeRFC3339)(a.LastModified)) + populateTimeRFC3339(objectMap, "lastModified", a.LastModified) populate(objectMap, "storageAccountName", a.StorageAccountName) populate(objectMap, "storageEncryptionFormat", a.StorageEncryptionFormat) return json.Marshal(objectMap) @@ -429,17 +426,13 @@ func (a *AssetProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.Container) delete(rawMsg, key) case "created": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.Created = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.Created) delete(rawMsg, key) case "description": err = unpopulate(val, &a.Description) delete(rawMsg, key) case "lastModified": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.LastModified = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.LastModified) delete(rawMsg, key) case "storageAccountName": err = unpopulate(val, &a.StorageAccountName) @@ -486,11 +479,11 @@ type AssetStreamingLocator struct { func (a AssetStreamingLocator) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "assetName", a.AssetName) - populate(objectMap, "created", (*timeRFC3339)(a.Created)) + populateTimeRFC3339(objectMap, "created", a.Created) populate(objectMap, "defaultContentKeyPolicyName", a.DefaultContentKeyPolicyName) - populate(objectMap, "endTime", (*timeRFC3339)(a.EndTime)) + populateTimeRFC3339(objectMap, "endTime", a.EndTime) populate(objectMap, "name", a.Name) - populate(objectMap, "startTime", (*timeRFC3339)(a.StartTime)) + populateTimeRFC3339(objectMap, "startTime", a.StartTime) populate(objectMap, "streamingLocatorId", a.StreamingLocatorID) populate(objectMap, "streamingPolicyName", a.StreamingPolicyName) return json.Marshal(objectMap) @@ -509,25 +502,19 @@ func (a *AssetStreamingLocator) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.AssetName) delete(rawMsg, key) case "created": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.Created = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.Created) delete(rawMsg, key) case "defaultContentKeyPolicyName": err = unpopulate(val, &a.DefaultContentKeyPolicyName) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.EndTime) delete(rawMsg, key) case "name": err = unpopulate(val, &a.Name) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.StartTime) delete(rawMsg, key) case "streamingLocatorId": err = unpopulate(val, &a.StreamingLocatorID) @@ -1515,10 +1502,10 @@ type ContentKeyPolicyPlayReadyLicense struct { func (c ContentKeyPolicyPlayReadyLicense) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "allowTestDevices", c.AllowTestDevices) - populate(objectMap, "beginDate", (*timeRFC3339)(c.BeginDate)) + populateTimeRFC3339(objectMap, "beginDate", c.BeginDate) populate(objectMap, "contentKeyLocation", c.ContentKeyLocation) populate(objectMap, "contentType", c.ContentType) - populate(objectMap, "expirationDate", (*timeRFC3339)(c.ExpirationDate)) + populateTimeRFC3339(objectMap, "expirationDate", c.ExpirationDate) populate(objectMap, "gracePeriod", c.GracePeriod) populate(objectMap, "licenseType", c.LicenseType) populate(objectMap, "playRight", c.PlayRight) @@ -1540,9 +1527,7 @@ func (c *ContentKeyPolicyPlayReadyLicense) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.AllowTestDevices) delete(rawMsg, key) case "beginDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.BeginDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.BeginDate) delete(rawMsg, key) case "contentKeyLocation": c.ContentKeyLocation, err = unmarshalContentKeyPolicyPlayReadyContentKeyLocationClassification(val) @@ -1551,9 +1536,7 @@ func (c *ContentKeyPolicyPlayReadyLicense) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.ContentType) delete(rawMsg, key) case "expirationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.ExpirationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.ExpirationDate) delete(rawMsg, key) case "gracePeriod": err = unpopulate(val, &c.GracePeriod) @@ -1641,9 +1624,9 @@ type ContentKeyPolicyProperties struct { // MarshalJSON implements the json.Marshaller interface for type ContentKeyPolicyProperties. func (c ContentKeyPolicyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "created", (*timeRFC3339)(c.Created)) + populateTimeRFC3339(objectMap, "created", c.Created) populate(objectMap, "description", c.Description) - populate(objectMap, "lastModified", (*timeRFC3339)(c.LastModified)) + populateTimeRFC3339(objectMap, "lastModified", c.LastModified) populate(objectMap, "options", c.Options) populate(objectMap, "policyId", c.PolicyID) return json.Marshal(objectMap) @@ -1659,17 +1642,13 @@ func (c *ContentKeyPolicyProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "created": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.Created = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.Created) delete(rawMsg, key) case "description": err = unpopulate(val, &c.Description) delete(rawMsg, key) case "lastModified": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.LastModified = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.LastModified) delete(rawMsg, key) case "options": err = unpopulate(val, &c.Options) @@ -3511,14 +3490,14 @@ func (j *JobOutput) UnmarshalJSON(data []byte) error { } func (j JobOutput) marshalInternal(objectMap map[string]interface{}, discValue string) { - populate(objectMap, "endTime", (*timeRFC3339)(j.EndTime)) + populateTimeRFC3339(objectMap, "endTime", j.EndTime) populate(objectMap, "error", j.Error) populate(objectMap, "label", j.Label) j.ODataType = &discValue objectMap["@odata.type"] = j.ODataType populate(objectMap, "presetOverride", j.PresetOverride) populate(objectMap, "progress", j.Progress) - populate(objectMap, "startTime", (*timeRFC3339)(j.StartTime)) + populateTimeRFC3339(objectMap, "startTime", j.StartTime) populate(objectMap, "state", j.State) } @@ -3527,9 +3506,7 @@ func (j *JobOutput) unmarshalInternal(rawMsg map[string]json.RawMessage) error { var err error switch key { case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.EndTime) delete(rawMsg, key) case "error": err = unpopulate(val, &j.Error) @@ -3547,9 +3524,7 @@ func (j *JobOutput) unmarshalInternal(rawMsg map[string]json.RawMessage) error { err = unpopulate(val, &j.Progress) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.StartTime) delete(rawMsg, key) case "state": err = unpopulate(val, &j.State) @@ -3637,14 +3612,14 @@ type JobProperties struct { func (j JobProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "correlationData", j.CorrelationData) - populate(objectMap, "created", (*timeRFC3339)(j.Created)) + populateTimeRFC3339(objectMap, "created", j.Created) populate(objectMap, "description", j.Description) - populate(objectMap, "endTime", (*timeRFC3339)(j.EndTime)) + populateTimeRFC3339(objectMap, "endTime", j.EndTime) populate(objectMap, "input", j.Input) - populate(objectMap, "lastModified", (*timeRFC3339)(j.LastModified)) + populateTimeRFC3339(objectMap, "lastModified", j.LastModified) populate(objectMap, "outputs", j.Outputs) populate(objectMap, "priority", j.Priority) - populate(objectMap, "startTime", (*timeRFC3339)(j.StartTime)) + populateTimeRFC3339(objectMap, "startTime", j.StartTime) populate(objectMap, "state", j.State) return json.Marshal(objectMap) } @@ -3662,25 +3637,19 @@ func (j *JobProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &j.CorrelationData) delete(rawMsg, key) case "created": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.Created = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.Created) delete(rawMsg, key) case "description": err = unpopulate(val, &j.Description) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.EndTime) delete(rawMsg, key) case "input": j.Input, err = unmarshalJobInputClassification(val) delete(rawMsg, key) case "lastModified": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.LastModified = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.LastModified) delete(rawMsg, key) case "outputs": j.Outputs, err = unmarshalJobOutputClassificationArray(val) @@ -3689,9 +3658,7 @@ func (j *JobProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &j.Priority) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.StartTime) delete(rawMsg, key) case "state": err = unpopulate(val, &j.State) @@ -3934,7 +3901,7 @@ type ListContainerSasInput struct { // MarshalJSON implements the json.Marshaller interface for type ListContainerSasInput. func (l ListContainerSasInput) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "expiryTime", (*timeRFC3339)(l.ExpiryTime)) + populateTimeRFC3339(objectMap, "expiryTime", l.ExpiryTime) populate(objectMap, "permissions", l.Permissions) return json.Marshal(objectMap) } @@ -3949,9 +3916,7 @@ func (l *ListContainerSasInput) UnmarshalJSON(data []byte) error { var err error switch key { case "expiryTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.ExpiryTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.ExpiryTime) delete(rawMsg, key) case "permissions": err = unpopulate(val, &l.Permissions) @@ -4239,13 +4204,13 @@ type LiveEventProperties struct { // MarshalJSON implements the json.Marshaller interface for type LiveEventProperties. func (l LiveEventProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "created", (*timeRFC3339)(l.Created)) + populateTimeRFC3339(objectMap, "created", l.Created) populate(objectMap, "crossSiteAccessPolicies", l.CrossSiteAccessPolicies) populate(objectMap, "description", l.Description) populate(objectMap, "encoding", l.Encoding) populate(objectMap, "hostnamePrefix", l.HostnamePrefix) populate(objectMap, "input", l.Input) - populate(objectMap, "lastModified", (*timeRFC3339)(l.LastModified)) + populateTimeRFC3339(objectMap, "lastModified", l.LastModified) populate(objectMap, "preview", l.Preview) populate(objectMap, "provisioningState", l.ProvisioningState) populate(objectMap, "resourceState", l.ResourceState) @@ -4265,9 +4230,7 @@ func (l *LiveEventProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "created": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.Created = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.Created) delete(rawMsg, key) case "crossSiteAccessPolicies": err = unpopulate(val, &l.CrossSiteAccessPolicies) @@ -4285,9 +4248,7 @@ func (l *LiveEventProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &l.Input) delete(rawMsg, key) case "lastModified": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.LastModified = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.LastModified) delete(rawMsg, key) case "preview": err = unpopulate(val, &l.Preview) @@ -4469,10 +4430,10 @@ func (l LiveOutputProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "archiveWindowLength", l.ArchiveWindowLength) populate(objectMap, "assetName", l.AssetName) - populate(objectMap, "created", (*timeRFC3339)(l.Created)) + populateTimeRFC3339(objectMap, "created", l.Created) populate(objectMap, "description", l.Description) populate(objectMap, "hls", l.Hls) - populate(objectMap, "lastModified", (*timeRFC3339)(l.LastModified)) + populateTimeRFC3339(objectMap, "lastModified", l.LastModified) populate(objectMap, "manifestName", l.ManifestName) populate(objectMap, "outputSnapTime", l.OutputSnapTime) populate(objectMap, "provisioningState", l.ProvisioningState) @@ -4496,9 +4457,7 @@ func (l *LiveOutputProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &l.AssetName) delete(rawMsg, key) case "created": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.Created = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.Created) delete(rawMsg, key) case "description": err = unpopulate(val, &l.Description) @@ -4507,9 +4466,7 @@ func (l *LiveOutputProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &l.Hls) delete(rawMsg, key) case "lastModified": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.LastModified = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.LastModified) delete(rawMsg, key) case "manifestName": err = unpopulate(val, &l.ManifestName) @@ -5841,13 +5798,13 @@ func (s StreamingEndpointProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "cdnEnabled", s.CdnEnabled) populate(objectMap, "cdnProfile", s.CdnProfile) populate(objectMap, "cdnProvider", s.CdnProvider) - populate(objectMap, "created", (*timeRFC3339)(s.Created)) + populateTimeRFC3339(objectMap, "created", s.Created) populate(objectMap, "crossSiteAccessPolicies", s.CrossSiteAccessPolicies) populate(objectMap, "customHostNames", s.CustomHostNames) populate(objectMap, "description", s.Description) - populate(objectMap, "freeTrialEndTime", (*timeRFC3339)(s.FreeTrialEndTime)) + populateTimeRFC3339(objectMap, "freeTrialEndTime", s.FreeTrialEndTime) populate(objectMap, "hostName", s.HostName) - populate(objectMap, "lastModified", (*timeRFC3339)(s.LastModified)) + populateTimeRFC3339(objectMap, "lastModified", s.LastModified) populate(objectMap, "maxCacheAge", s.MaxCacheAge) populate(objectMap, "provisioningState", s.ProvisioningState) populate(objectMap, "resourceState", s.ResourceState) @@ -5880,9 +5837,7 @@ func (s *StreamingEndpointProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CdnProvider) delete(rawMsg, key) case "created": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.Created = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.Created) delete(rawMsg, key) case "crossSiteAccessPolicies": err = unpopulate(val, &s.CrossSiteAccessPolicies) @@ -5894,17 +5849,13 @@ func (s *StreamingEndpointProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Description) delete(rawMsg, key) case "freeTrialEndTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.FreeTrialEndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.FreeTrialEndTime) delete(rawMsg, key) case "hostName": err = unpopulate(val, &s.HostName) delete(rawMsg, key) case "lastModified": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModified = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModified) delete(rawMsg, key) case "maxCacheAge": err = unpopulate(val, &s.MaxCacheAge) @@ -6085,11 +6036,11 @@ func (s StreamingLocatorProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "alternativeMediaId", s.AlternativeMediaID) populate(objectMap, "assetName", s.AssetName) populate(objectMap, "contentKeys", s.ContentKeys) - populate(objectMap, "created", (*timeRFC3339)(s.Created)) + populateTimeRFC3339(objectMap, "created", s.Created) populate(objectMap, "defaultContentKeyPolicyName", s.DefaultContentKeyPolicyName) - populate(objectMap, "endTime", (*timeRFC3339)(s.EndTime)) + populateTimeRFC3339(objectMap, "endTime", s.EndTime) populate(objectMap, "filters", s.Filters) - populate(objectMap, "startTime", (*timeRFC3339)(s.StartTime)) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) populate(objectMap, "streamingLocatorId", s.StreamingLocatorID) populate(objectMap, "streamingPolicyName", s.StreamingPolicyName) return json.Marshal(objectMap) @@ -6114,25 +6065,19 @@ func (s *StreamingLocatorProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.ContentKeys) delete(rawMsg, key) case "created": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.Created = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.Created) delete(rawMsg, key) case "defaultContentKeyPolicyName": err = unpopulate(val, &s.DefaultContentKeyPolicyName) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.EndTime) delete(rawMsg, key) case "filters": err = unpopulate(val, &s.Filters) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.StartTime) delete(rawMsg, key) case "streamingLocatorId": err = unpopulate(val, &s.StreamingLocatorID) @@ -6357,7 +6302,7 @@ func (s StreamingPolicyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "commonEncryptionCbcs", s.CommonEncryptionCbcs) populate(objectMap, "commonEncryptionCenc", s.CommonEncryptionCenc) - populate(objectMap, "created", (*timeRFC3339)(s.Created)) + populateTimeRFC3339(objectMap, "created", s.Created) populate(objectMap, "defaultContentKeyPolicyName", s.DefaultContentKeyPolicyName) populate(objectMap, "envelopeEncryption", s.EnvelopeEncryption) populate(objectMap, "noEncryption", s.NoEncryption) @@ -6380,9 +6325,7 @@ func (s *StreamingPolicyProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CommonEncryptionCenc) delete(rawMsg, key) case "created": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.Created = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.Created) delete(rawMsg, key) case "defaultContentKeyPolicyName": err = unpopulate(val, &s.DefaultContentKeyPolicyName) @@ -6441,10 +6384,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -6460,9 +6403,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -6471,9 +6412,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) @@ -6691,9 +6630,9 @@ type TransformProperties struct { // MarshalJSON implements the json.Marshaller interface for type TransformProperties. func (t TransformProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "created", (*timeRFC3339)(t.Created)) + populateTimeRFC3339(objectMap, "created", t.Created) populate(objectMap, "description", t.Description) - populate(objectMap, "lastModified", (*timeRFC3339)(t.LastModified)) + populateTimeRFC3339(objectMap, "lastModified", t.LastModified) populate(objectMap, "outputs", t.Outputs) return json.Marshal(objectMap) } @@ -6708,17 +6647,13 @@ func (t *TransformProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "created": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.Created = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.Created) delete(rawMsg, key) case "description": err = unpopulate(val, &t.Description) delete(rawMsg, key) case "lastModified": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.LastModified = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.LastModified) delete(rawMsg, key) case "outputs": err = unpopulate(val, &t.Outputs) @@ -6783,7 +6718,7 @@ type UTCClipTime struct { func (u UTCClipTime) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) u.ClipTime.marshalInternal(objectMap, "#Microsoft.Media.UtcClipTime") - populate(objectMap, "time", (*timeRFC3339)(u.Time)) + populateTimeRFC3339(objectMap, "time", u.Time) return json.Marshal(objectMap) } @@ -6797,9 +6732,7 @@ func (u *UTCClipTime) UnmarshalJSON(data []byte) error { var err error switch key { case "time": - var aux timeRFC3339 - err = unpopulate(val, &aux) - u.Time = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &u.Time) delete(rawMsg, key) } if err != nil { diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_operations_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_operations_client.go index d957efa06c27..22b5717ea0b6 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_operations_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armmediaservices import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all the Media Services operations. @@ -65,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationCollection); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pagers.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pagers.go index dff63fd5d4e0..2fa58d6e52c5 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pagers.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armmediaservices import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // AccountFiltersListPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pollers.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pollers.go index f08a66e34141..fa366e240f8c 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pollers.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armmediaservices import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // LiveEventsAllocatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_polymorphic_helpers.go index 379fdff6a6f2..4cc3320b2f9d 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_polymorphic_helpers.go @@ -47,6 +47,25 @@ func unmarshalAudioAnalyzerPresetClassificationArray(rawMsg json.RawMessage) ([] return fArray, nil } +func unmarshalAudioAnalyzerPresetClassificationMap(rawMsg json.RawMessage) (map[string]AudioAnalyzerPresetClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]AudioAnalyzerPresetClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalAudioAnalyzerPresetClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalAudioClassification(rawMsg json.RawMessage) (AudioClassification, error) { if rawMsg == nil { return nil, nil @@ -84,6 +103,25 @@ func unmarshalAudioClassificationArray(rawMsg json.RawMessage) ([]AudioClassific return fArray, nil } +func unmarshalAudioClassificationMap(rawMsg json.RawMessage) (map[string]AudioClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]AudioClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalAudioClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalAudioTrackDescriptorClassification(rawMsg json.RawMessage) (AudioTrackDescriptorClassification, error) { if rawMsg == nil { return nil, nil @@ -123,6 +161,25 @@ func unmarshalAudioTrackDescriptorClassificationArray(rawMsg json.RawMessage) ([ return fArray, nil } +func unmarshalAudioTrackDescriptorClassificationMap(rawMsg json.RawMessage) (map[string]AudioTrackDescriptorClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]AudioTrackDescriptorClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalAudioTrackDescriptorClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalClipTimeClassification(rawMsg json.RawMessage) (ClipTimeClassification, error) { if rawMsg == nil { return nil, nil @@ -162,6 +219,25 @@ func unmarshalClipTimeClassificationArray(rawMsg json.RawMessage) ([]ClipTimeCla return fArray, nil } +func unmarshalClipTimeClassificationMap(rawMsg json.RawMessage) (map[string]ClipTimeClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ClipTimeClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalClipTimeClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalCodecClassification(rawMsg json.RawMessage) (CodecClassification, error) { if rawMsg == nil { return nil, nil @@ -217,6 +293,25 @@ func unmarshalCodecClassificationArray(rawMsg json.RawMessage) ([]CodecClassific return fArray, nil } +func unmarshalCodecClassificationMap(rawMsg json.RawMessage) (map[string]CodecClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]CodecClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalCodecClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalContentKeyPolicyConfigurationClassification(rawMsg json.RawMessage) (ContentKeyPolicyConfigurationClassification, error) { if rawMsg == nil { return nil, nil @@ -262,6 +357,25 @@ func unmarshalContentKeyPolicyConfigurationClassificationArray(rawMsg json.RawMe return fArray, nil } +func unmarshalContentKeyPolicyConfigurationClassificationMap(rawMsg json.RawMessage) (map[string]ContentKeyPolicyConfigurationClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ContentKeyPolicyConfigurationClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalContentKeyPolicyConfigurationClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalContentKeyPolicyPlayReadyContentKeyLocationClassification(rawMsg json.RawMessage) (ContentKeyPolicyPlayReadyContentKeyLocationClassification, error) { if rawMsg == nil { return nil, nil @@ -301,6 +415,25 @@ func unmarshalContentKeyPolicyPlayReadyContentKeyLocationClassificationArray(raw return fArray, nil } +func unmarshalContentKeyPolicyPlayReadyContentKeyLocationClassificationMap(rawMsg json.RawMessage) (map[string]ContentKeyPolicyPlayReadyContentKeyLocationClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ContentKeyPolicyPlayReadyContentKeyLocationClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalContentKeyPolicyPlayReadyContentKeyLocationClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalContentKeyPolicyRestrictionClassification(rawMsg json.RawMessage) (ContentKeyPolicyRestrictionClassification, error) { if rawMsg == nil { return nil, nil @@ -342,6 +475,25 @@ func unmarshalContentKeyPolicyRestrictionClassificationArray(rawMsg json.RawMess return fArray, nil } +func unmarshalContentKeyPolicyRestrictionClassificationMap(rawMsg json.RawMessage) (map[string]ContentKeyPolicyRestrictionClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ContentKeyPolicyRestrictionClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalContentKeyPolicyRestrictionClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalContentKeyPolicyRestrictionTokenKeyClassification(rawMsg json.RawMessage) (ContentKeyPolicyRestrictionTokenKeyClassification, error) { if rawMsg == nil { return nil, nil @@ -383,6 +535,25 @@ func unmarshalContentKeyPolicyRestrictionTokenKeyClassificationArray(rawMsg json return fArray, nil } +func unmarshalContentKeyPolicyRestrictionTokenKeyClassificationMap(rawMsg json.RawMessage) (map[string]ContentKeyPolicyRestrictionTokenKeyClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ContentKeyPolicyRestrictionTokenKeyClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalContentKeyPolicyRestrictionTokenKeyClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalFormatClassification(rawMsg json.RawMessage) (FormatClassification, error) { if rawMsg == nil { return nil, nil @@ -430,6 +601,25 @@ func unmarshalFormatClassificationArray(rawMsg json.RawMessage) ([]FormatClassif return fArray, nil } +func unmarshalFormatClassificationMap(rawMsg json.RawMessage) (map[string]FormatClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]FormatClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalFormatClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalH265VideoLayerClassification(rawMsg json.RawMessage) (H265VideoLayerClassification, error) { if rawMsg == nil { return nil, nil @@ -467,6 +657,25 @@ func unmarshalH265VideoLayerClassificationArray(rawMsg json.RawMessage) ([]H265V return fArray, nil } +func unmarshalH265VideoLayerClassificationMap(rawMsg json.RawMessage) (map[string]H265VideoLayerClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]H265VideoLayerClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalH265VideoLayerClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalImageClassification(rawMsg json.RawMessage) (ImageClassification, error) { if rawMsg == nil { return nil, nil @@ -506,6 +715,25 @@ func unmarshalImageClassificationArray(rawMsg json.RawMessage) ([]ImageClassific return fArray, nil } +func unmarshalImageClassificationMap(rawMsg json.RawMessage) (map[string]ImageClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ImageClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalImageClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalImageFormatClassification(rawMsg json.RawMessage) (ImageFormatClassification, error) { if rawMsg == nil { return nil, nil @@ -545,6 +773,25 @@ func unmarshalImageFormatClassificationArray(rawMsg json.RawMessage) ([]ImageFor return fArray, nil } +func unmarshalImageFormatClassificationMap(rawMsg json.RawMessage) (map[string]ImageFormatClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ImageFormatClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalImageFormatClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalInputDefinitionClassification(rawMsg json.RawMessage) (InputDefinitionClassification, error) { if rawMsg == nil { return nil, nil @@ -586,6 +833,25 @@ func unmarshalInputDefinitionClassificationArray(rawMsg json.RawMessage) ([]Inpu return fArray, nil } +func unmarshalInputDefinitionClassificationMap(rawMsg json.RawMessage) (map[string]InputDefinitionClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]InputDefinitionClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalInputDefinitionClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalJobInputClassification(rawMsg json.RawMessage) (JobInputClassification, error) { if rawMsg == nil { return nil, nil @@ -631,6 +897,25 @@ func unmarshalJobInputClassificationArray(rawMsg json.RawMessage) ([]JobInputCla return fArray, nil } +func unmarshalJobInputClassificationMap(rawMsg json.RawMessage) (map[string]JobInputClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]JobInputClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalJobInputClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalJobInputClipClassification(rawMsg json.RawMessage) (JobInputClipClassification, error) { if rawMsg == nil { return nil, nil @@ -670,6 +955,25 @@ func unmarshalJobInputClipClassificationArray(rawMsg json.RawMessage) ([]JobInpu return fArray, nil } +func unmarshalJobInputClipClassificationMap(rawMsg json.RawMessage) (map[string]JobInputClipClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]JobInputClipClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalJobInputClipClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalJobOutputClassification(rawMsg json.RawMessage) (JobOutputClassification, error) { if rawMsg == nil { return nil, nil @@ -707,6 +1011,25 @@ func unmarshalJobOutputClassificationArray(rawMsg json.RawMessage) ([]JobOutputC return fArray, nil } +func unmarshalJobOutputClassificationMap(rawMsg json.RawMessage) (map[string]JobOutputClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]JobOutputClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalJobOutputClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalLayerClassification(rawMsg json.RawMessage) (LayerClassification, error) { if rawMsg == nil { return nil, nil @@ -754,6 +1077,25 @@ func unmarshalLayerClassificationArray(rawMsg json.RawMessage) ([]LayerClassific return fArray, nil } +func unmarshalLayerClassificationMap(rawMsg json.RawMessage) (map[string]LayerClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]LayerClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalLayerClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalMultiBitrateFormatClassification(rawMsg json.RawMessage) (MultiBitrateFormatClassification, error) { if rawMsg == nil { return nil, nil @@ -793,6 +1135,25 @@ func unmarshalMultiBitrateFormatClassificationArray(rawMsg json.RawMessage) ([]M return fArray, nil } +func unmarshalMultiBitrateFormatClassificationMap(rawMsg json.RawMessage) (map[string]MultiBitrateFormatClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]MultiBitrateFormatClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalMultiBitrateFormatClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalOverlayClassification(rawMsg json.RawMessage) (OverlayClassification, error) { if rawMsg == nil { return nil, nil @@ -832,6 +1193,25 @@ func unmarshalOverlayClassificationArray(rawMsg json.RawMessage) ([]OverlayClass return fArray, nil } +func unmarshalOverlayClassificationMap(rawMsg json.RawMessage) (map[string]OverlayClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]OverlayClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalOverlayClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalPresetClassification(rawMsg json.RawMessage) (PresetClassification, error) { if rawMsg == nil { return nil, nil @@ -877,6 +1257,25 @@ func unmarshalPresetClassificationArray(rawMsg json.RawMessage) ([]PresetClassif return fArray, nil } +func unmarshalPresetClassificationMap(rawMsg json.RawMessage) (map[string]PresetClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]PresetClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalPresetClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalTrackDescriptorClassification(rawMsg json.RawMessage) (TrackDescriptorClassification, error) { if rawMsg == nil { return nil, nil @@ -924,6 +1323,25 @@ func unmarshalTrackDescriptorClassificationArray(rawMsg json.RawMessage) ([]Trac return fArray, nil } +func unmarshalTrackDescriptorClassificationMap(rawMsg json.RawMessage) (map[string]TrackDescriptorClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]TrackDescriptorClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalTrackDescriptorClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalVideoClassification(rawMsg json.RawMessage) (VideoClassification, error) { if rawMsg == nil { return nil, nil @@ -969,6 +1387,25 @@ func unmarshalVideoClassificationArray(rawMsg json.RawMessage) ([]VideoClassific return fArray, nil } +func unmarshalVideoClassificationMap(rawMsg json.RawMessage) (map[string]VideoClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]VideoClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalVideoClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalVideoLayerClassification(rawMsg json.RawMessage) (VideoLayerClassification, error) { if rawMsg == nil { return nil, nil @@ -1006,6 +1443,25 @@ func unmarshalVideoLayerClassificationArray(rawMsg json.RawMessage) ([]VideoLaye return fArray, nil } +func unmarshalVideoLayerClassificationMap(rawMsg json.RawMessage) (map[string]VideoLayerClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]VideoLayerClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalVideoLayerClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalVideoTrackDescriptorClassification(rawMsg json.RawMessage) (VideoTrackDescriptorClassification, error) { if rawMsg == nil { return nil, nil @@ -1044,3 +1500,22 @@ func unmarshalVideoTrackDescriptorClassificationArray(rawMsg json.RawMessage) ([ } return fArray, nil } + +func unmarshalVideoTrackDescriptorClassificationMap(rawMsg json.RawMessage) (map[string]VideoTrackDescriptorClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]VideoTrackDescriptorClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalVideoTrackDescriptorClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privateendpointconnections_client.go index a8c00e4d3fff..b24e9a825890 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privateendpointconnections_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. @@ -30,8 +31,15 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { - return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Update private endpoint connection. @@ -85,7 +93,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx func (client *PrivateEndpointConnectionsClient) createOrUpdateHandleResponse(resp *http.Response) (PrivateEndpointConnectionsCreateOrUpdateResponse, error) { result := PrivateEndpointConnectionsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsCreateOrUpdateResponse{}, err + return PrivateEndpointConnectionsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsGetResponse{}, err + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -279,7 +287,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListResponse, error) { result := PrivateEndpointConnectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionsListResponse{}, err + return PrivateEndpointConnectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privatelinkresources_client.go index 3f2956544409..695a70ea6c3e 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_privatelinkresources_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. @@ -30,8 +31,15 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { - return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get group ID. @@ -85,7 +93,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesGetResponse, error) { result := PrivateLinkResourcesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { - return PrivateLinkResourcesGetResponse{}, err + return PrivateLinkResourcesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -150,7 +158,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, func (client *PrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (PrivateLinkResourcesListResponse, error) { result := PrivateLinkResourcesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { - return PrivateLinkResourcesListResponse{}, err + return PrivateLinkResourcesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_response_types.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_response_types.go index 3544909512a5..0efafcabc0a0 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_response_types.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armmediaservices import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // AccountFiltersCreateOrUpdateResponse contains the response from method AccountFilters.CreateOrUpdate. @@ -350,6 +349,8 @@ type LiveEventsAllocatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LiveEventsAllocatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsAllocateResponse, error) { respType := LiveEventsAllocateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -394,6 +395,8 @@ type LiveEventsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LiveEventsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsCreateResponse, error) { respType := LiveEventsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LiveEvent) @@ -444,6 +447,8 @@ type LiveEventsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LiveEventsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsDeleteResponse, error) { respType := LiveEventsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -512,6 +517,8 @@ type LiveEventsResetPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LiveEventsResetPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsResetResponse, error) { respType := LiveEventsResetResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -556,6 +563,8 @@ type LiveEventsStartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LiveEventsStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsStartResponse, error) { respType := LiveEventsStartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -600,6 +609,8 @@ type LiveEventsStopPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LiveEventsStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsStopResponse, error) { respType := LiveEventsStopResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -644,6 +655,8 @@ type LiveEventsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LiveEventsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveEventsUpdateResponse, error) { respType := LiveEventsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LiveEvent) @@ -694,6 +707,8 @@ type LiveOutputsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LiveOutputsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveOutputsCreateResponse, error) { respType := LiveOutputsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LiveOutput) @@ -744,6 +759,8 @@ type LiveOutputsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LiveOutputsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LiveOutputsDeleteResponse, error) { respType := LiveOutputsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -986,6 +1003,8 @@ type StreamingEndpointsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StreamingEndpointsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingEndpointsCreateResponse, error) { respType := StreamingEndpointsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.StreamingEndpoint) @@ -1036,6 +1055,8 @@ type StreamingEndpointsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StreamingEndpointsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingEndpointsDeleteResponse, error) { respType := StreamingEndpointsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1104,6 +1125,8 @@ type StreamingEndpointsScalePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StreamingEndpointsScalePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingEndpointsScaleResponse, error) { respType := StreamingEndpointsScaleResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1148,6 +1171,8 @@ type StreamingEndpointsStartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StreamingEndpointsStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingEndpointsStartResponse, error) { respType := StreamingEndpointsStartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1192,6 +1217,8 @@ type StreamingEndpointsStopPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StreamingEndpointsStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingEndpointsStopResponse, error) { respType := StreamingEndpointsStopResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1236,6 +1263,8 @@ type StreamingEndpointsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StreamingEndpointsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingEndpointsUpdateResponse, error) { respType := StreamingEndpointsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.StreamingEndpoint) diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingendpoints_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingendpoints_client.go index 9af6acc7c078..4d6a9e1c025c 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingendpoints_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingendpoints_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // StreamingEndpointsClient contains the methods for the StreamingEndpoints group. @@ -32,8 +32,15 @@ type StreamingEndpointsClient struct { } // NewStreamingEndpointsClient creates a new instance of StreamingEndpointsClient with the specified values. -func NewStreamingEndpointsClient(con *arm.Connection, subscriptionID string) *StreamingEndpointsClient { - return &StreamingEndpointsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewStreamingEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *StreamingEndpointsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &StreamingEndpointsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a streaming endpoint. @@ -250,7 +257,7 @@ func (client *StreamingEndpointsClient) getCreateRequest(ctx context.Context, re func (client *StreamingEndpointsClient) getHandleResponse(resp *http.Response) (StreamingEndpointsGetResponse, error) { result := StreamingEndpointsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StreamingEndpoint); err != nil { - return StreamingEndpointsGetResponse{}, err + return StreamingEndpointsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -312,7 +319,7 @@ func (client *StreamingEndpointsClient) listCreateRequest(ctx context.Context, r func (client *StreamingEndpointsClient) listHandleResponse(resp *http.Response) (StreamingEndpointsListResponse, error) { result := StreamingEndpointsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StreamingEndpointListResult); err != nil { - return StreamingEndpointsListResponse{}, err + return StreamingEndpointsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streaminglocators_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streaminglocators_client.go index bcecdc9f0691..e81d60a95efb 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streaminglocators_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streaminglocators_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // StreamingLocatorsClient contains the methods for the StreamingLocators group. @@ -31,8 +32,15 @@ type StreamingLocatorsClient struct { } // NewStreamingLocatorsClient creates a new instance of StreamingLocatorsClient with the specified values. -func NewStreamingLocatorsClient(con *arm.Connection, subscriptionID string) *StreamingLocatorsClient { - return &StreamingLocatorsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewStreamingLocatorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *StreamingLocatorsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &StreamingLocatorsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Create a Streaming Locator in the Media Services account @@ -86,7 +94,7 @@ func (client *StreamingLocatorsClient) createCreateRequest(ctx context.Context, func (client *StreamingLocatorsClient) createHandleResponse(resp *http.Response) (StreamingLocatorsCreateResponse, error) { result := StreamingLocatorsCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StreamingLocator); err != nil { - return StreamingLocatorsCreateResponse{}, err + return StreamingLocatorsCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -215,7 +223,7 @@ func (client *StreamingLocatorsClient) getCreateRequest(ctx context.Context, res func (client *StreamingLocatorsClient) getHandleResponse(resp *http.Response) (StreamingLocatorsGetResponse, error) { result := StreamingLocatorsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StreamingLocator); err != nil { - return StreamingLocatorsGetResponse{}, err + return StreamingLocatorsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -286,7 +294,7 @@ func (client *StreamingLocatorsClient) listCreateRequest(ctx context.Context, re func (client *StreamingLocatorsClient) listHandleResponse(resp *http.Response) (StreamingLocatorsListResponse, error) { result := StreamingLocatorsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StreamingLocatorCollection); err != nil { - return StreamingLocatorsListResponse{}, err + return StreamingLocatorsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -355,7 +363,7 @@ func (client *StreamingLocatorsClient) listContentKeysCreateRequest(ctx context. func (client *StreamingLocatorsClient) listContentKeysHandleResponse(resp *http.Response) (StreamingLocatorsListContentKeysResponse, error) { result := StreamingLocatorsListContentKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListContentKeysResponse); err != nil { - return StreamingLocatorsListContentKeysResponse{}, err + return StreamingLocatorsListContentKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -424,7 +432,7 @@ func (client *StreamingLocatorsClient) listPathsCreateRequest(ctx context.Contex func (client *StreamingLocatorsClient) listPathsHandleResponse(resp *http.Response) (StreamingLocatorsListPathsResponse, error) { result := StreamingLocatorsListPathsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListPathsResponse); err != nil { - return StreamingLocatorsListPathsResponse{}, err + return StreamingLocatorsListPathsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingpolicies_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingpolicies_client.go index 7625d1c9e153..f9d4f15193ba 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingpolicies_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_streamingpolicies_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // StreamingPoliciesClient contains the methods for the StreamingPolicies group. @@ -31,8 +32,15 @@ type StreamingPoliciesClient struct { } // NewStreamingPoliciesClient creates a new instance of StreamingPoliciesClient with the specified values. -func NewStreamingPoliciesClient(con *arm.Connection, subscriptionID string) *StreamingPoliciesClient { - return &StreamingPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewStreamingPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *StreamingPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &StreamingPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Create a Streaming Policy in the Media Services account @@ -86,7 +94,7 @@ func (client *StreamingPoliciesClient) createCreateRequest(ctx context.Context, func (client *StreamingPoliciesClient) createHandleResponse(resp *http.Response) (StreamingPoliciesCreateResponse, error) { result := StreamingPoliciesCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StreamingPolicy); err != nil { - return StreamingPoliciesCreateResponse{}, err + return StreamingPoliciesCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -215,7 +223,7 @@ func (client *StreamingPoliciesClient) getCreateRequest(ctx context.Context, res func (client *StreamingPoliciesClient) getHandleResponse(resp *http.Response) (StreamingPoliciesGetResponse, error) { result := StreamingPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StreamingPolicy); err != nil { - return StreamingPoliciesGetResponse{}, err + return StreamingPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -286,7 +294,7 @@ func (client *StreamingPoliciesClient) listCreateRequest(ctx context.Context, re func (client *StreamingPoliciesClient) listHandleResponse(resp *http.Response) (StreamingPoliciesListResponse, error) { result := StreamingPoliciesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StreamingPolicyCollection); err != nil { - return StreamingPoliciesListResponse{}, err + return StreamingPoliciesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_time_rfc3339.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_time_rfc3339.go index 44240b77addf..ba8388946f2b 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armmediaservices import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_transforms_client.go b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_transforms_client.go index 55547feef6b7..b8a0c54ed2ec 100644 --- a/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_transforms_client.go +++ b/sdk/resourcemanager/mediaservices/armmediaservices/zz_generated_transforms_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TransformsClient contains the methods for the Transforms group. @@ -30,8 +31,15 @@ type TransformsClient struct { } // NewTransformsClient creates a new instance of TransformsClient with the specified values. -func NewTransformsClient(con *arm.Connection, subscriptionID string) *TransformsClient { - return &TransformsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTransformsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TransformsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TransformsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a new Transform. @@ -85,7 +93,7 @@ func (client *TransformsClient) createOrUpdateCreateRequest(ctx context.Context, func (client *TransformsClient) createOrUpdateHandleResponse(resp *http.Response) (TransformsCreateOrUpdateResponse, error) { result := TransformsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Transform); err != nil { - return TransformsCreateOrUpdateResponse{}, err + return TransformsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *TransformsClient) getCreateRequest(ctx context.Context, resourceGr func (client *TransformsClient) getHandleResponse(resp *http.Response) (TransformsGetResponse, error) { result := TransformsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Transform); err != nil { - return TransformsGetResponse{}, err + return TransformsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -282,7 +290,7 @@ func (client *TransformsClient) listCreateRequest(ctx context.Context, resourceG func (client *TransformsClient) listHandleResponse(resp *http.Response) (TransformsListResponse, error) { result := TransformsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TransformCollection); err != nil { - return TransformsListResponse{}, err + return TransformsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -351,7 +359,7 @@ func (client *TransformsClient) updateCreateRequest(ctx context.Context, resourc func (client *TransformsClient) updateHandleResponse(resp *http.Response) (TransformsUpdateResponse, error) { result := TransformsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Transform); err != nil { - return TransformsUpdateResponse{}, err + return TransformsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md b/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md index 667b5e62dd26..271676238e42 100644 --- a/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md +++ b/sdk/resourcemanager/monitor/armmonitor/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-10-08) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/monitor/armmonitor") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/monitor/armmonitor/README.md b/sdk/resourcemanager/monitor/armmonitor/README.md index 75291ee0775e..423f53b2fd4e 100644 --- a/sdk/resourcemanager/monitor/armmonitor/README.md +++ b/sdk/resourcemanager/monitor/armmonitor/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Monitor +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Monitor modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armmonitor.NewAlertRuleIncidentsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Monitor modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armmonitor.NewAlertRuleIncidentsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armmonitor.NewAlertRuleIncidentsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/monitor/armmonitor/autorest.md b/sdk/resourcemanager/monitor/armmonitor/autorest.md index 203222d16ee0..7db235196eee 100644 --- a/sdk/resourcemanager/monitor/armmonitor/autorest.md +++ b/sdk/resourcemanager/monitor/armmonitor/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/monitor/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/monitor/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/monitor/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/monitor/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/monitor/armmonitor/go.mod b/sdk/resourcemanager/monitor/armmonitor/go.mod index a107c5ac6294..db0c462f1875 100644 --- a/sdk/resourcemanager/monitor/armmonitor/go.mod +++ b/sdk/resourcemanager/monitor/armmonitor/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/monitor/armmonitor go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/monitor/armmonitor/go.sum b/sdk/resourcemanager/monitor/armmonitor/go.sum index 4f0fb709cf31..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/monitor/armmonitor/go.sum +++ b/sdk/resourcemanager/monitor/armmonitor/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible h1:Cw16jiP4dI+CK761aq44ol4RV5dUiIIXky1+EKpoiVM= -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_actiongroups_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_actiongroups_client.go index 0e30cb4384d0..0d1da7eea648 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_actiongroups_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_actiongroups_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ActionGroupsClient contains the methods for the ActionGroups group. @@ -30,8 +31,15 @@ type ActionGroupsClient struct { } // NewActionGroupsClient creates a new instance of ActionGroupsClient with the specified values. -func NewActionGroupsClient(con *arm.Connection, subscriptionID string) *ActionGroupsClient { - return &ActionGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewActionGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ActionGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ActionGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create a new action group or update an existing one. @@ -81,7 +89,7 @@ func (client *ActionGroupsClient) createOrUpdateCreateRequest(ctx context.Contex func (client *ActionGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (ActionGroupsCreateOrUpdateResponse, error) { result := ActionGroupsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ActionGroupResource); err != nil { - return ActionGroupsCreateOrUpdateResponse{}, err + return ActionGroupsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -259,7 +267,7 @@ func (client *ActionGroupsClient) getCreateRequest(ctx context.Context, resource func (client *ActionGroupsClient) getHandleResponse(resp *http.Response) (ActionGroupsGetResponse, error) { result := ActionGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ActionGroupResource); err != nil { - return ActionGroupsGetResponse{}, err + return ActionGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -320,7 +328,7 @@ func (client *ActionGroupsClient) listByResourceGroupCreateRequest(ctx context.C func (client *ActionGroupsClient) listByResourceGroupHandleResponse(resp *http.Response) (ActionGroupsListByResourceGroupResponse, error) { result := ActionGroupsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ActionGroupList); err != nil { - return ActionGroupsListByResourceGroupResponse{}, err + return ActionGroupsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -377,7 +385,7 @@ func (client *ActionGroupsClient) listBySubscriptionIDCreateRequest(ctx context. func (client *ActionGroupsClient) listBySubscriptionIDHandleResponse(resp *http.Response) (ActionGroupsListBySubscriptionIDResponse, error) { result := ActionGroupsListBySubscriptionIDResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ActionGroupList); err != nil { - return ActionGroupsListBySubscriptionIDResponse{}, err + return ActionGroupsListBySubscriptionIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -442,7 +450,7 @@ func (client *ActionGroupsClient) updateCreateRequest(ctx context.Context, resou func (client *ActionGroupsClient) updateHandleResponse(resp *http.Response) (ActionGroupsUpdateResponse, error) { result := ActionGroupsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ActionGroupResource); err != nil { - return ActionGroupsUpdateResponse{}, err + return ActionGroupsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_activitylogalerts_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_activitylogalerts_client.go index e26823e1d904..417019ccd274 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_activitylogalerts_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_activitylogalerts_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ActivityLogAlertsClient contains the methods for the ActivityLogAlerts group. @@ -30,8 +31,15 @@ type ActivityLogAlertsClient struct { } // NewActivityLogAlertsClient creates a new instance of ActivityLogAlertsClient with the specified values. -func NewActivityLogAlertsClient(con *arm.Connection, subscriptionID string) *ActivityLogAlertsClient { - return &ActivityLogAlertsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewActivityLogAlertsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ActivityLogAlertsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ActivityLogAlertsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create a new activity log alert or update an existing one. @@ -81,7 +89,7 @@ func (client *ActivityLogAlertsClient) createOrUpdateCreateRequest(ctx context.C func (client *ActivityLogAlertsClient) createOrUpdateHandleResponse(resp *http.Response) (ActivityLogAlertsCreateOrUpdateResponse, error) { result := ActivityLogAlertsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ActivityLogAlertResource); err != nil { - return ActivityLogAlertsCreateOrUpdateResponse{}, err + return ActivityLogAlertsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -202,7 +210,7 @@ func (client *ActivityLogAlertsClient) getCreateRequest(ctx context.Context, res func (client *ActivityLogAlertsClient) getHandleResponse(resp *http.Response) (ActivityLogAlertsGetResponse, error) { result := ActivityLogAlertsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ActivityLogAlertResource); err != nil { - return ActivityLogAlertsGetResponse{}, err + return ActivityLogAlertsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -263,7 +271,7 @@ func (client *ActivityLogAlertsClient) listByResourceGroupCreateRequest(ctx cont func (client *ActivityLogAlertsClient) listByResourceGroupHandleResponse(resp *http.Response) (ActivityLogAlertsListByResourceGroupResponse, error) { result := ActivityLogAlertsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ActivityLogAlertList); err != nil { - return ActivityLogAlertsListByResourceGroupResponse{}, err + return ActivityLogAlertsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -320,7 +328,7 @@ func (client *ActivityLogAlertsClient) listBySubscriptionIDCreateRequest(ctx con func (client *ActivityLogAlertsClient) listBySubscriptionIDHandleResponse(resp *http.Response) (ActivityLogAlertsListBySubscriptionIDResponse, error) { result := ActivityLogAlertsListBySubscriptionIDResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ActivityLogAlertList); err != nil { - return ActivityLogAlertsListBySubscriptionIDResponse{}, err + return ActivityLogAlertsListBySubscriptionIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -385,7 +393,7 @@ func (client *ActivityLogAlertsClient) updateCreateRequest(ctx context.Context, func (client *ActivityLogAlertsClient) updateHandleResponse(resp *http.Response) (ActivityLogAlertsUpdateResponse, error) { result := ActivityLogAlertsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ActivityLogAlertResource); err != nil { - return ActivityLogAlertsUpdateResponse{}, err + return ActivityLogAlertsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_activitylogs_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_activitylogs_client.go index f8cdcfa3167a..4f8442c982ad 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_activitylogs_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_activitylogs_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ActivityLogsClient contains the methods for the ActivityLogs group. @@ -30,8 +31,15 @@ type ActivityLogsClient struct { } // NewActivityLogsClient creates a new instance of ActivityLogsClient with the specified values. -func NewActivityLogsClient(con *arm.Connection, subscriptionID string) *ActivityLogsClient { - return &ActivityLogsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewActivityLogsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ActivityLogsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ActivityLogsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Provides the list of records from the activity logs. @@ -74,7 +82,7 @@ func (client *ActivityLogsClient) listCreateRequest(ctx context.Context, filter func (client *ActivityLogsClient) listHandleResponse(resp *http.Response) (ActivityLogsListResponse, error) { result := ActivityLogsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventDataCollection); err != nil { - return ActivityLogsListResponse{}, err + return ActivityLogsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_alertruleincidents_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_alertruleincidents_client.go index 95da672609c5..e5f3c0afb171 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_alertruleincidents_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_alertruleincidents_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AlertRuleIncidentsClient contains the methods for the AlertRuleIncidents group. @@ -30,8 +31,15 @@ type AlertRuleIncidentsClient struct { } // NewAlertRuleIncidentsClient creates a new instance of AlertRuleIncidentsClient with the specified values. -func NewAlertRuleIncidentsClient(con *arm.Connection, subscriptionID string) *AlertRuleIncidentsClient { - return &AlertRuleIncidentsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAlertRuleIncidentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AlertRuleIncidentsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AlertRuleIncidentsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets an incident associated to an alert rule @@ -85,7 +93,7 @@ func (client *AlertRuleIncidentsClient) getCreateRequest(ctx context.Context, re func (client *AlertRuleIncidentsClient) getHandleResponse(resp *http.Response) (AlertRuleIncidentsGetResponse, error) { result := AlertRuleIncidentsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Incident); err != nil { - return AlertRuleIncidentsGetResponse{}, err + return AlertRuleIncidentsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -150,7 +158,7 @@ func (client *AlertRuleIncidentsClient) listByAlertRuleCreateRequest(ctx context func (client *AlertRuleIncidentsClient) listByAlertRuleHandleResponse(resp *http.Response) (AlertRuleIncidentsListByAlertRuleResponse, error) { result := AlertRuleIncidentsListByAlertRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IncidentListResult); err != nil { - return AlertRuleIncidentsListByAlertRuleResponse{}, err + return AlertRuleIncidentsListByAlertRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_alertrules_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_alertrules_client.go index c9252d482d84..1c4ac921b01f 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_alertrules_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_alertrules_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AlertRulesClient contains the methods for the AlertRules group. @@ -30,8 +31,15 @@ type AlertRulesClient struct { } // NewAlertRulesClient creates a new instance of AlertRulesClient with the specified values. -func NewAlertRulesClient(con *arm.Connection, subscriptionID string) *AlertRulesClient { - return &AlertRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAlertRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AlertRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AlertRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a classic metric alert rule. @@ -81,7 +89,7 @@ func (client *AlertRulesClient) createOrUpdateCreateRequest(ctx context.Context, func (client *AlertRulesClient) createOrUpdateHandleResponse(resp *http.Response) (AlertRulesCreateOrUpdateResponse, error) { result := AlertRulesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleResource); err != nil { - return AlertRulesCreateOrUpdateResponse{}, err + return AlertRulesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -202,7 +210,7 @@ func (client *AlertRulesClient) getCreateRequest(ctx context.Context, resourceGr func (client *AlertRulesClient) getHandleResponse(resp *http.Response) (AlertRulesGetResponse, error) { result := AlertRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleResource); err != nil { - return AlertRulesGetResponse{}, err + return AlertRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -263,7 +271,7 @@ func (client *AlertRulesClient) listByResourceGroupCreateRequest(ctx context.Con func (client *AlertRulesClient) listByResourceGroupHandleResponse(resp *http.Response) (AlertRulesListByResourceGroupResponse, error) { result := AlertRulesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleResourceCollection); err != nil { - return AlertRulesListByResourceGroupResponse{}, err + return AlertRulesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -320,7 +328,7 @@ func (client *AlertRulesClient) listBySubscriptionCreateRequest(ctx context.Cont func (client *AlertRulesClient) listBySubscriptionHandleResponse(resp *http.Response) (AlertRulesListBySubscriptionResponse, error) { result := AlertRulesListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleResourceCollection); err != nil { - return AlertRulesListBySubscriptionResponse{}, err + return AlertRulesListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -385,7 +393,7 @@ func (client *AlertRulesClient) updateCreateRequest(ctx context.Context, resourc func (client *AlertRulesClient) updateHandleResponse(resp *http.Response) (AlertRulesUpdateResponse, error) { result := AlertRulesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertRuleResource); err != nil { - return AlertRulesUpdateResponse{}, err + return AlertRulesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_autoscalesettings_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_autoscalesettings_client.go index 2e697ba93f25..2bc6e8d2c997 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_autoscalesettings_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_autoscalesettings_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AutoscaleSettingsClient contains the methods for the AutoscaleSettings group. @@ -30,8 +31,15 @@ type AutoscaleSettingsClient struct { } // NewAutoscaleSettingsClient creates a new instance of AutoscaleSettingsClient with the specified values. -func NewAutoscaleSettingsClient(con *arm.Connection, subscriptionID string) *AutoscaleSettingsClient { - return &AutoscaleSettingsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAutoscaleSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AutoscaleSettingsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AutoscaleSettingsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates an autoscale setting. @@ -81,7 +89,7 @@ func (client *AutoscaleSettingsClient) createOrUpdateCreateRequest(ctx context.C func (client *AutoscaleSettingsClient) createOrUpdateHandleResponse(resp *http.Response) (AutoscaleSettingsCreateOrUpdateResponse, error) { result := AutoscaleSettingsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AutoscaleSettingResource); err != nil { - return AutoscaleSettingsCreateOrUpdateResponse{}, err + return AutoscaleSettingsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -202,7 +210,7 @@ func (client *AutoscaleSettingsClient) getCreateRequest(ctx context.Context, res func (client *AutoscaleSettingsClient) getHandleResponse(resp *http.Response) (AutoscaleSettingsGetResponse, error) { result := AutoscaleSettingsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AutoscaleSettingResource); err != nil { - return AutoscaleSettingsGetResponse{}, err + return AutoscaleSettingsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -260,7 +268,7 @@ func (client *AutoscaleSettingsClient) listByResourceGroupCreateRequest(ctx cont func (client *AutoscaleSettingsClient) listByResourceGroupHandleResponse(resp *http.Response) (AutoscaleSettingsListByResourceGroupResponse, error) { result := AutoscaleSettingsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AutoscaleSettingResourceCollection); err != nil { - return AutoscaleSettingsListByResourceGroupResponse{}, err + return AutoscaleSettingsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -314,7 +322,7 @@ func (client *AutoscaleSettingsClient) listBySubscriptionCreateRequest(ctx conte func (client *AutoscaleSettingsClient) listBySubscriptionHandleResponse(resp *http.Response) (AutoscaleSettingsListBySubscriptionResponse, error) { result := AutoscaleSettingsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AutoscaleSettingResourceCollection); err != nil { - return AutoscaleSettingsListBySubscriptionResponse{}, err + return AutoscaleSettingsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -379,7 +387,7 @@ func (client *AutoscaleSettingsClient) updateCreateRequest(ctx context.Context, func (client *AutoscaleSettingsClient) updateHandleResponse(resp *http.Response) (AutoscaleSettingsUpdateResponse, error) { result := AutoscaleSettingsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AutoscaleSettingResource); err != nil { - return AutoscaleSettingsUpdateResponse{}, err + return AutoscaleSettingsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_baselines_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_baselines_client.go index 829028004bca..2c8785bba339 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_baselines_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_baselines_client.go @@ -10,14 +10,14 @@ package armmonitor import ( "context" - "errors" "fmt" - "net/http" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" ) // BaselinesClient contains the methods for the Baselines group. @@ -28,8 +28,15 @@ type BaselinesClient struct { } // NewBaselinesClient creates a new instance of BaselinesClient with the specified values. -func NewBaselinesClient(con *arm.Connection) *BaselinesClient { - return &BaselinesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewBaselinesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *BaselinesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &BaselinesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists the metric baseline values for a resource. @@ -52,9 +59,6 @@ func (client *BaselinesClient) List(ctx context.Context, resourceURI string, opt // listCreateRequest creates the List request. func (client *BaselinesClient) listCreateRequest(ctx context.Context, resourceURI string, options *BaselinesListOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.Insights/metricBaselines" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -95,7 +99,7 @@ func (client *BaselinesClient) listCreateRequest(ctx context.Context, resourceUR func (client *BaselinesClient) listHandleResponse(resp *http.Response) (BaselinesListResponse, error) { result := BaselinesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricBaselinesResponse); err != nil { - return BaselinesListResponse{}, err + return BaselinesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_constants.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_constants.go index 93694f380ae8..7a44c1ce0ccf 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_constants.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_constants.go @@ -10,7 +10,7 @@ package armmonitor const ( module = "armmonitor" - version = "v0.1.0" + version = "v0.2.0" ) // AggregationType - the aggregation type of the metric. diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionendpoints_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionendpoints_client.go index 07fae94229e6..07265ab80dfc 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionendpoints_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionendpoints_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DataCollectionEndpointsClient contains the methods for the DataCollectionEndpoints group. @@ -30,8 +31,15 @@ type DataCollectionEndpointsClient struct { } // NewDataCollectionEndpointsClient creates a new instance of DataCollectionEndpointsClient with the specified values. -func NewDataCollectionEndpointsClient(con *arm.Connection, subscriptionID string) *DataCollectionEndpointsClient { - return &DataCollectionEndpointsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDataCollectionEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DataCollectionEndpointsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DataCollectionEndpointsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Creates or updates a data collection endpoint. @@ -84,7 +92,7 @@ func (client *DataCollectionEndpointsClient) createCreateRequest(ctx context.Con func (client *DataCollectionEndpointsClient) createHandleResponse(resp *http.Response) (DataCollectionEndpointsCreateResponse, error) { result := DataCollectionEndpointsCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResource); err != nil { - return DataCollectionEndpointsCreateResponse{}, err + return DataCollectionEndpointsCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -205,7 +213,7 @@ func (client *DataCollectionEndpointsClient) getCreateRequest(ctx context.Contex func (client *DataCollectionEndpointsClient) getHandleResponse(resp *http.Response) (DataCollectionEndpointsGetResponse, error) { result := DataCollectionEndpointsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResource); err != nil { - return DataCollectionEndpointsGetResponse{}, err + return DataCollectionEndpointsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -263,7 +271,7 @@ func (client *DataCollectionEndpointsClient) listByResourceGroupCreateRequest(ct func (client *DataCollectionEndpointsClient) listByResourceGroupHandleResponse(resp *http.Response) (DataCollectionEndpointsListByResourceGroupResponse, error) { result := DataCollectionEndpointsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResourceListResult); err != nil { - return DataCollectionEndpointsListByResourceGroupResponse{}, err + return DataCollectionEndpointsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -317,7 +325,7 @@ func (client *DataCollectionEndpointsClient) listBySubscriptionCreateRequest(ctx func (client *DataCollectionEndpointsClient) listBySubscriptionHandleResponse(resp *http.Response) (DataCollectionEndpointsListBySubscriptionResponse, error) { result := DataCollectionEndpointsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResourceListResult); err != nil { - return DataCollectionEndpointsListBySubscriptionResponse{}, err + return DataCollectionEndpointsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -385,7 +393,7 @@ func (client *DataCollectionEndpointsClient) updateCreateRequest(ctx context.Con func (client *DataCollectionEndpointsClient) updateHandleResponse(resp *http.Response) (DataCollectionEndpointsUpdateResponse, error) { result := DataCollectionEndpointsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionEndpointResource); err != nil { - return DataCollectionEndpointsUpdateResponse{}, err + return DataCollectionEndpointsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionruleassociations_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionruleassociations_client.go index 16c9d802e143..5161f2aafdb9 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionruleassociations_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionruleassociations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DataCollectionRuleAssociationsClient contains the methods for the DataCollectionRuleAssociations group. @@ -30,8 +31,15 @@ type DataCollectionRuleAssociationsClient struct { } // NewDataCollectionRuleAssociationsClient creates a new instance of DataCollectionRuleAssociationsClient with the specified values. -func NewDataCollectionRuleAssociationsClient(con *arm.Connection, subscriptionID string) *DataCollectionRuleAssociationsClient { - return &DataCollectionRuleAssociationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDataCollectionRuleAssociationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DataCollectionRuleAssociationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DataCollectionRuleAssociationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Creates or updates an association. @@ -54,9 +62,6 @@ func (client *DataCollectionRuleAssociationsClient) Create(ctx context.Context, // createCreateRequest creates the Create request. func (client *DataCollectionRuleAssociationsClient) createCreateRequest(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsCreateOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) if associationName == "" { return nil, errors.New("parameter associationName cannot be empty") @@ -80,7 +85,7 @@ func (client *DataCollectionRuleAssociationsClient) createCreateRequest(ctx cont func (client *DataCollectionRuleAssociationsClient) createHandleResponse(resp *http.Response) (DataCollectionRuleAssociationsCreateResponse, error) { result := DataCollectionRuleAssociationsCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleAssociationProxyOnlyResource); err != nil { - return DataCollectionRuleAssociationsCreateResponse{}, err + return DataCollectionRuleAssociationsCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -118,9 +123,6 @@ func (client *DataCollectionRuleAssociationsClient) Delete(ctx context.Context, // deleteCreateRequest creates the Delete request. func (client *DataCollectionRuleAssociationsClient) deleteCreateRequest(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsDeleteOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) if associationName == "" { return nil, errors.New("parameter associationName cannot be empty") @@ -170,9 +172,6 @@ func (client *DataCollectionRuleAssociationsClient) Get(ctx context.Context, res // getCreateRequest creates the Get request. func (client *DataCollectionRuleAssociationsClient) getCreateRequest(ctx context.Context, resourceURI string, associationName string, options *DataCollectionRuleAssociationsGetOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations/{associationName}" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) if associationName == "" { return nil, errors.New("parameter associationName cannot be empty") @@ -193,7 +192,7 @@ func (client *DataCollectionRuleAssociationsClient) getCreateRequest(ctx context func (client *DataCollectionRuleAssociationsClient) getHandleResponse(resp *http.Response) (DataCollectionRuleAssociationsGetResponse, error) { result := DataCollectionRuleAssociationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleAssociationProxyOnlyResource); err != nil { - return DataCollectionRuleAssociationsGetResponse{}, err + return DataCollectionRuleAssociationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -228,9 +227,6 @@ func (client *DataCollectionRuleAssociationsClient) ListByResource(resourceURI s // listByResourceCreateRequest creates the ListByResource request. func (client *DataCollectionRuleAssociationsClient) listByResourceCreateRequest(ctx context.Context, resourceURI string, options *DataCollectionRuleAssociationsListByResourceOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.Insights/dataCollectionRuleAssociations" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -247,7 +243,7 @@ func (client *DataCollectionRuleAssociationsClient) listByResourceCreateRequest( func (client *DataCollectionRuleAssociationsClient) listByResourceHandleResponse(resp *http.Response) (DataCollectionRuleAssociationsListByResourceResponse, error) { result := DataCollectionRuleAssociationsListByResourceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleAssociationProxyOnlyResourceListResult); err != nil { - return DataCollectionRuleAssociationsListByResourceResponse{}, err + return DataCollectionRuleAssociationsListByResourceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -309,7 +305,7 @@ func (client *DataCollectionRuleAssociationsClient) listByRuleCreateRequest(ctx func (client *DataCollectionRuleAssociationsClient) listByRuleHandleResponse(resp *http.Response) (DataCollectionRuleAssociationsListByRuleResponse, error) { result := DataCollectionRuleAssociationsListByRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleAssociationProxyOnlyResourceListResult); err != nil { - return DataCollectionRuleAssociationsListByRuleResponse{}, err + return DataCollectionRuleAssociationsListByRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionrules_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionrules_client.go index 1a78ea56fae8..a20faf7f2271 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionrules_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_datacollectionrules_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DataCollectionRulesClient contains the methods for the DataCollectionRules group. @@ -30,8 +31,15 @@ type DataCollectionRulesClient struct { } // NewDataCollectionRulesClient creates a new instance of DataCollectionRulesClient with the specified values. -func NewDataCollectionRulesClient(con *arm.Connection, subscriptionID string) *DataCollectionRulesClient { - return &DataCollectionRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDataCollectionRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DataCollectionRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DataCollectionRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Creates or updates a data collection rule. @@ -84,7 +92,7 @@ func (client *DataCollectionRulesClient) createCreateRequest(ctx context.Context func (client *DataCollectionRulesClient) createHandleResponse(resp *http.Response) (DataCollectionRulesCreateResponse, error) { result := DataCollectionRulesCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleResource); err != nil { - return DataCollectionRulesCreateResponse{}, err + return DataCollectionRulesCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -205,7 +213,7 @@ func (client *DataCollectionRulesClient) getCreateRequest(ctx context.Context, r func (client *DataCollectionRulesClient) getHandleResponse(resp *http.Response) (DataCollectionRulesGetResponse, error) { result := DataCollectionRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleResource); err != nil { - return DataCollectionRulesGetResponse{}, err + return DataCollectionRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -263,7 +271,7 @@ func (client *DataCollectionRulesClient) listByResourceGroupCreateRequest(ctx co func (client *DataCollectionRulesClient) listByResourceGroupHandleResponse(resp *http.Response) (DataCollectionRulesListByResourceGroupResponse, error) { result := DataCollectionRulesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleResourceListResult); err != nil { - return DataCollectionRulesListByResourceGroupResponse{}, err + return DataCollectionRulesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -317,7 +325,7 @@ func (client *DataCollectionRulesClient) listBySubscriptionCreateRequest(ctx con func (client *DataCollectionRulesClient) listBySubscriptionHandleResponse(resp *http.Response) (DataCollectionRulesListBySubscriptionResponse, error) { result := DataCollectionRulesListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleResourceListResult); err != nil { - return DataCollectionRulesListBySubscriptionResponse{}, err + return DataCollectionRulesListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -385,7 +393,7 @@ func (client *DataCollectionRulesClient) updateCreateRequest(ctx context.Context func (client *DataCollectionRulesClient) updateHandleResponse(resp *http.Response) (DataCollectionRulesUpdateResponse, error) { result := DataCollectionRulesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataCollectionRuleResource); err != nil { - return DataCollectionRulesUpdateResponse{}, err + return DataCollectionRulesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_diagnosticsettings_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_diagnosticsettings_client.go index c3b5edd3b921..4169df0c7947 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_diagnosticsettings_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_diagnosticsettings_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DiagnosticSettingsClient contains the methods for the DiagnosticSettings group. @@ -29,8 +30,15 @@ type DiagnosticSettingsClient struct { } // NewDiagnosticSettingsClient creates a new instance of DiagnosticSettingsClient with the specified values. -func NewDiagnosticSettingsClient(con *arm.Connection) *DiagnosticSettingsClient { - return &DiagnosticSettingsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewDiagnosticSettingsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *DiagnosticSettingsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DiagnosticSettingsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates diagnostic settings for the specified resource. @@ -53,9 +61,6 @@ func (client *DiagnosticSettingsClient) CreateOrUpdate(ctx context.Context, reso // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *DiagnosticSettingsClient) createOrUpdateCreateRequest(ctx context.Context, resourceURI string, name string, parameters DiagnosticSettingsResource, options *DiagnosticSettingsCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) if name == "" { return nil, errors.New("parameter name cannot be empty") @@ -76,7 +81,7 @@ func (client *DiagnosticSettingsClient) createOrUpdateCreateRequest(ctx context. func (client *DiagnosticSettingsClient) createOrUpdateHandleResponse(resp *http.Response) (DiagnosticSettingsCreateOrUpdateResponse, error) { result := DiagnosticSettingsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticSettingsResource); err != nil { - return DiagnosticSettingsCreateOrUpdateResponse{}, err + return DiagnosticSettingsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -114,9 +119,6 @@ func (client *DiagnosticSettingsClient) Delete(ctx context.Context, resourceURI // deleteCreateRequest creates the Delete request. func (client *DiagnosticSettingsClient) deleteCreateRequest(ctx context.Context, resourceURI string, name string, options *DiagnosticSettingsDeleteOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) if name == "" { return nil, errors.New("parameter name cannot be empty") @@ -166,9 +168,6 @@ func (client *DiagnosticSettingsClient) Get(ctx context.Context, resourceURI str // getCreateRequest creates the Get request. func (client *DiagnosticSettingsClient) getCreateRequest(ctx context.Context, resourceURI string, name string, options *DiagnosticSettingsGetOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings/{name}" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) if name == "" { return nil, errors.New("parameter name cannot be empty") @@ -189,7 +188,7 @@ func (client *DiagnosticSettingsClient) getCreateRequest(ctx context.Context, re func (client *DiagnosticSettingsClient) getHandleResponse(resp *http.Response) (DiagnosticSettingsGetResponse, error) { result := DiagnosticSettingsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticSettingsResource); err != nil { - return DiagnosticSettingsGetResponse{}, err + return DiagnosticSettingsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -227,9 +226,6 @@ func (client *DiagnosticSettingsClient) List(ctx context.Context, resourceURI st // listCreateRequest creates the List request. func (client *DiagnosticSettingsClient) listCreateRequest(ctx context.Context, resourceURI string, options *DiagnosticSettingsListOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettings" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -246,7 +242,7 @@ func (client *DiagnosticSettingsClient) listCreateRequest(ctx context.Context, r func (client *DiagnosticSettingsClient) listHandleResponse(resp *http.Response) (DiagnosticSettingsListResponse, error) { result := DiagnosticSettingsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticSettingsResourceCollection); err != nil { - return DiagnosticSettingsListResponse{}, err + return DiagnosticSettingsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_diagnosticsettingscategory_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_diagnosticsettingscategory_client.go index 7f0518db2d6a..63c508e51c13 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_diagnosticsettingscategory_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_diagnosticsettingscategory_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DiagnosticSettingsCategoryClient contains the methods for the DiagnosticSettingsCategory group. @@ -29,8 +30,15 @@ type DiagnosticSettingsCategoryClient struct { } // NewDiagnosticSettingsCategoryClient creates a new instance of DiagnosticSettingsCategoryClient with the specified values. -func NewDiagnosticSettingsCategoryClient(con *arm.Connection) *DiagnosticSettingsCategoryClient { - return &DiagnosticSettingsCategoryClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewDiagnosticSettingsCategoryClient(credential azcore.TokenCredential, options *arm.ClientOptions) *DiagnosticSettingsCategoryClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DiagnosticSettingsCategoryClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the diagnostic settings category for the specified resource. @@ -53,9 +61,6 @@ func (client *DiagnosticSettingsCategoryClient) Get(ctx context.Context, resourc // getCreateRequest creates the Get request. func (client *DiagnosticSettingsCategoryClient) getCreateRequest(ctx context.Context, resourceURI string, name string, options *DiagnosticSettingsCategoryGetOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories/{name}" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) if name == "" { return nil, errors.New("parameter name cannot be empty") @@ -76,7 +81,7 @@ func (client *DiagnosticSettingsCategoryClient) getCreateRequest(ctx context.Con func (client *DiagnosticSettingsCategoryClient) getHandleResponse(resp *http.Response) (DiagnosticSettingsCategoryGetResponse, error) { result := DiagnosticSettingsCategoryGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticSettingsCategoryResource); err != nil { - return DiagnosticSettingsCategoryGetResponse{}, err + return DiagnosticSettingsCategoryGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -114,9 +119,6 @@ func (client *DiagnosticSettingsCategoryClient) List(ctx context.Context, resour // listCreateRequest creates the List request. func (client *DiagnosticSettingsCategoryClient) listCreateRequest(ctx context.Context, resourceURI string, options *DiagnosticSettingsCategoryListOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.Insights/diagnosticSettingsCategories" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -133,7 +135,7 @@ func (client *DiagnosticSettingsCategoryClient) listCreateRequest(ctx context.Co func (client *DiagnosticSettingsCategoryClient) listHandleResponse(resp *http.Response) (DiagnosticSettingsCategoryListResponse, error) { result := DiagnosticSettingsCategoryListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticSettingsCategoryResourceCollection); err != nil { - return DiagnosticSettingsCategoryListResponse{}, err + return DiagnosticSettingsCategoryListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_eventcategories_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_eventcategories_client.go index 2bc435bd493c..e91f73531d1f 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_eventcategories_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_eventcategories_client.go @@ -11,11 +11,12 @@ package armmonitor import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // EventCategoriesClient contains the methods for the EventCategories group. @@ -26,8 +27,15 @@ type EventCategoriesClient struct { } // NewEventCategoriesClient creates a new instance of EventCategoriesClient with the specified values. -func NewEventCategoriesClient(con *arm.Connection) *EventCategoriesClient { - return &EventCategoriesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewEventCategoriesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *EventCategoriesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &EventCategoriesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Get the list of available event categories supported in the Activity Logs Service. The current list includes the following: Administrative, Security, @@ -66,7 +74,7 @@ func (client *EventCategoriesClient) listCreateRequest(ctx context.Context, opti func (client *EventCategoriesClient) listHandleResponse(resp *http.Response) (EventCategoriesListResponse, error) { result := EventCategoriesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventCategoryCollection); err != nil { - return EventCategoriesListResponse{}, err + return EventCategoriesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_logprofiles_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_logprofiles_client.go index b53258ad3acf..90381e798c9f 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_logprofiles_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_logprofiles_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LogProfilesClient contains the methods for the LogProfiles group. @@ -30,8 +31,15 @@ type LogProfilesClient struct { } // NewLogProfilesClient creates a new instance of LogProfilesClient with the specified values. -func NewLogProfilesClient(con *arm.Connection, subscriptionID string) *LogProfilesClient { - return &LogProfilesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLogProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LogProfilesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LogProfilesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update a log profile in Azure Monitoring REST API. @@ -77,7 +85,7 @@ func (client *LogProfilesClient) createOrUpdateCreateRequest(ctx context.Context func (client *LogProfilesClient) createOrUpdateHandleResponse(resp *http.Response) (LogProfilesCreateOrUpdateResponse, error) { result := LogProfilesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LogProfileResource); err != nil { - return LogProfilesCreateOrUpdateResponse{}, err + return LogProfilesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -187,7 +195,7 @@ func (client *LogProfilesClient) getCreateRequest(ctx context.Context, logProfil func (client *LogProfilesClient) getHandleResponse(resp *http.Response) (LogProfilesGetResponse, error) { result := LogProfilesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LogProfileResource); err != nil { - return LogProfilesGetResponse{}, err + return LogProfilesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -244,7 +252,7 @@ func (client *LogProfilesClient) listCreateRequest(ctx context.Context, options func (client *LogProfilesClient) listHandleResponse(resp *http.Response) (LogProfilesListResponse, error) { result := LogProfilesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LogProfileCollection); err != nil { - return LogProfilesListResponse{}, err + return LogProfilesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -304,7 +312,7 @@ func (client *LogProfilesClient) updateCreateRequest(ctx context.Context, logPro func (client *LogProfilesClient) updateHandleResponse(resp *http.Response) (LogProfilesUpdateResponse, error) { result := LogProfilesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LogProfileResource); err != nil { - return LogProfilesUpdateResponse{}, err + return LogProfilesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricalerts_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricalerts_client.go index bf461900af1d..f5069ecdb53a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricalerts_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricalerts_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // MetricAlertsClient contains the methods for the MetricAlerts group. @@ -30,8 +31,15 @@ type MetricAlertsClient struct { } // NewMetricAlertsClient creates a new instance of MetricAlertsClient with the specified values. -func NewMetricAlertsClient(con *arm.Connection, subscriptionID string) *MetricAlertsClient { - return &MetricAlertsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewMetricAlertsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *MetricAlertsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MetricAlertsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update an metric alert definition. @@ -81,7 +89,7 @@ func (client *MetricAlertsClient) createOrUpdateCreateRequest(ctx context.Contex func (client *MetricAlertsClient) createOrUpdateHandleResponse(resp *http.Response) (MetricAlertsCreateOrUpdateResponse, error) { result := MetricAlertsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertResource); err != nil { - return MetricAlertsCreateOrUpdateResponse{}, err + return MetricAlertsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -202,7 +210,7 @@ func (client *MetricAlertsClient) getCreateRequest(ctx context.Context, resource func (client *MetricAlertsClient) getHandleResponse(resp *http.Response) (MetricAlertsGetResponse, error) { result := MetricAlertsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertResource); err != nil { - return MetricAlertsGetResponse{}, err + return MetricAlertsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -263,7 +271,7 @@ func (client *MetricAlertsClient) listByResourceGroupCreateRequest(ctx context.C func (client *MetricAlertsClient) listByResourceGroupHandleResponse(resp *http.Response) (MetricAlertsListByResourceGroupResponse, error) { result := MetricAlertsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertResourceCollection); err != nil { - return MetricAlertsListByResourceGroupResponse{}, err + return MetricAlertsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -320,7 +328,7 @@ func (client *MetricAlertsClient) listBySubscriptionCreateRequest(ctx context.Co func (client *MetricAlertsClient) listBySubscriptionHandleResponse(resp *http.Response) (MetricAlertsListBySubscriptionResponse, error) { result := MetricAlertsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertResourceCollection); err != nil { - return MetricAlertsListBySubscriptionResponse{}, err + return MetricAlertsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -385,7 +393,7 @@ func (client *MetricAlertsClient) updateCreateRequest(ctx context.Context, resou func (client *MetricAlertsClient) updateHandleResponse(resp *http.Response) (MetricAlertsUpdateResponse, error) { result := MetricAlertsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertResource); err != nil { - return MetricAlertsUpdateResponse{}, err + return MetricAlertsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricalertsstatus_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricalertsstatus_client.go index 34629a60cb32..84a09907129a 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricalertsstatus_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricalertsstatus_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // MetricAlertsStatusClient contains the methods for the MetricAlertsStatus group. @@ -30,8 +31,15 @@ type MetricAlertsStatusClient struct { } // NewMetricAlertsStatusClient creates a new instance of MetricAlertsStatusClient with the specified values. -func NewMetricAlertsStatusClient(con *arm.Connection, subscriptionID string) *MetricAlertsStatusClient { - return &MetricAlertsStatusClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewMetricAlertsStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *MetricAlertsStatusClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MetricAlertsStatusClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Retrieve an alert rule status. @@ -81,7 +89,7 @@ func (client *MetricAlertsStatusClient) listCreateRequest(ctx context.Context, r func (client *MetricAlertsStatusClient) listHandleResponse(resp *http.Response) (MetricAlertsStatusListResponse, error) { result := MetricAlertsStatusListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertStatusCollection); err != nil { - return MetricAlertsStatusListResponse{}, err + return MetricAlertsStatusListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -150,7 +158,7 @@ func (client *MetricAlertsStatusClient) listByNameCreateRequest(ctx context.Cont func (client *MetricAlertsStatusClient) listByNameHandleResponse(resp *http.Response) (MetricAlertsStatusListByNameResponse, error) { result := MetricAlertsStatusListByNameResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricAlertStatusCollection); err != nil { - return MetricAlertsStatusListByNameResponse{}, err + return MetricAlertsStatusListByNameResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricdefinitions_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricdefinitions_client.go index 98ae4602705c..a97042da73ef 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricdefinitions_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricdefinitions_client.go @@ -10,14 +10,14 @@ package armmonitor import ( "context" - "errors" "fmt" - "net/http" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" ) // MetricDefinitionsClient contains the methods for the MetricDefinitions group. @@ -28,8 +28,15 @@ type MetricDefinitionsClient struct { } // NewMetricDefinitionsClient creates a new instance of MetricDefinitionsClient with the specified values. -func NewMetricDefinitionsClient(con *arm.Connection) *MetricDefinitionsClient { - return &MetricDefinitionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewMetricDefinitionsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *MetricDefinitionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MetricDefinitionsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists the metric definitions for the resource. @@ -52,9 +59,6 @@ func (client *MetricDefinitionsClient) List(ctx context.Context, resourceURI str // listCreateRequest creates the List request. func (client *MetricDefinitionsClient) listCreateRequest(ctx context.Context, resourceURI string, options *MetricDefinitionsListOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.Insights/metricDefinitions" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -74,7 +78,7 @@ func (client *MetricDefinitionsClient) listCreateRequest(ctx context.Context, re func (client *MetricDefinitionsClient) listHandleResponse(resp *http.Response) (MetricDefinitionsListResponse, error) { result := MetricDefinitionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricDefinitionCollection); err != nil { - return MetricDefinitionsListResponse{}, err + return MetricDefinitionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricnamespaces_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricnamespaces_client.go index 98d081bb3117..33a19e579854 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricnamespaces_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_metricnamespaces_client.go @@ -10,14 +10,14 @@ package armmonitor import ( "context" - "errors" "fmt" - "net/http" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" ) // MetricNamespacesClient contains the methods for the MetricNamespaces group. @@ -28,8 +28,15 @@ type MetricNamespacesClient struct { } // NewMetricNamespacesClient creates a new instance of MetricNamespacesClient with the specified values. -func NewMetricNamespacesClient(con *arm.Connection) *MetricNamespacesClient { - return &MetricNamespacesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewMetricNamespacesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *MetricNamespacesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MetricNamespacesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists the metric namespaces for the resource. @@ -52,9 +59,6 @@ func (client *MetricNamespacesClient) List(ctx context.Context, resourceURI stri // listCreateRequest creates the List request. func (client *MetricNamespacesClient) listCreateRequest(ctx context.Context, resourceURI string, options *MetricNamespacesListOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/microsoft.insights/metricNamespaces" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -74,7 +78,7 @@ func (client *MetricNamespacesClient) listCreateRequest(ctx context.Context, res func (client *MetricNamespacesClient) listHandleResponse(resp *http.Response) (MetricNamespacesListResponse, error) { result := MetricNamespacesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricNamespaceCollection); err != nil { - return MetricNamespacesListResponse{}, err + return MetricNamespacesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metrics_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_metrics_client.go index 92a59f13faed..88b46140e926 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_metrics_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_metrics_client.go @@ -10,15 +10,15 @@ package armmonitor import ( "context" - "errors" "fmt" - "net/http" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strconv" + "strings" ) // MetricsClient contains the methods for the Metrics group. @@ -29,8 +29,15 @@ type MetricsClient struct { } // NewMetricsClient creates a new instance of MetricsClient with the specified values. -func NewMetricsClient(con *arm.Connection) *MetricsClient { - return &MetricsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewMetricsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *MetricsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MetricsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists the metric values for a resource. @@ -53,9 +60,6 @@ func (client *MetricsClient) List(ctx context.Context, resourceURI string, optio // listCreateRequest creates the List request. func (client *MetricsClient) listCreateRequest(ctx context.Context, resourceURI string, options *MetricsListOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.Insights/metrics" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -99,7 +103,7 @@ func (client *MetricsClient) listCreateRequest(ctx context.Context, resourceURI func (client *MetricsClient) listHandleResponse(resp *http.Response) (MetricsListResponse, error) { result := MetricsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Response); err != nil { - return MetricsListResponse{}, err + return MetricsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_models.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_models.go index aaf3ef5a207f..5fea23df9d4d 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_models.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_models.go @@ -10,10 +10,9 @@ package armmonitor import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // ActionClassification provides polymorphic access to related types. @@ -422,7 +421,7 @@ func (a AlertRule) MarshalJSON() ([]byte, error) { populate(objectMap, "condition", a.Condition) populate(objectMap, "description", a.Description) populate(objectMap, "isEnabled", a.IsEnabled) - populate(objectMap, "lastUpdatedTime", (*timeRFC3339)(a.LastUpdatedTime)) + populateTimeRFC3339(objectMap, "lastUpdatedTime", a.LastUpdatedTime) populate(objectMap, "name", a.Name) populate(objectMap, "provisioningState", a.ProvisioningState) return json.Marshal(objectMap) @@ -453,9 +452,7 @@ func (a *AlertRule) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.IsEnabled) delete(rawMsg, key) case "lastUpdatedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.LastUpdatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.LastUpdatedTime) delete(rawMsg, key) case "name": err = unpopulate(val, &a.Name) @@ -1641,7 +1638,7 @@ func (d DynamicMetricCriteria) MarshalJSON() ([]byte, error) { d.MultiMetricCriteria.marshalInternal(objectMap, CriterionTypeDynamicThresholdCriterion) populate(objectMap, "alertSensitivity", d.AlertSensitivity) populate(objectMap, "failingPeriods", d.FailingPeriods) - populate(objectMap, "ignoreDataBefore", (*timeRFC3339)(d.IgnoreDataBefore)) + populateTimeRFC3339(objectMap, "ignoreDataBefore", d.IgnoreDataBefore) populate(objectMap, "operator", d.Operator) return json.Marshal(objectMap) } @@ -1662,9 +1659,7 @@ func (d *DynamicMetricCriteria) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.FailingPeriods) delete(rawMsg, key) case "ignoreDataBefore": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.IgnoreDataBefore = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.IgnoreDataBefore) delete(rawMsg, key) case "operator": err = unpopulate(val, &d.Operator) @@ -1948,7 +1943,7 @@ func (e EventData) MarshalJSON() ([]byte, error) { populate(objectMap, "description", e.Description) populate(objectMap, "eventDataId", e.EventDataID) populate(objectMap, "eventName", e.EventName) - populate(objectMap, "eventTimestamp", (*timeRFC3339)(e.EventTimestamp)) + populateTimeRFC3339(objectMap, "eventTimestamp", e.EventTimestamp) populate(objectMap, "httpRequest", e.HTTPRequest) populate(objectMap, "id", e.ID) populate(objectMap, "level", e.Level) @@ -1961,7 +1956,7 @@ func (e EventData) MarshalJSON() ([]byte, error) { populate(objectMap, "resourceType", e.ResourceType) populate(objectMap, "status", e.Status) populate(objectMap, "subStatus", e.SubStatus) - populate(objectMap, "submissionTimestamp", (*timeRFC3339)(e.SubmissionTimestamp)) + populateTimeRFC3339(objectMap, "submissionTimestamp", e.SubmissionTimestamp) populate(objectMap, "subscriptionId", e.SubscriptionID) populate(objectMap, "tenantId", e.TenantID) return json.Marshal(objectMap) @@ -2001,9 +1996,7 @@ func (e *EventData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.EventName) delete(rawMsg, key) case "eventTimestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.EventTimestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.EventTimestamp) delete(rawMsg, key) case "httpRequest": err = unpopulate(val, &e.HTTPRequest) @@ -2042,9 +2035,7 @@ func (e *EventData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.SubStatus) delete(rawMsg, key) case "submissionTimestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.SubmissionTimestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.SubmissionTimestamp) delete(rawMsg, key) case "subscriptionId": err = unpopulate(val, &e.SubscriptionID) @@ -2145,10 +2136,10 @@ type Incident struct { // MarshalJSON implements the json.Marshaller interface for type Incident. func (i Incident) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "activatedTime", (*timeRFC3339)(i.ActivatedTime)) + populateTimeRFC3339(objectMap, "activatedTime", i.ActivatedTime) populate(objectMap, "isActive", i.IsActive) populate(objectMap, "name", i.Name) - populate(objectMap, "resolvedTime", (*timeRFC3339)(i.ResolvedTime)) + populateTimeRFC3339(objectMap, "resolvedTime", i.ResolvedTime) populate(objectMap, "ruleName", i.RuleName) return json.Marshal(objectMap) } @@ -2163,9 +2154,7 @@ func (i *Incident) UnmarshalJSON(data []byte) error { var err error switch key { case "activatedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.ActivatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.ActivatedTime) delete(rawMsg, key) case "isActive": err = unpopulate(val, &i.IsActive) @@ -2174,9 +2163,7 @@ func (i *Incident) UnmarshalJSON(data []byte) error { err = unpopulate(val, &i.Name) delete(rawMsg, key) case "resolvedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.ResolvedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.ResolvedTime) delete(rawMsg, key) case "ruleName": err = unpopulate(val, &i.RuleName) @@ -2450,7 +2437,7 @@ func (l LogSearchRule) MarshalJSON() ([]byte, error) { populate(objectMap, "displayName", l.DisplayName) populate(objectMap, "enabled", l.Enabled) populate(objectMap, "isLegacyLogAnalyticsRule", l.IsLegacyLogAnalyticsRule) - populate(objectMap, "lastUpdatedTime", (*timeRFC3339)(l.LastUpdatedTime)) + populateTimeRFC3339(objectMap, "lastUpdatedTime", l.LastUpdatedTime) populate(objectMap, "provisioningState", l.ProvisioningState) populate(objectMap, "schedule", l.Schedule) populate(objectMap, "source", l.Source) @@ -2488,9 +2475,7 @@ func (l *LogSearchRule) UnmarshalJSON(data []byte) error { err = unpopulate(val, &l.IsLegacyLogAnalyticsRule) delete(rawMsg, key) case "lastUpdatedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.LastUpdatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.LastUpdatedTime) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, &l.ProvisioningState) @@ -2910,7 +2895,7 @@ func (m MetricAlertProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "enabled", m.Enabled) populate(objectMap, "evaluationFrequency", m.EvaluationFrequency) populate(objectMap, "isMigrated", m.IsMigrated) - populate(objectMap, "lastUpdatedTime", (*timeRFC3339)(m.LastUpdatedTime)) + populateTimeRFC3339(objectMap, "lastUpdatedTime", m.LastUpdatedTime) populate(objectMap, "scopes", m.Scopes) populate(objectMap, "severity", m.Severity) populate(objectMap, "targetResourceRegion", m.TargetResourceRegion) @@ -2950,9 +2935,7 @@ func (m *MetricAlertProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.IsMigrated) delete(rawMsg, key) case "lastUpdatedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.LastUpdatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.LastUpdatedTime) delete(rawMsg, key) case "scopes": err = unpopulate(val, &m.Scopes) @@ -3029,7 +3012,7 @@ func (m MetricAlertPropertiesPatch) MarshalJSON() ([]byte, error) { populate(objectMap, "enabled", m.Enabled) populate(objectMap, "evaluationFrequency", m.EvaluationFrequency) populate(objectMap, "isMigrated", m.IsMigrated) - populate(objectMap, "lastUpdatedTime", (*timeRFC3339)(m.LastUpdatedTime)) + populateTimeRFC3339(objectMap, "lastUpdatedTime", m.LastUpdatedTime) populate(objectMap, "scopes", m.Scopes) populate(objectMap, "severity", m.Severity) populate(objectMap, "targetResourceRegion", m.TargetResourceRegion) @@ -3069,9 +3052,7 @@ func (m *MetricAlertPropertiesPatch) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.IsMigrated) delete(rawMsg, key) case "lastUpdatedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.LastUpdatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.LastUpdatedTime) delete(rawMsg, key) case "scopes": err = unpopulate(val, &m.Scopes) @@ -3224,7 +3205,7 @@ func (m MetricAlertStatusProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "dimensions", m.Dimensions) populate(objectMap, "status", m.Status) - populate(objectMap, "timestamp", (*timeRFC3339)(m.Timestamp)) + populateTimeRFC3339(objectMap, "timestamp", m.Timestamp) return json.Marshal(objectMap) } @@ -3244,9 +3225,7 @@ func (m *MetricAlertStatusProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.Status) delete(rawMsg, key) case "timestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.Timestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.Timestamp) delete(rawMsg, key) } if err != nil { @@ -3649,7 +3628,7 @@ func (m MetricValue) MarshalJSON() ([]byte, error) { populate(objectMap, "count", m.Count) populate(objectMap, "maximum", m.Maximum) populate(objectMap, "minimum", m.Minimum) - populate(objectMap, "timeStamp", (*timeRFC3339)(m.TimeStamp)) + populateTimeRFC3339(objectMap, "timeStamp", m.TimeStamp) populate(objectMap, "total", m.Total) return json.Marshal(objectMap) } @@ -3676,9 +3655,7 @@ func (m *MetricValue) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.Minimum) delete(rawMsg, key) case "timeStamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.TimeStamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.TimeStamp) delete(rawMsg, key) case "total": err = unpopulate(val, &m.Total) @@ -3900,11 +3877,11 @@ type OperationStatus struct { // MarshalJSON implements the json.Marshaller interface for type OperationStatus. func (o OperationStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "endTime", (*timeRFC3339)(o.EndTime)) + populateTimeRFC3339(objectMap, "endTime", o.EndTime) populate(objectMap, "error", o.Error) populate(objectMap, "id", o.ID) populate(objectMap, "name", o.Name) - populate(objectMap, "startTime", (*timeRFC3339)(o.StartTime)) + populateTimeRFC3339(objectMap, "startTime", o.StartTime) populate(objectMap, "status", o.Status) return json.Marshal(objectMap) } @@ -3919,9 +3896,7 @@ func (o *OperationStatus) UnmarshalJSON(data []byte) error { var err error switch key { case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - o.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &o.EndTime) delete(rawMsg, key) case "error": err = unpopulate(val, &o.Error) @@ -3933,9 +3908,7 @@ func (o *OperationStatus) UnmarshalJSON(data []byte) error { err = unpopulate(val, &o.Name) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - o.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &o.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &o.Status) @@ -5081,10 +5054,10 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { } func (s SystemData) marshalInternal(objectMap map[string]interface{}) { - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) } @@ -5094,9 +5067,7 @@ func (s *SystemData) unmarshalInternal(rawMsg map[string]json.RawMessage) error var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -5105,9 +5076,7 @@ func (s *SystemData) unmarshalInternal(rawMsg map[string]json.RawMessage) error err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) @@ -5304,8 +5273,8 @@ type TimeWindow struct { // MarshalJSON implements the json.Marshaller interface for type TimeWindow. func (t TimeWindow) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "end", (*timeRFC3339)(t.End)) - populate(objectMap, "start", (*timeRFC3339)(t.Start)) + populateTimeRFC3339(objectMap, "end", t.End) + populateTimeRFC3339(objectMap, "start", t.Start) populate(objectMap, "timeZone", t.TimeZone) return json.Marshal(objectMap) } @@ -5320,14 +5289,10 @@ func (t *TimeWindow) UnmarshalJSON(data []byte) error { var err error switch key { case "end": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.End = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.End) delete(rawMsg, key) case "start": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.Start = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.Start) delete(rawMsg, key) case "timeZone": err = unpopulate(val, &t.TimeZone) diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_operations_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_operations_client.go index de105714a012..2d2507cf5783 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_operations_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armmonitor import ( "context" "errors" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available operations from Microsoft.Insights provider. @@ -65,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_pagers.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_pagers.go index b4d0c5225da8..cc58af3d9e30 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_pagers.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armmonitor import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // ActivityLogsListPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_pollers.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_pollers.go index dfd74eb3e146..8e87b88c2d05 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_pollers.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armmonitor import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // PrivateEndpointConnectionsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_polymorphic_helpers.go index 737e85392547..57ffffdc2d85 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_polymorphic_helpers.go @@ -49,6 +49,25 @@ func unmarshalActionClassificationArray(rawMsg json.RawMessage) ([]ActionClassif return fArray, nil } +func unmarshalActionClassificationMap(rawMsg json.RawMessage) (map[string]ActionClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ActionClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalActionClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalMetricAlertCriteriaClassification(rawMsg json.RawMessage) (MetricAlertCriteriaClassification, error) { if rawMsg == nil { return nil, nil @@ -90,6 +109,25 @@ func unmarshalMetricAlertCriteriaClassificationArray(rawMsg json.RawMessage) ([] return fArray, nil } +func unmarshalMetricAlertCriteriaClassificationMap(rawMsg json.RawMessage) (map[string]MetricAlertCriteriaClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]MetricAlertCriteriaClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalMetricAlertCriteriaClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalMultiMetricCriteriaClassification(rawMsg json.RawMessage) (MultiMetricCriteriaClassification, error) { if rawMsg == nil { return nil, nil @@ -129,6 +167,25 @@ func unmarshalMultiMetricCriteriaClassificationArray(rawMsg json.RawMessage) ([] return fArray, nil } +func unmarshalMultiMetricCriteriaClassificationMap(rawMsg json.RawMessage) (map[string]MultiMetricCriteriaClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]MultiMetricCriteriaClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalMultiMetricCriteriaClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalRuleActionClassification(rawMsg json.RawMessage) (RuleActionClassification, error) { if rawMsg == nil { return nil, nil @@ -168,6 +225,25 @@ func unmarshalRuleActionClassificationArray(rawMsg json.RawMessage) ([]RuleActio return fArray, nil } +func unmarshalRuleActionClassificationMap(rawMsg json.RawMessage) (map[string]RuleActionClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]RuleActionClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalRuleActionClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalRuleConditionClassification(rawMsg json.RawMessage) (RuleConditionClassification, error) { if rawMsg == nil { return nil, nil @@ -209,6 +285,25 @@ func unmarshalRuleConditionClassificationArray(rawMsg json.RawMessage) ([]RuleCo return fArray, nil } +func unmarshalRuleConditionClassificationMap(rawMsg json.RawMessage) (map[string]RuleConditionClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]RuleConditionClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalRuleConditionClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalRuleDataSourceClassification(rawMsg json.RawMessage) (RuleDataSourceClassification, error) { if rawMsg == nil { return nil, nil @@ -247,3 +342,22 @@ func unmarshalRuleDataSourceClassificationArray(rawMsg json.RawMessage) ([]RuleD } return fArray, nil } + +func unmarshalRuleDataSourceClassificationMap(rawMsg json.RawMessage) (map[string]RuleDataSourceClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]RuleDataSourceClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalRuleDataSourceClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_privateendpointconnections_client.go index 8fd908f69622..362919591c47 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_privateendpointconnections_client.go @@ -11,14 +11,14 @@ package armmonitor import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. @@ -30,8 +30,15 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { - return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. @@ -242,7 +249,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsGetResponse{}, err + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -303,7 +310,7 @@ func (client *PrivateEndpointConnectionsClient) listByPrivateLinkScopeCreateRequ func (client *PrivateEndpointConnectionsClient) listByPrivateLinkScopeHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListByPrivateLinkScopeResponse, error) { result := PrivateEndpointConnectionsListByPrivateLinkScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionsListByPrivateLinkScopeResponse{}, err + return PrivateEndpointConnectionsListByPrivateLinkScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkresources_client.go index fdb116627c80..6eb3e887a269 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkresources_client.go @@ -11,13 +11,14 @@ package armmonitor import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. @@ -29,8 +30,15 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { - return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the private link resources that need to be created for a Azure Monitor PrivateLinkScope. @@ -84,7 +92,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesGetResponse, error) { result := PrivateLinkResourcesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { - return PrivateLinkResourcesGetResponse{}, err + return PrivateLinkResourcesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -145,7 +153,7 @@ func (client *PrivateLinkResourcesClient) listByPrivateLinkScopeCreateRequest(ct func (client *PrivateLinkResourcesClient) listByPrivateLinkScopeHandleResponse(resp *http.Response) (PrivateLinkResourcesListByPrivateLinkScopeResponse, error) { result := PrivateLinkResourcesListByPrivateLinkScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { - return PrivateLinkResourcesListByPrivateLinkScopeResponse{}, err + return PrivateLinkResourcesListByPrivateLinkScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopedresources_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopedresources_client.go index af1354c4c210..fbef384f7f5b 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopedresources_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopedresources_client.go @@ -11,14 +11,14 @@ package armmonitor import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkScopedResourcesClient contains the methods for the PrivateLinkScopedResources group. @@ -30,8 +30,15 @@ type PrivateLinkScopedResourcesClient struct { } // NewPrivateLinkScopedResourcesClient creates a new instance of PrivateLinkScopedResourcesClient with the specified values. -func NewPrivateLinkScopedResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkScopedResourcesClient { - return &PrivateLinkScopedResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkScopedResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkScopedResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkScopedResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. @@ -242,7 +249,7 @@ func (client *PrivateLinkScopedResourcesClient) getCreateRequest(ctx context.Con func (client *PrivateLinkScopedResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkScopedResourcesGetResponse, error) { result := PrivateLinkScopedResourcesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ScopedResource); err != nil { - return PrivateLinkScopedResourcesGetResponse{}, err + return PrivateLinkScopedResourcesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -303,7 +310,7 @@ func (client *PrivateLinkScopedResourcesClient) listByPrivateLinkScopeCreateRequ func (client *PrivateLinkScopedResourcesClient) listByPrivateLinkScopeHandleResponse(resp *http.Response) (PrivateLinkScopedResourcesListByPrivateLinkScopeResponse, error) { result := PrivateLinkScopedResourcesListByPrivateLinkScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ScopedResourceListResult); err != nil { - return PrivateLinkScopedResourcesListByPrivateLinkScopeResponse{}, err + return PrivateLinkScopedResourcesListByPrivateLinkScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopeoperationstatus_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopeoperationstatus_client.go index f2278125a78d..1033ac9d0592 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopeoperationstatus_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopeoperationstatus_client.go @@ -11,13 +11,14 @@ package armmonitor import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkScopeOperationStatusClient contains the methods for the PrivateLinkScopeOperationStatus group. @@ -29,8 +30,15 @@ type PrivateLinkScopeOperationStatusClient struct { } // NewPrivateLinkScopeOperationStatusClient creates a new instance of PrivateLinkScopeOperationStatusClient with the specified values. -func NewPrivateLinkScopeOperationStatusClient(con *arm.Connection, subscriptionID string) *PrivateLinkScopeOperationStatusClient { - return &PrivateLinkScopeOperationStatusClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkScopeOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkScopeOperationStatusClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkScopeOperationStatusClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get the status of an azure asynchronous operation associated with a private link scope operation. @@ -80,7 +88,7 @@ func (client *PrivateLinkScopeOperationStatusClient) getCreateRequest(ctx contex func (client *PrivateLinkScopeOperationStatusClient) getHandleResponse(resp *http.Response) (PrivateLinkScopeOperationStatusGetResponse, error) { result := PrivateLinkScopeOperationStatusGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return PrivateLinkScopeOperationStatusGetResponse{}, err + return PrivateLinkScopeOperationStatusGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopes_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopes_client.go index a6accda906dc..52139406f785 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopes_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_privatelinkscopes_client.go @@ -11,14 +11,14 @@ package armmonitor import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkScopesClient contains the methods for the PrivateLinkScopes group. @@ -30,8 +30,15 @@ type PrivateLinkScopesClient struct { } // NewPrivateLinkScopesClient creates a new instance of PrivateLinkScopesClient with the specified values. -func NewPrivateLinkScopesClient(con *arm.Connection, subscriptionID string) *PrivateLinkScopesClient { - return &PrivateLinkScopesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkScopesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkScopesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkScopesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates (or updates) a Azure Monitor PrivateLinkScope. Note: You cannot specify a different value for InstrumentationKey nor AppId in @@ -82,7 +89,7 @@ func (client *PrivateLinkScopesClient) createOrUpdateCreateRequest(ctx context.C func (client *PrivateLinkScopesClient) createOrUpdateHandleResponse(resp *http.Response) (PrivateLinkScopesCreateOrUpdateResponse, error) { result := PrivateLinkScopesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorPrivateLinkScope); err != nil { - return PrivateLinkScopesCreateOrUpdateResponse{}, err + return PrivateLinkScopesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -220,7 +227,7 @@ func (client *PrivateLinkScopesClient) getCreateRequest(ctx context.Context, res func (client *PrivateLinkScopesClient) getHandleResponse(resp *http.Response) (PrivateLinkScopesGetResponse, error) { result := PrivateLinkScopesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorPrivateLinkScope); err != nil { - return PrivateLinkScopesGetResponse{}, err + return PrivateLinkScopesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -273,7 +280,7 @@ func (client *PrivateLinkScopesClient) listCreateRequest(ctx context.Context, op func (client *PrivateLinkScopesClient) listHandleResponse(resp *http.Response) (PrivateLinkScopesListResponse, error) { result := PrivateLinkScopesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorPrivateLinkScopeListResult); err != nil { - return PrivateLinkScopesListResponse{}, err + return PrivateLinkScopesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -330,7 +337,7 @@ func (client *PrivateLinkScopesClient) listByResourceGroupCreateRequest(ctx cont func (client *PrivateLinkScopesClient) listByResourceGroupHandleResponse(resp *http.Response) (PrivateLinkScopesListByResourceGroupResponse, error) { result := PrivateLinkScopesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorPrivateLinkScopeListResult); err != nil { - return PrivateLinkScopesListByResourceGroupResponse{}, err + return PrivateLinkScopesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -394,7 +401,7 @@ func (client *PrivateLinkScopesClient) updateTagsCreateRequest(ctx context.Conte func (client *PrivateLinkScopesClient) updateTagsHandleResponse(resp *http.Response) (PrivateLinkScopesUpdateTagsResponse, error) { result := PrivateLinkScopesUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AzureMonitorPrivateLinkScope); err != nil { - return PrivateLinkScopesUpdateTagsResponse{}, err + return PrivateLinkScopesUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_response_types.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_response_types.go index a588b865855c..45840addd541 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_response_types.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armmonitor import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // ActionGroupsCreateOrUpdateResponse contains the response from method ActionGroups.CreateOrUpdate. @@ -800,6 +799,8 @@ type PrivateEndpointConnectionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsCreateOrUpdateResponse, error) { respType := PrivateEndpointConnectionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) @@ -850,6 +851,8 @@ type PrivateEndpointConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsDeleteResponse, error) { respType := PrivateEndpointConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -954,6 +957,8 @@ type PrivateLinkScopedResourcesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateLinkScopedResourcesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkScopedResourcesCreateOrUpdateResponse, error) { respType := PrivateLinkScopedResourcesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ScopedResource) @@ -1004,6 +1009,8 @@ type PrivateLinkScopedResourcesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateLinkScopedResourcesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkScopedResourcesDeleteResponse, error) { respType := PrivateLinkScopedResourcesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1084,6 +1091,8 @@ type PrivateLinkScopesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateLinkScopesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkScopesDeleteResponse, error) { respType := PrivateLinkScopesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_scheduledqueryrules_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_scheduledqueryrules_client.go index 7326f3310a07..078e18fd9001 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_scheduledqueryrules_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_scheduledqueryrules_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ScheduledQueryRulesClient contains the methods for the ScheduledQueryRules group. @@ -30,8 +31,15 @@ type ScheduledQueryRulesClient struct { } // NewScheduledQueryRulesClient creates a new instance of ScheduledQueryRulesClient with the specified values. -func NewScheduledQueryRulesClient(con *arm.Connection, subscriptionID string) *ScheduledQueryRulesClient { - return &ScheduledQueryRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewScheduledQueryRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ScheduledQueryRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ScheduledQueryRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates an log search rule. @@ -81,7 +89,7 @@ func (client *ScheduledQueryRulesClient) createOrUpdateCreateRequest(ctx context func (client *ScheduledQueryRulesClient) createOrUpdateHandleResponse(resp *http.Response) (ScheduledQueryRulesCreateOrUpdateResponse, error) { result := ScheduledQueryRulesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LogSearchRuleResource); err != nil { - return ScheduledQueryRulesCreateOrUpdateResponse{}, err + return ScheduledQueryRulesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -202,7 +210,7 @@ func (client *ScheduledQueryRulesClient) getCreateRequest(ctx context.Context, r func (client *ScheduledQueryRulesClient) getHandleResponse(resp *http.Response) (ScheduledQueryRulesGetResponse, error) { result := ScheduledQueryRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LogSearchRuleResource); err != nil { - return ScheduledQueryRulesGetResponse{}, err + return ScheduledQueryRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -266,7 +274,7 @@ func (client *ScheduledQueryRulesClient) listByResourceGroupCreateRequest(ctx co func (client *ScheduledQueryRulesClient) listByResourceGroupHandleResponse(resp *http.Response) (ScheduledQueryRulesListByResourceGroupResponse, error) { result := ScheduledQueryRulesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LogSearchRuleResourceCollection); err != nil { - return ScheduledQueryRulesListByResourceGroupResponse{}, err + return ScheduledQueryRulesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -326,7 +334,7 @@ func (client *ScheduledQueryRulesClient) listBySubscriptionCreateRequest(ctx con func (client *ScheduledQueryRulesClient) listBySubscriptionHandleResponse(resp *http.Response) (ScheduledQueryRulesListBySubscriptionResponse, error) { result := ScheduledQueryRulesListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LogSearchRuleResourceCollection); err != nil { - return ScheduledQueryRulesListBySubscriptionResponse{}, err + return ScheduledQueryRulesListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -391,7 +399,7 @@ func (client *ScheduledQueryRulesClient) updateCreateRequest(ctx context.Context func (client *ScheduledQueryRulesClient) updateHandleResponse(resp *http.Response) (ScheduledQueryRulesUpdateResponse, error) { result := ScheduledQueryRulesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LogSearchRuleResource); err != nil { - return ScheduledQueryRulesUpdateResponse{}, err + return ScheduledQueryRulesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_tenantactivitylogs_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_tenantactivitylogs_client.go index 685b158fda1b..ff27ddce73ff 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_tenantactivitylogs_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_tenantactivitylogs_client.go @@ -11,11 +11,12 @@ package armmonitor import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // TenantActivityLogsClient contains the methods for the TenantActivityLogs group. @@ -26,8 +27,15 @@ type TenantActivityLogsClient struct { } // NewTenantActivityLogsClient creates a new instance of TenantActivityLogsClient with the specified values. -func NewTenantActivityLogsClient(con *arm.Connection) *TenantActivityLogsClient { - return &TenantActivityLogsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewTenantActivityLogsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *TenantActivityLogsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TenantActivityLogsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets the Activity Logs for the Tenant. Everything that is applicable to the API to get the Activity Logs for the subscription is applicable to @@ -71,7 +79,7 @@ func (client *TenantActivityLogsClient) listCreateRequest(ctx context.Context, o func (client *TenantActivityLogsClient) listHandleResponse(resp *http.Response) (TenantActivityLogsListResponse, error) { result := TenantActivityLogsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EventDataCollection); err != nil { - return TenantActivityLogsListResponse{}, err + return TenantActivityLogsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_time_rfc3339.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_time_rfc3339.go index d2584d1c6407..0744011eba7e 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armmonitor import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/monitor/armmonitor/zz_generated_vminsights_client.go b/sdk/resourcemanager/monitor/armmonitor/zz_generated_vminsights_client.go index 868e7ed917b9..2bf44451a62d 100644 --- a/sdk/resourcemanager/monitor/armmonitor/zz_generated_vminsights_client.go +++ b/sdk/resourcemanager/monitor/armmonitor/zz_generated_vminsights_client.go @@ -10,14 +10,14 @@ package armmonitor import ( "context" - "errors" "fmt" - "net/http" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" ) // VMInsightsClient contains the methods for the VMInsights group. @@ -28,8 +28,15 @@ type VMInsightsClient struct { } // NewVMInsightsClient creates a new instance of VMInsightsClient with the specified values. -func NewVMInsightsClient(con *arm.Connection) *VMInsightsClient { - return &VMInsightsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewVMInsightsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *VMInsightsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VMInsightsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetOnboardingStatus - Retrieves the VM Insights onboarding status for the specified resource or resource scope. @@ -52,9 +59,6 @@ func (client *VMInsightsClient) GetOnboardingStatus(ctx context.Context, resourc // getOnboardingStatusCreateRequest creates the GetOnboardingStatus request. func (client *VMInsightsClient) getOnboardingStatusCreateRequest(ctx context.Context, resourceURI string, options *VMInsightsGetOnboardingStatusOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.Insights/vmInsightsOnboardingStatuses/default" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -71,7 +75,7 @@ func (client *VMInsightsClient) getOnboardingStatusCreateRequest(ctx context.Con func (client *VMInsightsClient) getOnboardingStatusHandleResponse(resp *http.Response) (VMInsightsGetOnboardingStatusResponse, error) { result := VMInsightsGetOnboardingStatusResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VMInsightsOnboardingStatus); err != nil { - return VMInsightsGetOnboardingStatusResponse{}, err + return VMInsightsGetOnboardingStatusResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/msi/armmsi/CHANGELOG.md b/sdk/resourcemanager/msi/armmsi/CHANGELOG.md index 34f86d5bb408..bd4524485ca1 100644 --- a/sdk/resourcemanager/msi/armmsi/CHANGELOG.md +++ b/sdk/resourcemanager/msi/armmsi/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-15) diff --git a/sdk/resourcemanager/msi/armmsi/README.md b/sdk/resourcemanager/msi/armmsi/README.md index a87bacc1b239..8fd9cea749c2 100644 --- a/sdk/resourcemanager/msi/armmsi/README.md +++ b/sdk/resourcemanager/msi/armmsi/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Managed Service Identity +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Managed Service Identity modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armmsi.NewUserAssignedIdentitiesClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Managed Service Identity modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armmsi.NewUserAssignedIdentitiesClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armmsi.NewUserAssignedIdentitiesClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/msi/armmsi/autorest.md b/sdk/resourcemanager/msi/armmsi/autorest.md index cb6cf8bddced..e3d51b49e009 100644 --- a/sdk/resourcemanager/msi/armmsi/autorest.md +++ b/sdk/resourcemanager/msi/armmsi/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/3eaa729b3686f20817145e771a8ab707c739dbbd/specification/msi/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/3eaa729b3686f20817145e771a8ab707c739dbbd/specification/msi/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/msi/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/msi/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.1 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/msi/armmsi/go.mod b/sdk/resourcemanager/msi/armmsi/go.mod index 9df1f7c9b529..4964ce1ed9ca 100644 --- a/sdk/resourcemanager/msi/armmsi/go.mod +++ b/sdk/resourcemanager/msi/armmsi/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/msi/armmsi go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.1.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/msi/armmsi/go.sum b/sdk/resourcemanager/msi/armmsi/go.sum index f37ba2aef08b..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/msi/armmsi/go.sum +++ b/sdk/resourcemanager/msi/armmsi/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible h1:WFsr3Efy7uweykOAEfOHO3ACtuwIv+rrFmSn9K48VnA= -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/msi/armmsi/zz_generated_constants.go b/sdk/resourcemanager/msi/armmsi/zz_generated_constants.go index d84cd1ebb52f..8f86186b7290 100644 --- a/sdk/resourcemanager/msi/armmsi/zz_generated_constants.go +++ b/sdk/resourcemanager/msi/armmsi/zz_generated_constants.go @@ -10,5 +10,5 @@ package armmsi const ( module = "armmsi" - version = "v0.1.1" + version = "v0.2.0" ) diff --git a/sdk/resourcemanager/msi/armmsi/zz_generated_models.go b/sdk/resourcemanager/msi/armmsi/zz_generated_models.go index 1cf6da0fd57c..10338870facd 100644 --- a/sdk/resourcemanager/msi/armmsi/zz_generated_models.go +++ b/sdk/resourcemanager/msi/armmsi/zz_generated_models.go @@ -10,9 +10,8 @@ package armmsi import ( "encoding/json" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" ) // CloudError - An error response from the ManagedServiceIdentity service. diff --git a/sdk/resourcemanager/msi/armmsi/zz_generated_operations_client.go b/sdk/resourcemanager/msi/armmsi/zz_generated_operations_client.go index 8b64df76ea18..877ba1acdc53 100644 --- a/sdk/resourcemanager/msi/armmsi/zz_generated_operations_client.go +++ b/sdk/resourcemanager/msi/armmsi/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armmsi import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists available operations for the Microsoft.ManagedIdentity provider @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/msi/armmsi/zz_generated_pagers.go b/sdk/resourcemanager/msi/armmsi/zz_generated_pagers.go index 9fbdb8914560..6e9ab79b11ce 100644 --- a/sdk/resourcemanager/msi/armmsi/zz_generated_pagers.go +++ b/sdk/resourcemanager/msi/armmsi/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armmsi import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // OperationsListPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/msi/armmsi/zz_generated_systemassignedidentities_client.go b/sdk/resourcemanager/msi/armmsi/zz_generated_systemassignedidentities_client.go index 6c39063acbd4..ed57d3c0684f 100644 --- a/sdk/resourcemanager/msi/armmsi/zz_generated_systemassignedidentities_client.go +++ b/sdk/resourcemanager/msi/armmsi/zz_generated_systemassignedidentities_client.go @@ -10,14 +10,14 @@ package armmsi import ( "context" - "errors" "fmt" - "net/http" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" ) // SystemAssignedIdentitiesClient contains the methods for the SystemAssignedIdentities group. @@ -28,8 +28,15 @@ type SystemAssignedIdentitiesClient struct { } // NewSystemAssignedIdentitiesClient creates a new instance of SystemAssignedIdentitiesClient with the specified values. -func NewSystemAssignedIdentitiesClient(con *arm.Connection) *SystemAssignedIdentitiesClient { - return &SystemAssignedIdentitiesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewSystemAssignedIdentitiesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *SystemAssignedIdentitiesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SystemAssignedIdentitiesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetByScope - Gets the systemAssignedIdentity available under the specified RP scope. @@ -52,9 +59,6 @@ func (client *SystemAssignedIdentitiesClient) GetByScope(ctx context.Context, sc // getByScopeCreateRequest creates the GetByScope request. func (client *SystemAssignedIdentitiesClient) getByScopeCreateRequest(ctx context.Context, scope string, options *SystemAssignedIdentitiesGetByScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.ManagedIdentity/identities/default" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -71,7 +75,7 @@ func (client *SystemAssignedIdentitiesClient) getByScopeCreateRequest(ctx contex func (client *SystemAssignedIdentitiesClient) getByScopeHandleResponse(resp *http.Response) (SystemAssignedIdentitiesGetByScopeResponse, error) { result := SystemAssignedIdentitiesGetByScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SystemAssignedIdentity); err != nil { - return SystemAssignedIdentitiesGetByScopeResponse{}, err + return SystemAssignedIdentitiesGetByScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/msi/armmsi/zz_generated_userassignedidentities_client.go b/sdk/resourcemanager/msi/armmsi/zz_generated_userassignedidentities_client.go index ea20a553cd63..a8af88374121 100644 --- a/sdk/resourcemanager/msi/armmsi/zz_generated_userassignedidentities_client.go +++ b/sdk/resourcemanager/msi/armmsi/zz_generated_userassignedidentities_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // UserAssignedIdentitiesClient contains the methods for the UserAssignedIdentities group. @@ -30,8 +31,15 @@ type UserAssignedIdentitiesClient struct { } // NewUserAssignedIdentitiesClient creates a new instance of UserAssignedIdentitiesClient with the specified values. -func NewUserAssignedIdentitiesClient(con *arm.Connection, subscriptionID string) *UserAssignedIdentitiesClient { - return &UserAssignedIdentitiesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewUserAssignedIdentitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UserAssignedIdentitiesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &UserAssignedIdentitiesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update an identity in the specified subscription and resource group. @@ -81,7 +89,7 @@ func (client *UserAssignedIdentitiesClient) createOrUpdateCreateRequest(ctx cont func (client *UserAssignedIdentitiesClient) createOrUpdateHandleResponse(resp *http.Response) (UserAssignedIdentitiesCreateOrUpdateResponse, error) { result := UserAssignedIdentitiesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Identity); err != nil { - return UserAssignedIdentitiesCreateOrUpdateResponse{}, err + return UserAssignedIdentitiesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -202,7 +210,7 @@ func (client *UserAssignedIdentitiesClient) getCreateRequest(ctx context.Context func (client *UserAssignedIdentitiesClient) getHandleResponse(resp *http.Response) (UserAssignedIdentitiesGetResponse, error) { result := UserAssignedIdentitiesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Identity); err != nil { - return UserAssignedIdentitiesGetResponse{}, err + return UserAssignedIdentitiesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -260,7 +268,7 @@ func (client *UserAssignedIdentitiesClient) listByResourceGroupCreateRequest(ctx func (client *UserAssignedIdentitiesClient) listByResourceGroupHandleResponse(resp *http.Response) (UserAssignedIdentitiesListByResourceGroupResponse, error) { result := UserAssignedIdentitiesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UserAssignedIdentitiesListResult); err != nil { - return UserAssignedIdentitiesListByResourceGroupResponse{}, err + return UserAssignedIdentitiesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -314,7 +322,7 @@ func (client *UserAssignedIdentitiesClient) listBySubscriptionCreateRequest(ctx func (client *UserAssignedIdentitiesClient) listBySubscriptionHandleResponse(resp *http.Response) (UserAssignedIdentitiesListBySubscriptionResponse, error) { result := UserAssignedIdentitiesListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UserAssignedIdentitiesListResult); err != nil { - return UserAssignedIdentitiesListBySubscriptionResponse{}, err + return UserAssignedIdentitiesListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -379,7 +387,7 @@ func (client *UserAssignedIdentitiesClient) updateCreateRequest(ctx context.Cont func (client *UserAssignedIdentitiesClient) updateHandleResponse(resp *http.Response) (UserAssignedIdentitiesUpdateResponse, error) { result := UserAssignedIdentitiesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Identity); err != nil { - return UserAssignedIdentitiesUpdateResponse{}, err + return UserAssignedIdentitiesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/CHANGELOG.md b/sdk/resourcemanager/mysql/armmysql/CHANGELOG.md index 2276a757fdd8..626bf7231e27 100644 --- a/sdk/resourcemanager/mysql/armmysql/CHANGELOG.md +++ b/sdk/resourcemanager/mysql/armmysql/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-20) diff --git a/sdk/resourcemanager/mysql/armmysql/README.md b/sdk/resourcemanager/mysql/armmysql/README.md index 30b950e3fa58..71f539b68f27 100644 --- a/sdk/resourcemanager/mysql/armmysql/README.md +++ b/sdk/resourcemanager/mysql/armmysql/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Database for MySQL +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Database for MySQL modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armmysql.NewMySQLManagementClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Database for MySQL modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armmysql.NewMySQLManagementClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armmysql.NewMySQLManagementClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/mysql/armmysql/autorest.md b/sdk/resourcemanager/mysql/armmysql/autorest.md index 15cc2fea44f4..120d59899f58 100644 --- a/sdk/resourcemanager/mysql/armmysql/autorest.md +++ b/sdk/resourcemanager/mysql/armmysql/autorest.md @@ -5,10 +5,10 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/6ba37b7279bbd0d69042743246780cc3af9257b9/specification/mysql/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/6ba37b7279bbd0d69042743246780cc3af9257b9/specification/mysql/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/mysql/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/mysql/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 package-singleservers: true directive: - from: Servers.json diff --git a/sdk/resourcemanager/mysql/armmysql/go.mod b/sdk/resourcemanager/mysql/armmysql/go.mod index 58f29f9799ca..916281be349b 100644 --- a/sdk/resourcemanager/mysql/armmysql/go.mod +++ b/sdk/resourcemanager/mysql/armmysql/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysql go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.2.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/mysql/armmysql/go.sum b/sdk/resourcemanager/mysql/armmysql/go.sum index c8ff7a2143ad..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/mysql/armmysql/go.sum +++ b/sdk/resourcemanager/mysql/armmysql/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible h1:iCb2tuoEm3N7ZpUDOvu1Yxl1B3iOVDmaD6weaRuIPzs= -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_advisors_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_advisors_client.go index 9ca80e154abb..5405c9420276 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_advisors_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_advisors_client.go @@ -11,13 +11,14 @@ package armmysql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AdvisorsClient contains the methods for the Advisors group. @@ -29,8 +30,15 @@ type AdvisorsClient struct { } // NewAdvisorsClient creates a new instance of AdvisorsClient with the specified values. -func NewAdvisorsClient(con *arm.Connection, subscriptionID string) *AdvisorsClient { - return &AdvisorsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAdvisorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AdvisorsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AdvisorsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get a recommendation action advisor. @@ -84,7 +92,7 @@ func (client *AdvisorsClient) getCreateRequest(ctx context.Context, resourceGrou func (client *AdvisorsClient) getHandleResponse(resp *http.Response) (AdvisorsGetResponse, error) { result := AdvisorsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Advisor); err != nil { - return AdvisorsGetResponse{}, err + return AdvisorsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -145,7 +153,7 @@ func (client *AdvisorsClient) listByServerCreateRequest(ctx context.Context, res func (client *AdvisorsClient) listByServerHandleResponse(resp *http.Response) (AdvisorsListByServerResponse, error) { result := AdvisorsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AdvisorsResultList); err != nil { - return AdvisorsListByServerResponse{}, err + return AdvisorsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_checknameavailability_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_checknameavailability_client.go index 9afa47798e26..065cef0879a6 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_checknameavailability_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_checknameavailability_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CheckNameAvailabilityClient contains the methods for the CheckNameAvailability group. @@ -30,8 +31,15 @@ type CheckNameAvailabilityClient struct { } // NewCheckNameAvailabilityClient creates a new instance of CheckNameAvailabilityClient with the specified values. -func NewCheckNameAvailabilityClient(con *arm.Connection, subscriptionID string) *CheckNameAvailabilityClient { - return &CheckNameAvailabilityClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCheckNameAvailabilityClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CheckNameAvailabilityClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CheckNameAvailabilityClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Execute - Check the availability of name for resource @@ -73,7 +81,7 @@ func (client *CheckNameAvailabilityClient) executeCreateRequest(ctx context.Cont func (client *CheckNameAvailabilityClient) executeHandleResponse(resp *http.Response) (CheckNameAvailabilityExecuteResponse, error) { result := CheckNameAvailabilityExecuteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NameAvailability); err != nil { - return CheckNameAvailabilityExecuteResponse{}, err + return CheckNameAvailabilityExecuteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_configurations_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_configurations_client.go index 8ae091e89e00..29bc8367145a 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_configurations_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_configurations_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ConfigurationsClient contains the methods for the Configurations group. @@ -31,8 +31,15 @@ type ConfigurationsClient struct { } // NewConfigurationsClient creates a new instance of ConfigurationsClient with the specified values. -func NewConfigurationsClient(con *arm.Connection, subscriptionID string) *ConfigurationsClient { - return &ConfigurationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ConfigurationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ConfigurationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Updates a configuration of a server. @@ -166,7 +173,7 @@ func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resour func (client *ConfigurationsClient) getHandleResponse(resp *http.Response) (ConfigurationsGetResponse, error) { result := ConfigurationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Configuration); err != nil { - return ConfigurationsGetResponse{}, err + return ConfigurationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -231,7 +238,7 @@ func (client *ConfigurationsClient) listByServerCreateRequest(ctx context.Contex func (client *ConfigurationsClient) listByServerHandleResponse(resp *http.Response) (ConfigurationsListByServerResponse, error) { result := ConfigurationsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationListResult); err != nil { - return ConfigurationsListByServerResponse{}, err + return ConfigurationsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_constants.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_constants.go index 17b00d51379a..e84fcc37853a 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_constants.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_constants.go @@ -10,7 +10,7 @@ package armmysql const ( module = "armmysql" - version = "v0.1.1" + version = "v0.2.0" ) // CreateMode - The mode to create a new server. diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_databases_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_databases_client.go index 04ef772fe74a..191eb8652a55 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_databases_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_databases_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabasesClient contains the methods for the Databases group. @@ -31,8 +31,15 @@ type DatabasesClient struct { } // NewDatabasesClient creates a new instance of DatabasesClient with the specified values. -func NewDatabasesClient(con *arm.Connection, subscriptionID string) *DatabasesClient { - return &DatabasesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabasesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabasesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a new database or updates an existing database. @@ -246,7 +253,7 @@ func (client *DatabasesClient) getCreateRequest(ctx context.Context, resourceGro func (client *DatabasesClient) getHandleResponse(resp *http.Response) (DatabasesGetResponse, error) { result := DatabasesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Database); err != nil { - return DatabasesGetResponse{}, err + return DatabasesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -311,7 +318,7 @@ func (client *DatabasesClient) listByServerCreateRequest(ctx context.Context, re func (client *DatabasesClient) listByServerHandleResponse(resp *http.Response) (DatabasesListByServerResponse, error) { result := DatabasesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseListResult); err != nil { - return DatabasesListByServerResponse{}, err + return DatabasesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_firewallrules_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_firewallrules_client.go index 7416053f476a..2d9f00c936a1 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_firewallrules_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_firewallrules_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // FirewallRulesClient contains the methods for the FirewallRules group. @@ -31,8 +31,15 @@ type FirewallRulesClient struct { } // NewFirewallRulesClient creates a new instance of FirewallRulesClient with the specified values. -func NewFirewallRulesClient(con *arm.Connection, subscriptionID string) *FirewallRulesClient { - return &FirewallRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FirewallRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FirewallRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a new firewall rule or updates an existing firewall rule. @@ -246,7 +253,7 @@ func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourc func (client *FirewallRulesClient) getHandleResponse(resp *http.Response) (FirewallRulesGetResponse, error) { result := FirewallRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRule); err != nil { - return FirewallRulesGetResponse{}, err + return FirewallRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -311,7 +318,7 @@ func (client *FirewallRulesClient) listByServerCreateRequest(ctx context.Context func (client *FirewallRulesClient) listByServerHandleResponse(resp *http.Response) (FirewallRulesListByServerResponse, error) { result := FirewallRulesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRuleListResult); err != nil { - return FirewallRulesListByServerResponse{}, err + return FirewallRulesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_locationbasedperformancetier_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_locationbasedperformancetier_client.go index 6f898a4dee8d..e1f22cd4d00a 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_locationbasedperformancetier_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_locationbasedperformancetier_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LocationBasedPerformanceTierClient contains the methods for the LocationBasedPerformanceTier group. @@ -30,8 +31,15 @@ type LocationBasedPerformanceTierClient struct { } // NewLocationBasedPerformanceTierClient creates a new instance of LocationBasedPerformanceTierClient with the specified values. -func NewLocationBasedPerformanceTierClient(con *arm.Connection, subscriptionID string) *LocationBasedPerformanceTierClient { - return &LocationBasedPerformanceTierClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLocationBasedPerformanceTierClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LocationBasedPerformanceTierClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LocationBasedPerformanceTierClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - List all the performance tiers at specified location in a given subscription. @@ -77,7 +85,7 @@ func (client *LocationBasedPerformanceTierClient) listCreateRequest(ctx context. func (client *LocationBasedPerformanceTierClient) listHandleResponse(resp *http.Response) (LocationBasedPerformanceTierListResponse, error) { result := LocationBasedPerformanceTierListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PerformanceTierListResult); err != nil { - return LocationBasedPerformanceTierListResponse{}, err + return LocationBasedPerformanceTierListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_locationbasedrecommendedactionsessionsoperationstatus_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_locationbasedrecommendedactionsessionsoperationstatus_client.go index 722947fcb098..f0bbd3944d56 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_locationbasedrecommendedactionsessionsoperationstatus_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_locationbasedrecommendedactionsessionsoperationstatus_client.go @@ -11,13 +11,14 @@ package armmysql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LocationBasedRecommendedActionSessionsOperationStatusClient contains the methods for the LocationBasedRecommendedActionSessionsOperationStatus group. @@ -29,8 +30,15 @@ type LocationBasedRecommendedActionSessionsOperationStatusClient struct { } // NewLocationBasedRecommendedActionSessionsOperationStatusClient creates a new instance of LocationBasedRecommendedActionSessionsOperationStatusClient with the specified values. -func NewLocationBasedRecommendedActionSessionsOperationStatusClient(con *arm.Connection, subscriptionID string) *LocationBasedRecommendedActionSessionsOperationStatusClient { - return &LocationBasedRecommendedActionSessionsOperationStatusClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLocationBasedRecommendedActionSessionsOperationStatusClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LocationBasedRecommendedActionSessionsOperationStatusClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LocationBasedRecommendedActionSessionsOperationStatusClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Recommendation action session operation status. @@ -80,7 +88,7 @@ func (client *LocationBasedRecommendedActionSessionsOperationStatusClient) getCr func (client *LocationBasedRecommendedActionSessionsOperationStatusClient) getHandleResponse(resp *http.Response) (LocationBasedRecommendedActionSessionsOperationStatusGetResponse, error) { result := LocationBasedRecommendedActionSessionsOperationStatusGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecommendedActionSessionsOperationStatus); err != nil { - return LocationBasedRecommendedActionSessionsOperationStatusGetResponse{}, err + return LocationBasedRecommendedActionSessionsOperationStatusGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_locationbasedrecommendedactionsessionsresult_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_locationbasedrecommendedactionsessionsresult_client.go index 66d1f63e905e..9fca9ed64672 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_locationbasedrecommendedactionsessionsresult_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_locationbasedrecommendedactionsessionsresult_client.go @@ -11,13 +11,14 @@ package armmysql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LocationBasedRecommendedActionSessionsResultClient contains the methods for the LocationBasedRecommendedActionSessionsResult group. @@ -29,8 +30,15 @@ type LocationBasedRecommendedActionSessionsResultClient struct { } // NewLocationBasedRecommendedActionSessionsResultClient creates a new instance of LocationBasedRecommendedActionSessionsResultClient with the specified values. -func NewLocationBasedRecommendedActionSessionsResultClient(con *arm.Connection, subscriptionID string) *LocationBasedRecommendedActionSessionsResultClient { - return &LocationBasedRecommendedActionSessionsResultClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLocationBasedRecommendedActionSessionsResultClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LocationBasedRecommendedActionSessionsResultClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LocationBasedRecommendedActionSessionsResultClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Recommendation action session operation result. @@ -77,7 +85,7 @@ func (client *LocationBasedRecommendedActionSessionsResultClient) listCreateRequ func (client *LocationBasedRecommendedActionSessionsResultClient) listHandleResponse(resp *http.Response) (LocationBasedRecommendedActionSessionsResultListResponse, error) { result := LocationBasedRecommendedActionSessionsResultListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecommendationActionsResultList); err != nil { - return LocationBasedRecommendedActionSessionsResultListResponse{}, err + return LocationBasedRecommendedActionSessionsResultListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_logfiles_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_logfiles_client.go index ecb69fde1610..161dca30b1a6 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_logfiles_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_logfiles_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LogFilesClient contains the methods for the LogFiles group. @@ -30,8 +31,15 @@ type LogFilesClient struct { } // NewLogFilesClient creates a new instance of LogFilesClient with the specified values. -func NewLogFilesClient(con *arm.Connection, subscriptionID string) *LogFilesClient { - return &LogFilesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLogFilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LogFilesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LogFilesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByServer - List all the log files in a given server. @@ -81,7 +89,7 @@ func (client *LogFilesClient) listByServerCreateRequest(ctx context.Context, res func (client *LogFilesClient) listByServerHandleResponse(resp *http.Response) (LogFilesListByServerResponse, error) { result := LogFilesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LogFileListResult); err != nil { - return LogFilesListByServerResponse{}, err + return LogFilesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_models.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_models.go index f76525e18677..3a433e6ea774 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_models.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_models.go @@ -10,10 +10,9 @@ package armmysql import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // Advisor - Represents a recommendation action advisor. @@ -360,8 +359,8 @@ type LogFileProperties struct { // MarshalJSON implements the json.Marshaller interface for type LogFileProperties. func (l LogFileProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdTime", (*timeRFC3339)(l.CreatedTime)) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(l.LastModifiedTime)) + populateTimeRFC3339(objectMap, "createdTime", l.CreatedTime) + populateTimeRFC3339(objectMap, "lastModifiedTime", l.LastModifiedTime) populate(objectMap, "sizeInKB", l.SizeInKB) populate(objectMap, "type", l.Type) populate(objectMap, "url", l.URL) @@ -378,14 +377,10 @@ func (l *LogFileProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "createdTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.CreatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.CreatedTime) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.LastModifiedTime) delete(rawMsg, key) case "sizeInKB": err = unpopulate(val, &l.SizeInKB) @@ -796,14 +791,14 @@ func (q QueryStatisticProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "aggregationFunction", q.AggregationFunction) populate(objectMap, "databaseNames", q.DatabaseNames) - populate(objectMap, "endTime", (*timeRFC3339)(q.EndTime)) + populateTimeRFC3339(objectMap, "endTime", q.EndTime) populate(objectMap, "metricDisplayName", q.MetricDisplayName) populate(objectMap, "metricName", q.MetricName) populate(objectMap, "metricValue", q.MetricValue) populate(objectMap, "metricValueUnit", q.MetricValueUnit) populate(objectMap, "queryExecutionCount", q.QueryExecutionCount) populate(objectMap, "queryId", q.QueryID) - populate(objectMap, "startTime", (*timeRFC3339)(q.StartTime)) + populateTimeRFC3339(objectMap, "startTime", q.StartTime) return json.Marshal(objectMap) } @@ -823,9 +818,7 @@ func (q *QueryStatisticProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &q.DatabaseNames) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - q.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &q.EndTime) delete(rawMsg, key) case "metricDisplayName": err = unpopulate(val, &q.MetricDisplayName) @@ -846,9 +839,7 @@ func (q *QueryStatisticProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &q.QueryID) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - q.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &q.StartTime) delete(rawMsg, key) } if err != nil { @@ -956,9 +947,9 @@ func (r RecommendationActionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "actionId", r.ActionID) populate(objectMap, "advisorName", r.AdvisorName) - populate(objectMap, "createdTime", (*timeRFC3339)(r.CreatedTime)) + populateTimeRFC3339(objectMap, "createdTime", r.CreatedTime) populate(objectMap, "details", r.Details) - populate(objectMap, "expirationTime", (*timeRFC3339)(r.ExpirationTime)) + populateTimeRFC3339(objectMap, "expirationTime", r.ExpirationTime) populate(objectMap, "reason", r.Reason) populate(objectMap, "recommendationType", r.RecommendationType) populate(objectMap, "sessionId", r.SessionID) @@ -981,17 +972,13 @@ func (r *RecommendationActionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.AdvisorName) delete(rawMsg, key) case "createdTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.CreatedTime) delete(rawMsg, key) case "details": err = unpopulate(val, &r.Details) delete(rawMsg, key) case "expirationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.ExpirationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.ExpirationTime) delete(rawMsg, key) case "reason": err = unpopulate(val, &r.Reason) @@ -1043,7 +1030,7 @@ type RecommendedActionSessionsOperationStatus struct { func (r RecommendedActionSessionsOperationStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "name", r.Name) - populate(objectMap, "startTime", (*timeRFC3339)(r.StartTime)) + populateTimeRFC3339(objectMap, "startTime", r.StartTime) populate(objectMap, "status", r.Status) return json.Marshal(objectMap) } @@ -1061,9 +1048,7 @@ func (r *RecommendedActionSessionsOperationStatus) UnmarshalJSON(data []byte) er err = unpopulate(val, &r.Name) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &r.Status) @@ -1428,7 +1413,7 @@ type ServerKeyProperties struct { // MarshalJSON implements the json.Marshaller interface for type ServerKeyProperties. func (s ServerKeyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationDate", (*timeRFC3339)(s.CreationDate)) + populateTimeRFC3339(objectMap, "creationDate", s.CreationDate) populate(objectMap, "serverKeyType", s.ServerKeyType) populate(objectMap, "uri", s.URI) return json.Marshal(objectMap) @@ -1444,9 +1429,7 @@ func (s *ServerKeyProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreationDate) delete(rawMsg, key) case "serverKeyType": err = unpopulate(val, &s.ServerKeyType) @@ -1585,7 +1568,7 @@ func (s ServerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "administratorLogin", s.AdministratorLogin) populate(objectMap, "byokEnforcement", s.ByokEnforcement) - populate(objectMap, "earliestRestoreDate", (*timeRFC3339)(s.EarliestRestoreDate)) + populateTimeRFC3339(objectMap, "earliestRestoreDate", s.EarliestRestoreDate) populate(objectMap, "fullyQualifiedDomainName", s.FullyQualifiedDomainName) populate(objectMap, "infrastructureEncryption", s.InfrastructureEncryption) populate(objectMap, "masterServerId", s.MasterServerID) @@ -1617,9 +1600,7 @@ func (s *ServerProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.ByokEnforcement) delete(rawMsg, key) case "earliestRestoreDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.EarliestRestoreDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.EarliestRestoreDate) delete(rawMsg, key) case "fullyQualifiedDomainName": err = unpopulate(val, &s.FullyQualifiedDomainName) @@ -1893,7 +1874,7 @@ type ServerPropertiesForRestore struct { func (s ServerPropertiesForRestore) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) s.ServerPropertiesForCreate.marshalInternal(objectMap, CreateModePointInTimeRestore) - populate(objectMap, "restorePointInTime", (*timeRFC3339)(s.RestorePointInTime)) + populateTimeRFC3339(objectMap, "restorePointInTime", s.RestorePointInTime) populate(objectMap, "sourceServerId", s.SourceServerID) return json.Marshal(objectMap) } @@ -1908,9 +1889,7 @@ func (s *ServerPropertiesForRestore) UnmarshalJSON(data []byte) error { var err error switch key { case "restorePointInTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.RestorePointInTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.RestorePointInTime) delete(rawMsg, key) case "sourceServerId": err = unpopulate(val, &s.SourceServerID) @@ -2149,8 +2128,8 @@ func (t TopQueryStatisticsInputProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "aggregationFunction", t.AggregationFunction) populate(objectMap, "aggregationWindow", t.AggregationWindow) populate(objectMap, "numberOfTopQueries", t.NumberOfTopQueries) - populate(objectMap, "observationEndTime", (*timeRFC3339)(t.ObservationEndTime)) - populate(objectMap, "observationStartTime", (*timeRFC3339)(t.ObservationStartTime)) + populateTimeRFC3339(objectMap, "observationEndTime", t.ObservationEndTime) + populateTimeRFC3339(objectMap, "observationStartTime", t.ObservationStartTime) populate(objectMap, "observedMetric", t.ObservedMetric) return json.Marshal(objectMap) } @@ -2174,14 +2153,10 @@ func (t *TopQueryStatisticsInputProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &t.NumberOfTopQueries) delete(rawMsg, key) case "observationEndTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.ObservationEndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.ObservationEndTime) delete(rawMsg, key) case "observationStartTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.ObservationStartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.ObservationStartTime) delete(rawMsg, key) case "observedMetric": err = unpopulate(val, &t.ObservedMetric) @@ -2353,11 +2328,11 @@ func (w WaitStatisticProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "count", w.Count) populate(objectMap, "databaseName", w.DatabaseName) - populate(objectMap, "endTime", (*timeRFC3339)(w.EndTime)) + populateTimeRFC3339(objectMap, "endTime", w.EndTime) populate(objectMap, "eventName", w.EventName) populate(objectMap, "eventTypeName", w.EventTypeName) populate(objectMap, "queryId", w.QueryID) - populate(objectMap, "startTime", (*timeRFC3339)(w.StartTime)) + populateTimeRFC3339(objectMap, "startTime", w.StartTime) populate(objectMap, "totalTimeInMs", w.TotalTimeInMs) populate(objectMap, "userId", w.UserID) return json.Marshal(objectMap) @@ -2379,9 +2354,7 @@ func (w *WaitStatisticProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.DatabaseName) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.EndTime) delete(rawMsg, key) case "eventName": err = unpopulate(val, &w.EventName) @@ -2393,9 +2366,7 @@ func (w *WaitStatisticProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.QueryID) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.StartTime) delete(rawMsg, key) case "totalTimeInMs": err = unpopulate(val, &w.TotalTimeInMs) @@ -2438,8 +2409,8 @@ type WaitStatisticsInputProperties struct { func (w WaitStatisticsInputProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "aggregationWindow", w.AggregationWindow) - populate(objectMap, "observationEndTime", (*timeRFC3339)(w.ObservationEndTime)) - populate(objectMap, "observationStartTime", (*timeRFC3339)(w.ObservationStartTime)) + populateTimeRFC3339(objectMap, "observationEndTime", w.ObservationEndTime) + populateTimeRFC3339(objectMap, "observationStartTime", w.ObservationStartTime) return json.Marshal(objectMap) } @@ -2456,14 +2427,10 @@ func (w *WaitStatisticsInputProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.AggregationWindow) delete(rawMsg, key) case "observationEndTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.ObservationEndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.ObservationEndTime) delete(rawMsg, key) case "observationStartTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.ObservationStartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.ObservationStartTime) delete(rawMsg, key) } if err != nil { diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_mysqlmanagementclient_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_mysqlmanagementclient_client.go index f7a49a345eec..e88b98553ee8 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_mysqlmanagementclient_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_mysqlmanagementclient_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // MySQLManagementClient contains the methods for the MySQLManagementClient group. @@ -31,8 +31,15 @@ type MySQLManagementClient struct { } // NewMySQLManagementClient creates a new instance of MySQLManagementClient with the specified values. -func NewMySQLManagementClient(con *arm.Connection, subscriptionID string) *MySQLManagementClient { - return &MySQLManagementClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewMySQLManagementClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *MySQLManagementClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MySQLManagementClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateRecommendedActionSession - Create recommendation action session for the advisor. @@ -161,7 +168,7 @@ func (client *MySQLManagementClient) resetQueryPerformanceInsightDataCreateReque func (client *MySQLManagementClient) resetQueryPerformanceInsightDataHandleResponse(resp *http.Response) (MySQLManagementClientResetQueryPerformanceInsightDataResponse, error) { result := MySQLManagementClientResetQueryPerformanceInsightDataResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.QueryPerformanceInsightResetDataResult); err != nil { - return MySQLManagementClientResetQueryPerformanceInsightDataResponse{}, err + return MySQLManagementClientResetQueryPerformanceInsightDataResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_operations_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_operations_client.go index 2e5eedc82073..85d5ba5e3396 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_operations_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armmysql import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available REST API operations. @@ -65,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_pagers.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_pagers.go index 20b324423cf8..b944b7012d2e 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_pagers.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armmysql import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // AdvisorsListByServerPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_pollers.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_pollers.go index a032d9fed5fc..21c9ad9d03f0 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_pollers.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armmysql import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // ConfigurationsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_polymorphic_helpers.go index 462d57c5bc58..7029bb463012 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_polymorphic_helpers.go @@ -52,3 +52,22 @@ func unmarshalServerPropertiesForCreateClassificationArray(rawMsg json.RawMessag } return fArray, nil } + +func unmarshalServerPropertiesForCreateClassificationMap(rawMsg json.RawMessage) (map[string]ServerPropertiesForCreateClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ServerPropertiesForCreateClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalServerPropertiesForCreateClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_privateendpointconnections_client.go index 7af1838eec27..8c21e850c99b 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_privateendpointconnections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. @@ -31,8 +31,15 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { - return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. @@ -246,7 +253,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsGetResponse{}, err + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -308,7 +315,7 @@ func (client *PrivateEndpointConnectionsClient) listByServerCreateRequest(ctx co func (client *PrivateEndpointConnectionsClient) listByServerHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListByServerResponse, error) { result := PrivateEndpointConnectionsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionsListByServerResponse{}, err + return PrivateEndpointConnectionsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_privatelinkresources_client.go index 852a6dc949c8..1086ee97f76d 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_privatelinkresources_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. @@ -30,8 +31,15 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { - return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a private link resource for MySQL server. @@ -85,7 +93,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesGetResponse, error) { result := PrivateLinkResourcesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { - return PrivateLinkResourcesGetResponse{}, err + return PrivateLinkResourcesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -147,7 +155,7 @@ func (client *PrivateLinkResourcesClient) listByServerCreateRequest(ctx context. func (client *PrivateLinkResourcesClient) listByServerHandleResponse(resp *http.Response) (PrivateLinkResourcesListByServerResponse, error) { result := PrivateLinkResourcesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { - return PrivateLinkResourcesListByServerResponse{}, err + return PrivateLinkResourcesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_querytexts_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_querytexts_client.go index 2d1527919966..0d22d037cd24 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_querytexts_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_querytexts_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // QueryTextsClient contains the methods for the QueryTexts group. @@ -30,8 +31,15 @@ type QueryTextsClient struct { } // NewQueryTextsClient creates a new instance of QueryTextsClient with the specified values. -func NewQueryTextsClient(con *arm.Connection, subscriptionID string) *QueryTextsClient { - return &QueryTextsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewQueryTextsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *QueryTextsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &QueryTextsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Retrieve the Query-Store query texts for the queryId. @@ -85,7 +93,7 @@ func (client *QueryTextsClient) getCreateRequest(ctx context.Context, resourceGr func (client *QueryTextsClient) getHandleResponse(resp *http.Response) (QueryTextsGetResponse, error) { result := QueryTextsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.QueryText); err != nil { - return QueryTextsGetResponse{}, err + return QueryTextsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -150,7 +158,7 @@ func (client *QueryTextsClient) listByServerCreateRequest(ctx context.Context, r func (client *QueryTextsClient) listByServerHandleResponse(resp *http.Response) (QueryTextsListByServerResponse, error) { result := QueryTextsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.QueryTextsResultList); err != nil { - return QueryTextsListByServerResponse{}, err + return QueryTextsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_recommendedactions_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_recommendedactions_client.go index 107e41f19aad..59b71b04c294 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_recommendedactions_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_recommendedactions_client.go @@ -11,13 +11,14 @@ package armmysql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RecommendedActionsClient contains the methods for the RecommendedActions group. @@ -29,8 +30,15 @@ type RecommendedActionsClient struct { } // NewRecommendedActionsClient creates a new instance of RecommendedActionsClient with the specified values. -func NewRecommendedActionsClient(con *arm.Connection, subscriptionID string) *RecommendedActionsClient { - return &RecommendedActionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRecommendedActionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RecommendedActionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RecommendedActionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Retrieve recommended actions from the advisor. @@ -88,7 +96,7 @@ func (client *RecommendedActionsClient) getCreateRequest(ctx context.Context, re func (client *RecommendedActionsClient) getHandleResponse(resp *http.Response) (RecommendedActionsGetResponse, error) { result := RecommendedActionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecommendationAction); err != nil { - return RecommendedActionsGetResponse{}, err + return RecommendedActionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -156,7 +164,7 @@ func (client *RecommendedActionsClient) listByServerCreateRequest(ctx context.Co func (client *RecommendedActionsClient) listByServerHandleResponse(resp *http.Response) (RecommendedActionsListByServerResponse, error) { result := RecommendedActionsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecommendationActionsResultList); err != nil { - return RecommendedActionsListByServerResponse{}, err + return RecommendedActionsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_recoverableservers_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_recoverableservers_client.go index 2d954da1728a..d2f5e8f15a77 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_recoverableservers_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_recoverableservers_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RecoverableServersClient contains the methods for the RecoverableServers group. @@ -30,8 +31,15 @@ type RecoverableServersClient struct { } // NewRecoverableServersClient creates a new instance of RecoverableServersClient with the specified values. -func NewRecoverableServersClient(con *arm.Connection, subscriptionID string) *RecoverableServersClient { - return &RecoverableServersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRecoverableServersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RecoverableServersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RecoverableServersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a recoverable MySQL Server. @@ -81,7 +89,7 @@ func (client *RecoverableServersClient) getCreateRequest(ctx context.Context, re func (client *RecoverableServersClient) getHandleResponse(resp *http.Response) (RecoverableServersGetResponse, error) { result := RecoverableServersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecoverableServerResource); err != nil { - return RecoverableServersGetResponse{}, err + return RecoverableServersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_replicas_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_replicas_client.go index eea558d717c9..45379238d32e 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_replicas_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_replicas_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ReplicasClient contains the methods for the Replicas group. @@ -30,8 +31,15 @@ type ReplicasClient struct { } // NewReplicasClient creates a new instance of ReplicasClient with the specified values. -func NewReplicasClient(con *arm.Connection, subscriptionID string) *ReplicasClient { - return &ReplicasClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewReplicasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ReplicasClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ReplicasClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByServer - List all the replicas for a given server. @@ -81,7 +89,7 @@ func (client *ReplicasClient) listByServerCreateRequest(ctx context.Context, res func (client *ReplicasClient) listByServerHandleResponse(resp *http.Response) (ReplicasListByServerResponse, error) { result := ReplicasListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerListResult); err != nil { - return ReplicasListByServerResponse{}, err + return ReplicasListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_response_types.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_response_types.go index e7f89d4b17a3..3c00f6f0ef68 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_response_types.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armmysql import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // AdvisorsGetResponse contains the response from method Advisors.Get. @@ -62,6 +61,8 @@ type ConfigurationsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ConfigurationsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ConfigurationsCreateOrUpdateResponse, error) { respType := ConfigurationsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Configuration) @@ -136,6 +137,8 @@ type DatabasesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabasesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesCreateOrUpdateResponse, error) { respType := DatabasesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Database) @@ -186,6 +189,8 @@ type DatabasesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabasesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesDeleteResponse, error) { respType := DatabasesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -254,6 +259,8 @@ type FirewallRulesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FirewallRulesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FirewallRulesCreateOrUpdateResponse, error) { respType := FirewallRulesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.FirewallRule) @@ -304,6 +311,8 @@ type FirewallRulesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FirewallRulesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FirewallRulesDeleteResponse, error) { respType := FirewallRulesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -420,6 +429,8 @@ type MySQLManagementClientCreateRecommendedActionSessionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l MySQLManagementClientCreateRecommendedActionSessionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MySQLManagementClientCreateRecommendedActionSessionResponse, error) { respType := MySQLManagementClientCreateRecommendedActionSessionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -488,6 +499,8 @@ type PrivateEndpointConnectionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsCreateOrUpdateResponse, error) { respType := PrivateEndpointConnectionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) @@ -538,6 +551,8 @@ type PrivateEndpointConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsDeleteResponse, error) { respType := PrivateEndpointConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -606,6 +621,8 @@ type PrivateEndpointConnectionsUpdateTagsPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsUpdateTagsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsUpdateTagsResponse, error) { respType := PrivateEndpointConnectionsUpdateTagsResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) @@ -752,6 +769,8 @@ type ServerAdministratorsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerAdministratorsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerAdministratorsCreateOrUpdateResponse, error) { respType := ServerAdministratorsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServerAdministratorResource) @@ -802,6 +821,8 @@ type ServerAdministratorsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerAdministratorsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerAdministratorsDeleteResponse, error) { respType := ServerAdministratorsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -882,6 +903,8 @@ type ServerKeysCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerKeysCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerKeysCreateOrUpdateResponse, error) { respType := ServerKeysCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServerKey) @@ -932,6 +955,8 @@ type ServerKeysDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerKeysDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerKeysDeleteResponse, error) { respType := ServerKeysDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1000,6 +1025,8 @@ type ServerParametersListUpdateConfigurationsPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerParametersListUpdateConfigurationsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerParametersListUpdateConfigurationsResponse, error) { respType := ServerParametersListUpdateConfigurationsResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ConfigurationListResult) @@ -1050,6 +1077,8 @@ type ServerSecurityAlertPoliciesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerSecurityAlertPoliciesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerSecurityAlertPoliciesCreateOrUpdateResponse, error) { respType := ServerSecurityAlertPoliciesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServerSecurityAlertPolicy) @@ -1124,6 +1153,8 @@ type ServersCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersCreateResponse, error) { respType := ServersCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Server) @@ -1174,6 +1205,8 @@ type ServersDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersDeleteResponse, error) { respType := ServersDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1254,6 +1287,8 @@ type ServersRestartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersRestartResponse, error) { respType := ServersRestartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1298,6 +1333,8 @@ type ServersStartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersStartResponse, error) { respType := ServersStartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1342,6 +1379,8 @@ type ServersStopPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersStopResponse, error) { respType := ServersStopResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1386,6 +1425,8 @@ type ServersUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersUpdateResponse, error) { respType := ServersUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Server) @@ -1436,6 +1477,8 @@ type ServersUpgradePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersUpgradePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersUpgradeResponse, error) { respType := ServersUpgradeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1504,6 +1547,8 @@ type VirtualNetworkRulesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkRulesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkRulesCreateOrUpdateResponse, error) { respType := VirtualNetworkRulesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualNetworkRule) @@ -1554,6 +1599,8 @@ type VirtualNetworkRulesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkRulesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkRulesDeleteResponse, error) { respType := VirtualNetworkRulesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_serveradministrators_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_serveradministrators_client.go index 049e3c58ad50..e83fc66cdb43 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_serveradministrators_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_serveradministrators_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerAdministratorsClient contains the methods for the ServerAdministrators group. @@ -31,8 +31,15 @@ type ServerAdministratorsClient struct { } // NewServerAdministratorsClient creates a new instance of ServerAdministratorsClient with the specified values. -func NewServerAdministratorsClient(con *arm.Connection, subscriptionID string) *ServerAdministratorsClient { - return &ServerAdministratorsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerAdministratorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerAdministratorsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerAdministratorsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or update active directory administrator on an existing server. The update action will overwrite the existing administrator. @@ -234,7 +241,7 @@ func (client *ServerAdministratorsClient) getCreateRequest(ctx context.Context, func (client *ServerAdministratorsClient) getHandleResponse(resp *http.Response) (ServerAdministratorsGetResponse, error) { result := ServerAdministratorsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerAdministratorResource); err != nil { - return ServerAdministratorsGetResponse{}, err + return ServerAdministratorsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -299,7 +306,7 @@ func (client *ServerAdministratorsClient) listCreateRequest(ctx context.Context, func (client *ServerAdministratorsClient) listHandleResponse(resp *http.Response) (ServerAdministratorsListResponse, error) { result := ServerAdministratorsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerAdministratorResourceListResult); err != nil { - return ServerAdministratorsListResponse{}, err + return ServerAdministratorsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_serverbasedperformancetier_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_serverbasedperformancetier_client.go index 3eaa8fcde2e6..05cbf26017ea 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_serverbasedperformancetier_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_serverbasedperformancetier_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerBasedPerformanceTierClient contains the methods for the ServerBasedPerformanceTier group. @@ -30,8 +31,15 @@ type ServerBasedPerformanceTierClient struct { } // NewServerBasedPerformanceTierClient creates a new instance of ServerBasedPerformanceTierClient with the specified values. -func NewServerBasedPerformanceTierClient(con *arm.Connection, subscriptionID string) *ServerBasedPerformanceTierClient { - return &ServerBasedPerformanceTierClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerBasedPerformanceTierClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerBasedPerformanceTierClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerBasedPerformanceTierClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - List all the performance tiers for a MySQL server. @@ -81,7 +89,7 @@ func (client *ServerBasedPerformanceTierClient) listCreateRequest(ctx context.Co func (client *ServerBasedPerformanceTierClient) listHandleResponse(resp *http.Response) (ServerBasedPerformanceTierListResponse, error) { result := ServerBasedPerformanceTierListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PerformanceTierListResult); err != nil { - return ServerBasedPerformanceTierListResponse{}, err + return ServerBasedPerformanceTierListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_serverkeys_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_serverkeys_client.go index 3a6e59757449..a920b7674462 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_serverkeys_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_serverkeys_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerKeysClient contains the methods for the ServerKeys group. @@ -31,8 +31,15 @@ type ServerKeysClient struct { } // NewServerKeysClient creates a new instance of ServerKeysClient with the specified values. -func NewServerKeysClient(con *arm.Connection, subscriptionID string) *ServerKeysClient { - return &ServerKeysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerKeysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerKeysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a MySQL Server key. @@ -246,7 +253,7 @@ func (client *ServerKeysClient) getCreateRequest(ctx context.Context, resourceGr func (client *ServerKeysClient) getHandleResponse(resp *http.Response) (ServerKeysGetResponse, error) { result := ServerKeysGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerKey); err != nil { - return ServerKeysGetResponse{}, err + return ServerKeysGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -308,7 +315,7 @@ func (client *ServerKeysClient) listCreateRequest(ctx context.Context, resourceG func (client *ServerKeysClient) listHandleResponse(resp *http.Response) (ServerKeysListResponse, error) { result := ServerKeysListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerKeyListResult); err != nil { - return ServerKeysListResponse{}, err + return ServerKeysListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_serverparameters_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_serverparameters_client.go index c500ad3d5569..cde6ebbddd59 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_serverparameters_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_serverparameters_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerParametersClient contains the methods for the ServerParameters group. @@ -31,8 +31,15 @@ type ServerParametersClient struct { } // NewServerParametersClient creates a new instance of ServerParametersClient with the specified values. -func NewServerParametersClient(con *arm.Connection, subscriptionID string) *ServerParametersClient { - return &ServerParametersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerParametersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerParametersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerParametersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginListUpdateConfigurations - Update a list of configurations in a given server. diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_servers_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_servers_client.go index 85b6273c92a0..9d8c21fff5a8 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_servers_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_servers_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServersClient contains the methods for the Servers group. @@ -31,8 +31,15 @@ type ServersClient struct { } // NewServersClient creates a new instance of ServersClient with the specified values. -func NewServersClient(con *arm.Connection, subscriptionID string) *ServersClient { - return &ServersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new server or updates an existing server. The update action will overwrite the existing server. @@ -234,7 +241,7 @@ func (client *ServersClient) getCreateRequest(ctx context.Context, resourceGroup func (client *ServersClient) getHandleResponse(resp *http.Response) (ServersGetResponse, error) { result := ServersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Server); err != nil { - return ServersGetResponse{}, err + return ServersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -291,7 +298,7 @@ func (client *ServersClient) listCreateRequest(ctx context.Context, options *Ser func (client *ServersClient) listHandleResponse(resp *http.Response) (ServersListResponse, error) { result := ServersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerListResult); err != nil { - return ServersListResponse{}, err + return ServersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -352,7 +359,7 @@ func (client *ServersClient) listByResourceGroupCreateRequest(ctx context.Contex func (client *ServersClient) listByResourceGroupHandleResponse(resp *http.Response) (ServersListByResourceGroupResponse, error) { result := ServersListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerListResult); err != nil { - return ServersListByResourceGroupResponse{}, err + return ServersListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_serversecurityalertpolicies_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_serversecurityalertpolicies_client.go index aac7dbd03f51..b7ffd4a6d359 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_serversecurityalertpolicies_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_serversecurityalertpolicies_client.go @@ -11,14 +11,14 @@ package armmysql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerSecurityAlertPoliciesClient contains the methods for the ServerSecurityAlertPolicies group. @@ -30,8 +30,15 @@ type ServerSecurityAlertPoliciesClient struct { } // NewServerSecurityAlertPoliciesClient creates a new instance of ServerSecurityAlertPoliciesClient with the specified values. -func NewServerSecurityAlertPoliciesClient(con *arm.Connection, subscriptionID string) *ServerSecurityAlertPoliciesClient { - return &ServerSecurityAlertPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerSecurityAlertPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerSecurityAlertPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerSecurityAlertPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a threat detection policy. @@ -164,7 +171,7 @@ func (client *ServerSecurityAlertPoliciesClient) getCreateRequest(ctx context.Co func (client *ServerSecurityAlertPoliciesClient) getHandleResponse(resp *http.Response) (ServerSecurityAlertPoliciesGetResponse, error) { result := ServerSecurityAlertPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerSecurityAlertPolicy); err != nil { - return ServerSecurityAlertPoliciesGetResponse{}, err + return ServerSecurityAlertPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -225,7 +232,7 @@ func (client *ServerSecurityAlertPoliciesClient) listByServerCreateRequest(ctx c func (client *ServerSecurityAlertPoliciesClient) listByServerHandleResponse(resp *http.Response) (ServerSecurityAlertPoliciesListByServerResponse, error) { result := ServerSecurityAlertPoliciesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerSecurityAlertPolicyListResult); err != nil { - return ServerSecurityAlertPoliciesListByServerResponse{}, err + return ServerSecurityAlertPoliciesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_time_rfc3339.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_time_rfc3339.go index 363f7322e270..151baa8b4eb4 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armmysql import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_topquerystatistics_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_topquerystatistics_client.go index 224652569a6d..08ee4bd1ff98 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_topquerystatistics_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_topquerystatistics_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TopQueryStatisticsClient contains the methods for the TopQueryStatistics group. @@ -30,8 +31,15 @@ type TopQueryStatisticsClient struct { } // NewTopQueryStatisticsClient creates a new instance of TopQueryStatisticsClient with the specified values. -func NewTopQueryStatisticsClient(con *arm.Connection, subscriptionID string) *TopQueryStatisticsClient { - return &TopQueryStatisticsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTopQueryStatisticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TopQueryStatisticsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TopQueryStatisticsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Retrieve the query statistic for specified identifier. @@ -85,7 +93,7 @@ func (client *TopQueryStatisticsClient) getCreateRequest(ctx context.Context, re func (client *TopQueryStatisticsClient) getHandleResponse(resp *http.Response) (TopQueryStatisticsGetResponse, error) { result := TopQueryStatisticsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.QueryStatistic); err != nil { - return TopQueryStatisticsGetResponse{}, err + return TopQueryStatisticsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -147,7 +155,7 @@ func (client *TopQueryStatisticsClient) listByServerCreateRequest(ctx context.Co func (client *TopQueryStatisticsClient) listByServerHandleResponse(resp *http.Response) (TopQueryStatisticsListByServerResponse, error) { result := TopQueryStatisticsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TopQueryStatisticsResultList); err != nil { - return TopQueryStatisticsListByServerResponse{}, err + return TopQueryStatisticsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_virtualnetworkrules_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_virtualnetworkrules_client.go index 24c47c950c66..c159fc7ee245 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_virtualnetworkrules_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_virtualnetworkrules_client.go @@ -11,14 +11,14 @@ package armmysql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualNetworkRulesClient contains the methods for the VirtualNetworkRules group. @@ -30,8 +30,15 @@ type VirtualNetworkRulesClient struct { } // NewVirtualNetworkRulesClient creates a new instance of VirtualNetworkRulesClient with the specified values. -func NewVirtualNetworkRulesClient(con *arm.Connection, subscriptionID string) *VirtualNetworkRulesClient { - return &VirtualNetworkRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualNetworkRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualNetworkRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualNetworkRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates an existing virtual network rule. @@ -242,7 +249,7 @@ func (client *VirtualNetworkRulesClient) getCreateRequest(ctx context.Context, r func (client *VirtualNetworkRulesClient) getHandleResponse(resp *http.Response) (VirtualNetworkRulesGetResponse, error) { result := VirtualNetworkRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkRule); err != nil { - return VirtualNetworkRulesGetResponse{}, err + return VirtualNetworkRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -303,7 +310,7 @@ func (client *VirtualNetworkRulesClient) listByServerCreateRequest(ctx context.C func (client *VirtualNetworkRulesClient) listByServerHandleResponse(resp *http.Response) (VirtualNetworkRulesListByServerResponse, error) { result := VirtualNetworkRulesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkRuleListResult); err != nil { - return VirtualNetworkRulesListByServerResponse{}, err + return VirtualNetworkRulesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysql/zz_generated_waitstatistics_client.go b/sdk/resourcemanager/mysql/armmysql/zz_generated_waitstatistics_client.go index fbd06a7db6ca..a9928e9b2a79 100644 --- a/sdk/resourcemanager/mysql/armmysql/zz_generated_waitstatistics_client.go +++ b/sdk/resourcemanager/mysql/armmysql/zz_generated_waitstatistics_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // WaitStatisticsClient contains the methods for the WaitStatistics group. @@ -30,8 +31,15 @@ type WaitStatisticsClient struct { } // NewWaitStatisticsClient creates a new instance of WaitStatisticsClient with the specified values. -func NewWaitStatisticsClient(con *arm.Connection, subscriptionID string) *WaitStatisticsClient { - return &WaitStatisticsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWaitStatisticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WaitStatisticsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WaitStatisticsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Retrieve wait statistics for specified identifier. @@ -85,7 +93,7 @@ func (client *WaitStatisticsClient) getCreateRequest(ctx context.Context, resour func (client *WaitStatisticsClient) getHandleResponse(resp *http.Response) (WaitStatisticsGetResponse, error) { result := WaitStatisticsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WaitStatistic); err != nil { - return WaitStatisticsGetResponse{}, err + return WaitStatisticsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -147,7 +155,7 @@ func (client *WaitStatisticsClient) listByServerCreateRequest(ctx context.Contex func (client *WaitStatisticsClient) listByServerHandleResponse(resp *http.Response) (WaitStatisticsListByServerResponse, error) { result := WaitStatisticsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WaitStatisticsResultList); err != nil { - return WaitStatisticsListByServerResponse{}, err + return WaitStatisticsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/CHANGELOG.md b/sdk/resourcemanager/mysql/armmysqlflexibleservers/CHANGELOG.md index 2276a757fdd8..626bf7231e27 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/CHANGELOG.md +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-20) diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/README.md b/sdk/resourcemanager/mysql/armmysqlflexibleservers/README.md index c45a421d7610..6a6761945cb5 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/README.md +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Database for MySQL +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Database for MySQL modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armmysqlflexibleservers.NewDatabasesClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Database for MySQL modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armmysqlflexibleservers.NewDatabasesClient(con, "") +options = arm.ClientOptions{ +Host: arm.AzureChina, +} +client := armmysqlflexibleservers.NewDatabasesClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/autorest.md b/sdk/resourcemanager/mysql/armmysqlflexibleservers/autorest.md index 4c628020ac2a..8428a58168cd 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/autorest.md +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/6ba37b7279bbd0d69042743246780cc3af9257b9/specification/mysql/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/6ba37b7279bbd0d69042743246780cc3af9257b9/specification/mysql/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/mysql/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/mysql/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 package-flexibleservers: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.mod b/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.mod index 440dbcacb052..8fa1eb9913df 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.mod +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/mysql/armmysqlflexi go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.2.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.sum b/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.sum index c8ff7a2143ad..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.sum +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible h1:iCb2tuoEm3N7ZpUDOvu1Yxl1B3iOVDmaD6weaRuIPzs= -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_backups_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_backups_client.go index b134ce0bb4b3..72771b6d688c 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_backups_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_backups_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // BackupsClient contains the methods for the Backups group. @@ -30,8 +31,15 @@ type BackupsClient struct { } // NewBackupsClient creates a new instance of BackupsClient with the specified values. -func NewBackupsClient(con *arm.Connection, subscriptionID string) *BackupsClient { - return &BackupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewBackupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *BackupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &BackupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - List all the backups for a given server. @@ -85,7 +93,7 @@ func (client *BackupsClient) getCreateRequest(ctx context.Context, resourceGroup func (client *BackupsClient) getHandleResponse(resp *http.Response) (BackupsGetResponse, error) { result := BackupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerBackup); err != nil { - return BackupsGetResponse{}, err + return BackupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -147,7 +155,7 @@ func (client *BackupsClient) listByServerCreateRequest(ctx context.Context, reso func (client *BackupsClient) listByServerHandleResponse(resp *http.Response) (BackupsListByServerResponse, error) { result := BackupsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerBackupListResult); err != nil { - return BackupsListByServerResponse{}, err + return BackupsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_checknameavailability_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_checknameavailability_client.go index cce4f9e75d72..96e499e9c94b 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_checknameavailability_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_checknameavailability_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CheckNameAvailabilityClient contains the methods for the CheckNameAvailability group. @@ -30,8 +31,15 @@ type CheckNameAvailabilityClient struct { } // NewCheckNameAvailabilityClient creates a new instance of CheckNameAvailabilityClient with the specified values. -func NewCheckNameAvailabilityClient(con *arm.Connection, subscriptionID string) *CheckNameAvailabilityClient { - return &CheckNameAvailabilityClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCheckNameAvailabilityClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CheckNameAvailabilityClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CheckNameAvailabilityClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Execute - Check the availability of name for server @@ -77,7 +85,7 @@ func (client *CheckNameAvailabilityClient) executeCreateRequest(ctx context.Cont func (client *CheckNameAvailabilityClient) executeHandleResponse(resp *http.Response) (CheckNameAvailabilityExecuteResponse, error) { result := CheckNameAvailabilityExecuteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NameAvailability); err != nil { - return CheckNameAvailabilityExecuteResponse{}, err + return CheckNameAvailabilityExecuteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_checkvirtualnetworksubnetusage_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_checkvirtualnetworksubnetusage_client.go index f96ec617bdac..4efb7d0a3064 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_checkvirtualnetworksubnetusage_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_checkvirtualnetworksubnetusage_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CheckVirtualNetworkSubnetUsageClient contains the methods for the CheckVirtualNetworkSubnetUsage group. @@ -30,8 +31,15 @@ type CheckVirtualNetworkSubnetUsageClient struct { } // NewCheckVirtualNetworkSubnetUsageClient creates a new instance of CheckVirtualNetworkSubnetUsageClient with the specified values. -func NewCheckVirtualNetworkSubnetUsageClient(con *arm.Connection, subscriptionID string) *CheckVirtualNetworkSubnetUsageClient { - return &CheckVirtualNetworkSubnetUsageClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCheckVirtualNetworkSubnetUsageClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CheckVirtualNetworkSubnetUsageClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CheckVirtualNetworkSubnetUsageClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Execute - Get virtual network subnet usage for a given vNet resource id. @@ -77,7 +85,7 @@ func (client *CheckVirtualNetworkSubnetUsageClient) executeCreateRequest(ctx con func (client *CheckVirtualNetworkSubnetUsageClient) executeHandleResponse(resp *http.Response) (CheckVirtualNetworkSubnetUsageExecuteResponse, error) { result := CheckVirtualNetworkSubnetUsageExecuteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkSubnetUsageResult); err != nil { - return CheckVirtualNetworkSubnetUsageExecuteResponse{}, err + return CheckVirtualNetworkSubnetUsageExecuteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_configurations_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_configurations_client.go index 3cd8f997c160..3852a3b91e1a 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_configurations_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_configurations_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ConfigurationsClient contains the methods for the Configurations group. @@ -31,8 +31,15 @@ type ConfigurationsClient struct { } // NewConfigurationsClient creates a new instance of ConfigurationsClient with the specified values. -func NewConfigurationsClient(con *arm.Connection, subscriptionID string) *ConfigurationsClient { - return &ConfigurationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ConfigurationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ConfigurationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginBatchUpdate - Update a list of configurations in a given server. @@ -162,7 +169,7 @@ func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resour func (client *ConfigurationsClient) getHandleResponse(resp *http.Response) (ConfigurationsGetResponse, error) { result := ConfigurationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Configuration); err != nil { - return ConfigurationsGetResponse{}, err + return ConfigurationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -224,7 +231,7 @@ func (client *ConfigurationsClient) listByServerCreateRequest(ctx context.Contex func (client *ConfigurationsClient) listByServerHandleResponse(resp *http.Response) (ConfigurationsListByServerResponse, error) { result := ConfigurationsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationListResult); err != nil { - return ConfigurationsListByServerResponse{}, err + return ConfigurationsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_constants.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_constants.go index 446ca11f857e..66ce58145d4e 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_constants.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_constants.go @@ -10,7 +10,7 @@ package armmysqlflexibleservers const ( module = "armmysqlflexibleservers" - version = "v0.1.1" + version = "v0.2.0" ) // ConfigurationSource - Source of the configuration. diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_databases_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_databases_client.go index d67620e382a8..9214e3727ddb 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_databases_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_databases_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabasesClient contains the methods for the Databases group. @@ -31,8 +31,15 @@ type DatabasesClient struct { } // NewDatabasesClient creates a new instance of DatabasesClient with the specified values. -func NewDatabasesClient(con *arm.Connection, subscriptionID string) *DatabasesClient { - return &DatabasesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabasesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabasesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a new database or updates an existing database. @@ -246,7 +253,7 @@ func (client *DatabasesClient) getCreateRequest(ctx context.Context, resourceGro func (client *DatabasesClient) getHandleResponse(resp *http.Response) (DatabasesGetResponse, error) { result := DatabasesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Database); err != nil { - return DatabasesGetResponse{}, err + return DatabasesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -308,7 +315,7 @@ func (client *DatabasesClient) listByServerCreateRequest(ctx context.Context, re func (client *DatabasesClient) listByServerHandleResponse(resp *http.Response) (DatabasesListByServerResponse, error) { result := DatabasesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseListResult); err != nil { - return DatabasesListByServerResponse{}, err + return DatabasesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_firewallrules_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_firewallrules_client.go index da3d8d8a4ab2..bed9b87bfcf5 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_firewallrules_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_firewallrules_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // FirewallRulesClient contains the methods for the FirewallRules group. @@ -31,8 +31,15 @@ type FirewallRulesClient struct { } // NewFirewallRulesClient creates a new instance of FirewallRulesClient with the specified values. -func NewFirewallRulesClient(con *arm.Connection, subscriptionID string) *FirewallRulesClient { - return &FirewallRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FirewallRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FirewallRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a new firewall rule or updates an existing firewall rule. @@ -246,7 +253,7 @@ func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourc func (client *FirewallRulesClient) getHandleResponse(resp *http.Response) (FirewallRulesGetResponse, error) { result := FirewallRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRule); err != nil { - return FirewallRulesGetResponse{}, err + return FirewallRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -308,7 +315,7 @@ func (client *FirewallRulesClient) listByServerCreateRequest(ctx context.Context func (client *FirewallRulesClient) listByServerHandleResponse(resp *http.Response) (FirewallRulesListByServerResponse, error) { result := FirewallRulesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRuleListResult); err != nil { - return FirewallRulesListByServerResponse{}, err + return FirewallRulesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_getprivatednszonesuffix_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_getprivatednszonesuffix_client.go index a350f0c2faad..3c98861b48c0 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_getprivatednszonesuffix_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_getprivatednszonesuffix_client.go @@ -11,11 +11,12 @@ package armmysqlflexibleservers import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // GetPrivateDNSZoneSuffixClient contains the methods for the GetPrivateDNSZoneSuffix group. @@ -26,8 +27,15 @@ type GetPrivateDNSZoneSuffixClient struct { } // NewGetPrivateDNSZoneSuffixClient creates a new instance of GetPrivateDNSZoneSuffixClient with the specified values. -func NewGetPrivateDNSZoneSuffixClient(con *arm.Connection) *GetPrivateDNSZoneSuffixClient { - return &GetPrivateDNSZoneSuffixClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewGetPrivateDNSZoneSuffixClient(credential azcore.TokenCredential, options *arm.ClientOptions) *GetPrivateDNSZoneSuffixClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &GetPrivateDNSZoneSuffixClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Execute - Get private DNS zone suffix in the cloud. @@ -65,7 +73,7 @@ func (client *GetPrivateDNSZoneSuffixClient) executeCreateRequest(ctx context.Co func (client *GetPrivateDNSZoneSuffixClient) executeHandleResponse(resp *http.Response) (GetPrivateDNSZoneSuffixExecuteResponse, error) { result := GetPrivateDNSZoneSuffixExecuteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GetPrivateDNSZoneSuffixResponse); err != nil { - return GetPrivateDNSZoneSuffixExecuteResponse{}, err + return GetPrivateDNSZoneSuffixExecuteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_locationbasedcapabilities_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_locationbasedcapabilities_client.go index b1ee32c812bd..6a2892fae0f8 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_locationbasedcapabilities_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_locationbasedcapabilities_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LocationBasedCapabilitiesClient contains the methods for the LocationBasedCapabilities group. @@ -30,8 +31,15 @@ type LocationBasedCapabilitiesClient struct { } // NewLocationBasedCapabilitiesClient creates a new instance of LocationBasedCapabilitiesClient with the specified values. -func NewLocationBasedCapabilitiesClient(con *arm.Connection, subscriptionID string) *LocationBasedCapabilitiesClient { - return &LocationBasedCapabilitiesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLocationBasedCapabilitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LocationBasedCapabilitiesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LocationBasedCapabilitiesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Get capabilities at specified location in a given subscription. @@ -74,7 +82,7 @@ func (client *LocationBasedCapabilitiesClient) listCreateRequest(ctx context.Con func (client *LocationBasedCapabilitiesClient) listHandleResponse(resp *http.Response) (LocationBasedCapabilitiesListResponse, error) { result := LocationBasedCapabilitiesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CapabilitiesListResult); err != nil { - return LocationBasedCapabilitiesListResponse{}, err + return LocationBasedCapabilitiesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_models.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_models.go index ab36f8f12ab7..c091c4870223 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_models.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_models.go @@ -10,10 +10,9 @@ package armmysqlflexibleservers import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // Backup - Storage Profile properties of a server @@ -32,7 +31,7 @@ type Backup struct { func (b Backup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "backupRetentionDays", b.BackupRetentionDays) - populate(objectMap, "earliestRestoreDate", (*timeRFC3339)(b.EarliestRestoreDate)) + populateTimeRFC3339(objectMap, "earliestRestoreDate", b.EarliestRestoreDate) populate(objectMap, "geoRedundantBackup", b.GeoRedundantBackup) return json.Marshal(objectMap) } @@ -50,9 +49,7 @@ func (b *Backup) UnmarshalJSON(data []byte) error { err = unpopulate(val, &b.BackupRetentionDays) delete(rawMsg, key) case "earliestRestoreDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - b.EarliestRestoreDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &b.EarliestRestoreDate) delete(rawMsg, key) case "geoRedundantBackup": err = unpopulate(val, &b.GeoRedundantBackup) @@ -712,7 +709,7 @@ type ServerBackupProperties struct { func (s ServerBackupProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "backupType", s.BackupType) - populate(objectMap, "completedTime", (*timeRFC3339)(s.CompletedTime)) + populateTimeRFC3339(objectMap, "completedTime", s.CompletedTime) populate(objectMap, "source", s.Source) return json.Marshal(objectMap) } @@ -730,9 +727,7 @@ func (s *ServerBackupProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.BackupType) delete(rawMsg, key) case "completedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CompletedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CompletedTime) delete(rawMsg, key) case "source": err = unpopulate(val, &s.Source) @@ -869,7 +864,7 @@ func (s ServerProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "network", s.Network) populate(objectMap, "replicaCapacity", s.ReplicaCapacity) populate(objectMap, "replicationRole", s.ReplicationRole) - populate(objectMap, "restorePointInTime", (*timeRFC3339)(s.RestorePointInTime)) + populateTimeRFC3339(objectMap, "restorePointInTime", s.RestorePointInTime) populate(objectMap, "sourceServerResourceId", s.SourceServerResourceID) populate(objectMap, "state", s.State) populate(objectMap, "storage", s.Storage) @@ -920,9 +915,7 @@ func (s *ServerProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.ReplicationRole) delete(rawMsg, key) case "restorePointInTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.RestorePointInTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.RestorePointInTime) delete(rawMsg, key) case "sourceServerResourceId": err = unpopulate(val, &s.SourceServerResourceID) @@ -1098,10 +1091,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -1117,9 +1110,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -1128,9 +1119,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_operations_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_operations_client.go index 546c92a3f24e..5b681ba62041 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_operations_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armmysqlflexibleservers import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available REST API operations. @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_pagers.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_pagers.go index 83222c8b348b..30faa82d69b2 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_pagers.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armmysqlflexibleservers import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // BackupsListByServerPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_pollers.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_pollers.go index 66e3848f49dd..84ca21d9016a 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_pollers.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armmysqlflexibleservers import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // ConfigurationsBatchUpdatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_replicas_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_replicas_client.go index 8d0c64559d73..9b9268a54d65 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_replicas_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_replicas_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ReplicasClient contains the methods for the Replicas group. @@ -30,8 +31,15 @@ type ReplicasClient struct { } // NewReplicasClient creates a new instance of ReplicasClient with the specified values. -func NewReplicasClient(con *arm.Connection, subscriptionID string) *ReplicasClient { - return &ReplicasClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewReplicasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ReplicasClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ReplicasClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByServer - List all the replicas for a given server. @@ -78,7 +86,7 @@ func (client *ReplicasClient) listByServerCreateRequest(ctx context.Context, res func (client *ReplicasClient) listByServerHandleResponse(resp *http.Response) (ReplicasListByServerResponse, error) { result := ReplicasListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerListResult); err != nil { - return ReplicasListByServerResponse{}, err + return ReplicasListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_response_types.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_response_types.go index 2d1e10edfdc6..d9a53db416ef 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_response_types.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armmysqlflexibleservers import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // BackupsGetResponse contains the response from method Backups.Get. @@ -74,6 +73,8 @@ type ConfigurationsBatchUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ConfigurationsBatchUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ConfigurationsBatchUpdateResponse, error) { respType := ConfigurationsBatchUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ConfigurationListResult) @@ -148,6 +149,8 @@ type ConfigurationsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ConfigurationsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ConfigurationsUpdateResponse, error) { respType := ConfigurationsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Configuration) @@ -198,6 +201,8 @@ type DatabasesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabasesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesCreateOrUpdateResponse, error) { respType := DatabasesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Database) @@ -248,6 +253,8 @@ type DatabasesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabasesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesDeleteResponse, error) { respType := DatabasesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -316,6 +323,8 @@ type FirewallRulesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FirewallRulesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FirewallRulesCreateOrUpdateResponse, error) { respType := FirewallRulesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.FirewallRule) @@ -366,6 +375,8 @@ type FirewallRulesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FirewallRulesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FirewallRulesDeleteResponse, error) { respType := FirewallRulesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -482,6 +493,8 @@ type ServersCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersCreateResponse, error) { respType := ServersCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Server) @@ -532,6 +545,8 @@ type ServersDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersDeleteResponse, error) { respType := ServersDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -576,6 +591,8 @@ type ServersFailoverPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersFailoverPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersFailoverResponse, error) { respType := ServersFailoverResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -656,6 +673,8 @@ type ServersRestartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersRestartResponse, error) { respType := ServersRestartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -700,6 +719,8 @@ type ServersStartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersStartResponse, error) { respType := ServersStartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -744,6 +765,8 @@ type ServersStopPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersStopResponse, error) { respType := ServersStopResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -788,6 +811,8 @@ type ServersUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersUpdateResponse, error) { respType := ServersUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Server) diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_servers_client.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_servers_client.go index 9075048a6c1f..0c4a1d39f1f6 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_servers_client.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_servers_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServersClient contains the methods for the Servers group. @@ -31,8 +31,15 @@ type ServersClient struct { } // NewServersClient creates a new instance of ServersClient with the specified values. -func NewServersClient(con *arm.Connection, subscriptionID string) *ServersClient { - return &ServersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new server or updates an existing server. The update action will overwrite the existing server. @@ -310,7 +317,7 @@ func (client *ServersClient) getCreateRequest(ctx context.Context, resourceGroup func (client *ServersClient) getHandleResponse(resp *http.Response) (ServersGetResponse, error) { result := ServersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Server); err != nil { - return ServersGetResponse{}, err + return ServersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -364,7 +371,7 @@ func (client *ServersClient) listCreateRequest(ctx context.Context, options *Ser func (client *ServersClient) listHandleResponse(resp *http.Response) (ServersListResponse, error) { result := ServersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerListResult); err != nil { - return ServersListResponse{}, err + return ServersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -422,7 +429,7 @@ func (client *ServersClient) listByResourceGroupCreateRequest(ctx context.Contex func (client *ServersClient) listByResourceGroupHandleResponse(resp *http.Response) (ServersListByResourceGroupResponse, error) { result := ServersListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerListResult); err != nil { - return ServersListByResourceGroupResponse{}, err + return ServersListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_time_rfc3339.go b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_time_rfc3339.go index 88cdfea4fd73..f839dc6e58d1 100644 --- a/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/mysql/armmysqlflexibleservers/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armmysqlflexibleservers import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/network/armnetwork/CHANGELOG.md b/sdk/resourcemanager/network/armnetwork/CHANGELOG.md index ea8ce94dd647..872fae740392 100644 --- a/sdk/resourcemanager/network/armnetwork/CHANGELOG.md +++ b/sdk/resourcemanager/network/armnetwork/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-09-29) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/network/armnetwork") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/network/armnetwork/README.md b/sdk/resourcemanager/network/armnetwork/README.md index 175c714cebcc..d14fea439adf 100644 --- a/sdk/resourcemanager/network/armnetwork/README.md +++ b/sdk/resourcemanager/network/armnetwork/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Network +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Network modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armnetwork.NewVirtualHubBgpConnectionsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Network modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armnetwork.NewVirtualHubBgpConnectionsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armnetwork.NewVirtualHubBgpConnectionsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/network/armnetwork/autorest.md b/sdk/resourcemanager/network/armnetwork/autorest.md index 015a93895d13..dc647020b3ea 100644 --- a/sdk/resourcemanager/network/armnetwork/autorest.md +++ b/sdk/resourcemanager/network/armnetwork/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7919a8694f46cea4259ea5b62b1e797573175e16/specification/network/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7919a8694f46cea4259ea5b62b1e797573175e16/specification/network/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/network/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/network/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/network/armnetwork/example_loadbalancers_test.go b/sdk/resourcemanager/network/armnetwork/example_loadbalancers_test.go index 949f6698ed40..b5412aff7caa 100644 --- a/sdk/resourcemanager/network/armnetwork/example_loadbalancers_test.go +++ b/sdk/resourcemanager/network/armnetwork/example_loadbalancers_test.go @@ -12,7 +12,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" @@ -35,7 +34,7 @@ func ExampleLoadBalancersClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewLoadBalancersClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewLoadBalancersClient("", cred, nil) poller, err := client.BeginCreateOrUpdate( context.Background(), resourceGroupName, @@ -141,7 +140,7 @@ func ExampleLoadBalancersClient_Get() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewLoadBalancersClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewLoadBalancersClient("", cred, nil) resp, err := client.Get(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to get resource: %v", err) @@ -154,7 +153,7 @@ func ExampleLoadBalancersClient_BeginDelete() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewLoadBalancersClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewLoadBalancersClient("", cred, nil) resp, err := client.BeginDelete(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) diff --git a/sdk/resourcemanager/network/armnetwork/example_networkinterfaces_test.go b/sdk/resourcemanager/network/armnetwork/example_networkinterfaces_test.go index b7b0eaef3200..dbfdbaba776f 100644 --- a/sdk/resourcemanager/network/armnetwork/example_networkinterfaces_test.go +++ b/sdk/resourcemanager/network/armnetwork/example_networkinterfaces_test.go @@ -11,7 +11,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" @@ -28,7 +27,7 @@ func ExampleNetworkInterfacesClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewNetworkInterfacesClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewNetworkInterfacesClient("", cred, nil) poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -68,7 +67,7 @@ func ExampleNetworkInterfacesClient_Get() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewNetworkInterfacesClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewNetworkInterfacesClient("", cred, nil) resp, err := client.Get(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to get resource: %v", err) @@ -81,7 +80,7 @@ func ExampleNetworkInterfacesClient_BeginDelete() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewNetworkInterfacesClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewNetworkInterfacesClient("", cred, nil) poller, err := client.BeginDelete(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) diff --git a/sdk/resourcemanager/network/armnetwork/example_networksecuritygroups_test.go b/sdk/resourcemanager/network/armnetwork/example_networksecuritygroups_test.go index d83d050506e8..ed21e940c780 100644 --- a/sdk/resourcemanager/network/armnetwork/example_networksecuritygroups_test.go +++ b/sdk/resourcemanager/network/armnetwork/example_networksecuritygroups_test.go @@ -11,7 +11,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" @@ -22,7 +21,7 @@ func ExampleNetworkSecurityGroupsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewNetworkSecurityGroupsClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewNetworkSecurityGroupsClient("", cred, nil) poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -50,7 +49,7 @@ func ExampleNetworkSecurityGroupsClient_BeginCreateOrUpdate_withSSHandHTTPSrules if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewNetworkSecurityGroupsClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewNetworkSecurityGroupsClient("", cred, nil) poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -108,7 +107,7 @@ func ExampleNetworkSecurityGroupsClient_Get() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewNetworkSecurityGroupsClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewNetworkSecurityGroupsClient("", cred, nil) resp, err := client.Get(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to get resource: %v", err) @@ -121,7 +120,7 @@ func ExampleNetworkSecurityGroupsClient_BeginDelete() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewNetworkSecurityGroupsClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewNetworkSecurityGroupsClient("", cred, nil) resp, err := client.BeginDelete(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) diff --git a/sdk/resourcemanager/network/armnetwork/example_publicipaddresses_test.go b/sdk/resourcemanager/network/armnetwork/example_publicipaddresses_test.go index 73f44358e935..89c9d326bf5f 100644 --- a/sdk/resourcemanager/network/armnetwork/example_publicipaddresses_test.go +++ b/sdk/resourcemanager/network/armnetwork/example_publicipaddresses_test.go @@ -11,7 +11,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" @@ -22,7 +21,7 @@ func ExamplePublicIPAddressesClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewPublicIPAddressesClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewPublicIPAddressesClient("", cred, nil) poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -54,7 +53,7 @@ func ExamplePublicIPAddressesClient_Get() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewPublicIPAddressesClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewPublicIPAddressesClient("", cred, nil) resp, err := client.Get(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to get resource: %v", err) @@ -67,7 +66,7 @@ func ExamplePublicIPAddressesClient_BeginDelete() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewPublicIPAddressesClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewPublicIPAddressesClient("", cred, nil) resp, err := client.BeginDelete(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) diff --git a/sdk/resourcemanager/network/armnetwork/example_securityrules_test.go b/sdk/resourcemanager/network/armnetwork/example_securityrules_test.go index 793169f37f6b..a8718ef41594 100644 --- a/sdk/resourcemanager/network/armnetwork/example_securityrules_test.go +++ b/sdk/resourcemanager/network/armnetwork/example_securityrules_test.go @@ -11,7 +11,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" @@ -22,7 +21,7 @@ func ExampleSecurityRulesClient_BeginCreateOrUpdate_allowSSH() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewSecurityRulesClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewSecurityRulesClient("", cred, nil) poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -58,7 +57,7 @@ func ExampleSecurityRulesClient_BeginCreateOrUpdate_allowHTTP() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewSecurityRulesClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewSecurityRulesClient("", cred, nil) poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -94,7 +93,7 @@ func ExampleSecurityRulesClient_BeginCreateOrUpdate_allowSQL() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewSecurityRulesClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewSecurityRulesClient("", cred, nil) poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -130,7 +129,7 @@ func ExampleSecurityRulesClient_BeginCreateOrUpdate_denyOut() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewSecurityRulesClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewSecurityRulesClient("", cred, nil) poller, err := client.BeginCreateOrUpdate( context.Background(), "", diff --git a/sdk/resourcemanager/network/armnetwork/example_subnets_test.go b/sdk/resourcemanager/network/armnetwork/example_subnets_test.go index a443446c41fc..713476713bb4 100644 --- a/sdk/resourcemanager/network/armnetwork/example_subnets_test.go +++ b/sdk/resourcemanager/network/armnetwork/example_subnets_test.go @@ -11,7 +11,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" @@ -22,7 +21,7 @@ func ExampleSubnetsClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewSubnetsClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewSubnetsClient("", cred, nil) poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -53,7 +52,7 @@ func ExampleSubnetsClient_BeginCreateOrUpdate_withNetworkSecurityGroup() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewSubnetsClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewSubnetsClient("", cred, nil) poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -82,7 +81,7 @@ func ExampleSubnetsClient_Get() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewSubnetsClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewSubnetsClient("", cred, nil) resp, err := client.Get(context.Background(), "", "", "", nil) if err != nil { log.Fatalf("failed to get resource: %v", err) @@ -95,7 +94,7 @@ func ExampleSubnetsClient_BeginDelete() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewSubnetsClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewSubnetsClient("", cred, nil) resp, err := client.BeginDelete(context.Background(), "", "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) diff --git a/sdk/resourcemanager/network/armnetwork/example_virtualnetworks_test.go b/sdk/resourcemanager/network/armnetwork/example_virtualnetworks_test.go index 2fd6335cd360..89ac7a336ee4 100644 --- a/sdk/resourcemanager/network/armnetwork/example_virtualnetworks_test.go +++ b/sdk/resourcemanager/network/armnetwork/example_virtualnetworks_test.go @@ -11,7 +11,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork" @@ -22,7 +21,7 @@ func ExampleVirtualNetworksClient_BeginCreateOrUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewVirtualNetworksClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewVirtualNetworksClient("", cred, nil) poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -57,7 +56,7 @@ func ExampleVirtualNetworksClient_BeginCreateOrUpdate_withSubnets() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewVirtualNetworksClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewVirtualNetworksClient("", cred, nil) poller, err := client.BeginCreateOrUpdate( context.Background(), "", @@ -106,7 +105,7 @@ func ExampleVirtualNetworksClient_Get() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewVirtualNetworksClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewVirtualNetworksClient("", cred, nil) resp, err := client.Get(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to get resource: %v", err) @@ -119,7 +118,7 @@ func ExampleVirtualNetworksClient_BeginDelete() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armnetwork.NewVirtualNetworksClient(arm.NewDefaultConnection(cred, nil), "") + client := armnetwork.NewVirtualNetworksClient("", cred, nil) resp, err := client.BeginDelete(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) diff --git a/sdk/resourcemanager/network/armnetwork/go.mod b/sdk/resourcemanager/network/armnetwork/go.mod index fb687f2a5ab6..8dd7b8803b38 100644 --- a/sdk/resourcemanager/network/armnetwork/go.mod +++ b/sdk/resourcemanager/network/armnetwork/go.mod @@ -3,7 +3,9 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/network/armnetwork go 1.16 require ( - github.com/Azure/azure-sdk-for-go v57.4.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0 ) + +replace github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0 => ../../../azidentity diff --git a/sdk/resourcemanager/network/armnetwork/go.sum b/sdk/resourcemanager/network/armnetwork/go.sum index ffc329a511d0..0a36ef05b718 100644 --- a/sdk/resourcemanager/network/armnetwork/go.sum +++ b/sdk/resourcemanager/network/armnetwork/go.sum @@ -1,15 +1,13 @@ -github.com/Azure/azure-sdk-for-go v57.4.0+incompatible h1:uzhy/mTwu4rq6Be/fJJnE82PRx2A2vjGjzsA3aQ6Qu0= -github.com/Azure/azure-sdk-for-go v57.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0 h1:OYa9vmRX2XC5GXRAzeggG12sF/z5D9Ahtdm9EJ00WN4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= @@ -19,22 +17,26 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_applicationgatewayprivateendpointconnections_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_applicationgatewayprivateendpointconnections_client.go index 0e9d11730171..4bf3550b52da 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_applicationgatewayprivateendpointconnections_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_applicationgatewayprivateendpointconnections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ApplicationGatewayPrivateEndpointConnectionsClient contains the methods for the ApplicationGatewayPrivateEndpointConnections group. @@ -31,8 +31,15 @@ type ApplicationGatewayPrivateEndpointConnectionsClient struct { } // NewApplicationGatewayPrivateEndpointConnectionsClient creates a new instance of ApplicationGatewayPrivateEndpointConnectionsClient with the specified values. -func NewApplicationGatewayPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *ApplicationGatewayPrivateEndpointConnectionsClient { - return &ApplicationGatewayPrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewApplicationGatewayPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ApplicationGatewayPrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ApplicationGatewayPrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginDelete - Deletes the specified private endpoint connection on application gateway. @@ -96,7 +103,7 @@ func (client *ApplicationGatewayPrivateEndpointConnectionsClient) deleteCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -156,7 +163,7 @@ func (client *ApplicationGatewayPrivateEndpointConnectionsClient) getCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -166,7 +173,7 @@ func (client *ApplicationGatewayPrivateEndpointConnectionsClient) getCreateReque func (client *ApplicationGatewayPrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (ApplicationGatewayPrivateEndpointConnectionsGetResponse, error) { result := ApplicationGatewayPrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayPrivateEndpointConnection); err != nil { - return ApplicationGatewayPrivateEndpointConnectionsGetResponse{}, err + return ApplicationGatewayPrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -218,7 +225,7 @@ func (client *ApplicationGatewayPrivateEndpointConnectionsClient) listCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -228,7 +235,7 @@ func (client *ApplicationGatewayPrivateEndpointConnectionsClient) listCreateRequ func (client *ApplicationGatewayPrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (ApplicationGatewayPrivateEndpointConnectionsListResponse, error) { result := ApplicationGatewayPrivateEndpointConnectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayPrivateEndpointConnectionListResult); err != nil { - return ApplicationGatewayPrivateEndpointConnectionsListResponse{}, err + return ApplicationGatewayPrivateEndpointConnectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -307,7 +314,7 @@ func (client *ApplicationGatewayPrivateEndpointConnectionsClient) updateCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_applicationgatewayprivatelinkresources_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_applicationgatewayprivatelinkresources_client.go index bf3e5bebedef..47e8c1aea13b 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_applicationgatewayprivatelinkresources_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_applicationgatewayprivatelinkresources_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ApplicationGatewayPrivateLinkResourcesClient contains the methods for the ApplicationGatewayPrivateLinkResources group. @@ -30,8 +31,15 @@ type ApplicationGatewayPrivateLinkResourcesClient struct { } // NewApplicationGatewayPrivateLinkResourcesClient creates a new instance of ApplicationGatewayPrivateLinkResourcesClient with the specified values. -func NewApplicationGatewayPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *ApplicationGatewayPrivateLinkResourcesClient { - return &ApplicationGatewayPrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewApplicationGatewayPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ApplicationGatewayPrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ApplicationGatewayPrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all private link resources on an application gateway. @@ -68,7 +76,7 @@ func (client *ApplicationGatewayPrivateLinkResourcesClient) listCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -78,7 +86,7 @@ func (client *ApplicationGatewayPrivateLinkResourcesClient) listCreateRequest(ct func (client *ApplicationGatewayPrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (ApplicationGatewayPrivateLinkResourcesListResponse, error) { result := ApplicationGatewayPrivateLinkResourcesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayPrivateLinkResourceListResult); err != nil { - return ApplicationGatewayPrivateLinkResourcesListResponse{}, err + return ApplicationGatewayPrivateLinkResourcesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_applicationgateways_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_applicationgateways_client.go index 8458a1f985c4..acc2c879ee20 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_applicationgateways_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_applicationgateways_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ApplicationGatewaysClient contains the methods for the ApplicationGateways group. @@ -31,8 +31,15 @@ type ApplicationGatewaysClient struct { } // NewApplicationGatewaysClient creates a new instance of ApplicationGatewaysClient with the specified values. -func NewApplicationGatewaysClient(con *arm.Connection, subscriptionID string) *ApplicationGatewaysClient { - return &ApplicationGatewaysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewApplicationGatewaysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ApplicationGatewaysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ApplicationGatewaysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginBackendHealth - Gets the backend health of the specified application gateway in a resource group. @@ -92,7 +99,7 @@ func (client *ApplicationGatewaysClient) backendHealthCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -173,7 +180,7 @@ func (client *ApplicationGatewaysClient) backendHealthOnDemandCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -252,7 +259,7 @@ func (client *ApplicationGatewaysClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -328,7 +335,7 @@ func (client *ApplicationGatewaysClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -384,7 +391,7 @@ func (client *ApplicationGatewaysClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -394,7 +401,7 @@ func (client *ApplicationGatewaysClient) getCreateRequest(ctx context.Context, r func (client *ApplicationGatewaysClient) getHandleResponse(resp *http.Response) (ApplicationGatewaysGetResponse, error) { result := ApplicationGatewaysGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGateway); err != nil { - return ApplicationGatewaysGetResponse{}, err + return ApplicationGatewaysGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -445,7 +452,7 @@ func (client *ApplicationGatewaysClient) getSSLPredefinedPolicyCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -455,7 +462,7 @@ func (client *ApplicationGatewaysClient) getSSLPredefinedPolicyCreateRequest(ctx func (client *ApplicationGatewaysClient) getSSLPredefinedPolicyHandleResponse(resp *http.Response) (ApplicationGatewaysGetSSLPredefinedPolicyResponse, error) { result := ApplicationGatewaysGetSSLPredefinedPolicyResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewaySSLPredefinedPolicy); err != nil { - return ApplicationGatewaysGetSSLPredefinedPolicyResponse{}, err + return ApplicationGatewaysGetSSLPredefinedPolicyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -503,7 +510,7 @@ func (client *ApplicationGatewaysClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -513,7 +520,7 @@ func (client *ApplicationGatewaysClient) listCreateRequest(ctx context.Context, func (client *ApplicationGatewaysClient) listHandleResponse(resp *http.Response) (ApplicationGatewaysListResponse, error) { result := ApplicationGatewaysListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayListResult); err != nil { - return ApplicationGatewaysListResponse{}, err + return ApplicationGatewaysListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -557,7 +564,7 @@ func (client *ApplicationGatewaysClient) listAllCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -567,7 +574,7 @@ func (client *ApplicationGatewaysClient) listAllCreateRequest(ctx context.Contex func (client *ApplicationGatewaysClient) listAllHandleResponse(resp *http.Response) (ApplicationGatewaysListAllResponse, error) { result := ApplicationGatewaysListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayListResult); err != nil { - return ApplicationGatewaysListAllResponse{}, err + return ApplicationGatewaysListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -614,7 +621,7 @@ func (client *ApplicationGatewaysClient) listAvailableRequestHeadersCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -624,7 +631,7 @@ func (client *ApplicationGatewaysClient) listAvailableRequestHeadersCreateReques func (client *ApplicationGatewaysClient) listAvailableRequestHeadersHandleResponse(resp *http.Response) (ApplicationGatewaysListAvailableRequestHeadersResponse, error) { result := ApplicationGatewaysListAvailableRequestHeadersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringArray); err != nil { - return ApplicationGatewaysListAvailableRequestHeadersResponse{}, err + return ApplicationGatewaysListAvailableRequestHeadersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -671,7 +678,7 @@ func (client *ApplicationGatewaysClient) listAvailableResponseHeadersCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -681,7 +688,7 @@ func (client *ApplicationGatewaysClient) listAvailableResponseHeadersCreateReque func (client *ApplicationGatewaysClient) listAvailableResponseHeadersHandleResponse(resp *http.Response) (ApplicationGatewaysListAvailableResponseHeadersResponse, error) { result := ApplicationGatewaysListAvailableResponseHeadersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringArray); err != nil { - return ApplicationGatewaysListAvailableResponseHeadersResponse{}, err + return ApplicationGatewaysListAvailableResponseHeadersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -728,7 +735,7 @@ func (client *ApplicationGatewaysClient) listAvailableSSLOptionsCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -738,7 +745,7 @@ func (client *ApplicationGatewaysClient) listAvailableSSLOptionsCreateRequest(ct func (client *ApplicationGatewaysClient) listAvailableSSLOptionsHandleResponse(resp *http.Response) (ApplicationGatewaysListAvailableSSLOptionsResponse, error) { result := ApplicationGatewaysListAvailableSSLOptionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayAvailableSSLOptions); err != nil { - return ApplicationGatewaysListAvailableSSLOptionsResponse{}, err + return ApplicationGatewaysListAvailableSSLOptionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -782,7 +789,7 @@ func (client *ApplicationGatewaysClient) listAvailableSSLPredefinedPoliciesCreat return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -792,7 +799,7 @@ func (client *ApplicationGatewaysClient) listAvailableSSLPredefinedPoliciesCreat func (client *ApplicationGatewaysClient) listAvailableSSLPredefinedPoliciesHandleResponse(resp *http.Response) (ApplicationGatewaysListAvailableSSLPredefinedPoliciesResponse, error) { result := ApplicationGatewaysListAvailableSSLPredefinedPoliciesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayAvailableSSLPredefinedPolicies); err != nil { - return ApplicationGatewaysListAvailableSSLPredefinedPoliciesResponse{}, err + return ApplicationGatewaysListAvailableSSLPredefinedPoliciesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -839,7 +846,7 @@ func (client *ApplicationGatewaysClient) listAvailableServerVariablesCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -849,7 +856,7 @@ func (client *ApplicationGatewaysClient) listAvailableServerVariablesCreateReque func (client *ApplicationGatewaysClient) listAvailableServerVariablesHandleResponse(resp *http.Response) (ApplicationGatewaysListAvailableServerVariablesResponse, error) { result := ApplicationGatewaysListAvailableServerVariablesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringArray); err != nil { - return ApplicationGatewaysListAvailableServerVariablesResponse{}, err + return ApplicationGatewaysListAvailableServerVariablesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -896,7 +903,7 @@ func (client *ApplicationGatewaysClient) listAvailableWafRuleSetsCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -906,7 +913,7 @@ func (client *ApplicationGatewaysClient) listAvailableWafRuleSetsCreateRequest(c func (client *ApplicationGatewaysClient) listAvailableWafRuleSetsHandleResponse(resp *http.Response) (ApplicationGatewaysListAvailableWafRuleSetsResponse, error) { result := ApplicationGatewaysListAvailableWafRuleSetsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGatewayAvailableWafRuleSetsResult); err != nil { - return ApplicationGatewaysListAvailableWafRuleSetsResponse{}, err + return ApplicationGatewaysListAvailableWafRuleSetsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -981,7 +988,7 @@ func (client *ApplicationGatewaysClient) startCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1057,7 +1064,7 @@ func (client *ApplicationGatewaysClient) stopCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1113,7 +1120,7 @@ func (client *ApplicationGatewaysClient) updateTagsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -1123,7 +1130,7 @@ func (client *ApplicationGatewaysClient) updateTagsCreateRequest(ctx context.Con func (client *ApplicationGatewaysClient) updateTagsHandleResponse(resp *http.Response) (ApplicationGatewaysUpdateTagsResponse, error) { result := ApplicationGatewaysUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationGateway); err != nil { - return ApplicationGatewaysUpdateTagsResponse{}, err + return ApplicationGatewaysUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_applicationsecuritygroups_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_applicationsecuritygroups_client.go index dbc1dd4d2ced..cc35506bfe64 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_applicationsecuritygroups_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_applicationsecuritygroups_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ApplicationSecurityGroupsClient contains the methods for the ApplicationSecurityGroups group. @@ -31,8 +31,15 @@ type ApplicationSecurityGroupsClient struct { } // NewApplicationSecurityGroupsClient creates a new instance of ApplicationSecurityGroupsClient with the specified values. -func NewApplicationSecurityGroupsClient(con *arm.Connection, subscriptionID string) *ApplicationSecurityGroupsClient { - return &ApplicationSecurityGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewApplicationSecurityGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ApplicationSecurityGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ApplicationSecurityGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates an application security group. @@ -92,7 +99,7 @@ func (client *ApplicationSecurityGroupsClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *ApplicationSecurityGroupsClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *ApplicationSecurityGroupsClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +241,7 @@ func (client *ApplicationSecurityGroupsClient) getCreateRequest(ctx context.Cont func (client *ApplicationSecurityGroupsClient) getHandleResponse(resp *http.Response) (ApplicationSecurityGroupsGetResponse, error) { result := ApplicationSecurityGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationSecurityGroup); err != nil { - return ApplicationSecurityGroupsGetResponse{}, err + return ApplicationSecurityGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -282,7 +289,7 @@ func (client *ApplicationSecurityGroupsClient) listCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -292,7 +299,7 @@ func (client *ApplicationSecurityGroupsClient) listCreateRequest(ctx context.Con func (client *ApplicationSecurityGroupsClient) listHandleResponse(resp *http.Response) (ApplicationSecurityGroupsListResponse, error) { result := ApplicationSecurityGroupsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationSecurityGroupListResult); err != nil { - return ApplicationSecurityGroupsListResponse{}, err + return ApplicationSecurityGroupsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -336,7 +343,7 @@ func (client *ApplicationSecurityGroupsClient) listAllCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -346,7 +353,7 @@ func (client *ApplicationSecurityGroupsClient) listAllCreateRequest(ctx context. func (client *ApplicationSecurityGroupsClient) listAllHandleResponse(resp *http.Response) (ApplicationSecurityGroupsListAllResponse, error) { result := ApplicationSecurityGroupsListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationSecurityGroupListResult); err != nil { - return ApplicationSecurityGroupsListAllResponse{}, err + return ApplicationSecurityGroupsListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -401,7 +408,7 @@ func (client *ApplicationSecurityGroupsClient) updateTagsCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -411,7 +418,7 @@ func (client *ApplicationSecurityGroupsClient) updateTagsCreateRequest(ctx conte func (client *ApplicationSecurityGroupsClient) updateTagsHandleResponse(resp *http.Response) (ApplicationSecurityGroupsUpdateTagsResponse, error) { result := ApplicationSecurityGroupsUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationSecurityGroup); err != nil { - return ApplicationSecurityGroupsUpdateTagsResponse{}, err + return ApplicationSecurityGroupsUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_availabledelegations_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_availabledelegations_client.go index c8810914421b..e8a5d27c15a6 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_availabledelegations_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_availabledelegations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AvailableDelegationsClient contains the methods for the AvailableDelegations group. @@ -30,8 +31,15 @@ type AvailableDelegationsClient struct { } // NewAvailableDelegationsClient creates a new instance of AvailableDelegationsClient with the specified values. -func NewAvailableDelegationsClient(con *arm.Connection, subscriptionID string) *AvailableDelegationsClient { - return &AvailableDelegationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAvailableDelegationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AvailableDelegationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AvailableDelegationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets all of the available subnet delegations for this subscription in this region. @@ -64,7 +72,7 @@ func (client *AvailableDelegationsClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -74,7 +82,7 @@ func (client *AvailableDelegationsClient) listCreateRequest(ctx context.Context, func (client *AvailableDelegationsClient) listHandleResponse(resp *http.Response) (AvailableDelegationsListResponse, error) { result := AvailableDelegationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailableDelegationsResult); err != nil { - return AvailableDelegationsListResponse{}, err + return AvailableDelegationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_availableendpointservices_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_availableendpointservices_client.go index 5a4cfec6e77d..565a02055f80 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_availableendpointservices_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_availableendpointservices_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AvailableEndpointServicesClient contains the methods for the AvailableEndpointServices group. @@ -30,8 +31,15 @@ type AvailableEndpointServicesClient struct { } // NewAvailableEndpointServicesClient creates a new instance of AvailableEndpointServicesClient with the specified values. -func NewAvailableEndpointServicesClient(con *arm.Connection, subscriptionID string) *AvailableEndpointServicesClient { - return &AvailableEndpointServicesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAvailableEndpointServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AvailableEndpointServicesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AvailableEndpointServicesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - List what values of endpoint services are available for use. @@ -64,7 +72,7 @@ func (client *AvailableEndpointServicesClient) listCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -74,7 +82,7 @@ func (client *AvailableEndpointServicesClient) listCreateRequest(ctx context.Con func (client *AvailableEndpointServicesClient) listHandleResponse(resp *http.Response) (AvailableEndpointServicesListResponse, error) { result := AvailableEndpointServicesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EndpointServicesListResult); err != nil { - return AvailableEndpointServicesListResponse{}, err + return AvailableEndpointServicesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_availableprivateendpointtypes_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_availableprivateendpointtypes_client.go index 02b244f3d6f2..91ecc227d350 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_availableprivateendpointtypes_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_availableprivateendpointtypes_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AvailablePrivateEndpointTypesClient contains the methods for the AvailablePrivateEndpointTypes group. @@ -30,8 +31,15 @@ type AvailablePrivateEndpointTypesClient struct { } // NewAvailablePrivateEndpointTypesClient creates a new instance of AvailablePrivateEndpointTypesClient with the specified values. -func NewAvailablePrivateEndpointTypesClient(con *arm.Connection, subscriptionID string) *AvailablePrivateEndpointTypesClient { - return &AvailablePrivateEndpointTypesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAvailablePrivateEndpointTypesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AvailablePrivateEndpointTypesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AvailablePrivateEndpointTypesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Returns all of the resource types that can be linked to a Private Endpoint in this subscription in this region. @@ -64,7 +72,7 @@ func (client *AvailablePrivateEndpointTypesClient) listCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -74,7 +82,7 @@ func (client *AvailablePrivateEndpointTypesClient) listCreateRequest(ctx context func (client *AvailablePrivateEndpointTypesClient) listHandleResponse(resp *http.Response) (AvailablePrivateEndpointTypesListResponse, error) { result := AvailablePrivateEndpointTypesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailablePrivateEndpointTypesResult); err != nil { - return AvailablePrivateEndpointTypesListResponse{}, err + return AvailablePrivateEndpointTypesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -126,7 +134,7 @@ func (client *AvailablePrivateEndpointTypesClient) listByResourceGroupCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -136,7 +144,7 @@ func (client *AvailablePrivateEndpointTypesClient) listByResourceGroupCreateRequ func (client *AvailablePrivateEndpointTypesClient) listByResourceGroupHandleResponse(resp *http.Response) (AvailablePrivateEndpointTypesListByResourceGroupResponse, error) { result := AvailablePrivateEndpointTypesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailablePrivateEndpointTypesResult); err != nil { - return AvailablePrivateEndpointTypesListByResourceGroupResponse{}, err + return AvailablePrivateEndpointTypesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_availableresourcegroupdelegations_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_availableresourcegroupdelegations_client.go index a80cd127942d..8b19ddefbeae 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_availableresourcegroupdelegations_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_availableresourcegroupdelegations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AvailableResourceGroupDelegationsClient contains the methods for the AvailableResourceGroupDelegations group. @@ -30,8 +31,15 @@ type AvailableResourceGroupDelegationsClient struct { } // NewAvailableResourceGroupDelegationsClient creates a new instance of AvailableResourceGroupDelegationsClient with the specified values. -func NewAvailableResourceGroupDelegationsClient(con *arm.Connection, subscriptionID string) *AvailableResourceGroupDelegationsClient { - return &AvailableResourceGroupDelegationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAvailableResourceGroupDelegationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AvailableResourceGroupDelegationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AvailableResourceGroupDelegationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets all of the available subnet delegations for this resource group in this region. @@ -68,7 +76,7 @@ func (client *AvailableResourceGroupDelegationsClient) listCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -78,7 +86,7 @@ func (client *AvailableResourceGroupDelegationsClient) listCreateRequest(ctx con func (client *AvailableResourceGroupDelegationsClient) listHandleResponse(resp *http.Response) (AvailableResourceGroupDelegationsListResponse, error) { result := AvailableResourceGroupDelegationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailableDelegationsResult); err != nil { - return AvailableResourceGroupDelegationsListResponse{}, err + return AvailableResourceGroupDelegationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_availableservicealiases_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_availableservicealiases_client.go index d7de320fc65e..53c2c67be509 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_availableservicealiases_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_availableservicealiases_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AvailableServiceAliasesClient contains the methods for the AvailableServiceAliases group. @@ -30,8 +31,15 @@ type AvailableServiceAliasesClient struct { } // NewAvailableServiceAliasesClient creates a new instance of AvailableServiceAliasesClient with the specified values. -func NewAvailableServiceAliasesClient(con *arm.Connection, subscriptionID string) *AvailableServiceAliasesClient { - return &AvailableServiceAliasesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAvailableServiceAliasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AvailableServiceAliasesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AvailableServiceAliasesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets all available service aliases for this subscription in this region. @@ -64,7 +72,7 @@ func (client *AvailableServiceAliasesClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -74,7 +82,7 @@ func (client *AvailableServiceAliasesClient) listCreateRequest(ctx context.Conte func (client *AvailableServiceAliasesClient) listHandleResponse(resp *http.Response) (AvailableServiceAliasesListResponse, error) { result := AvailableServiceAliasesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailableServiceAliasesResult); err != nil { - return AvailableServiceAliasesListResponse{}, err + return AvailableServiceAliasesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -126,7 +134,7 @@ func (client *AvailableServiceAliasesClient) listByResourceGroupCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -136,7 +144,7 @@ func (client *AvailableServiceAliasesClient) listByResourceGroupCreateRequest(ct func (client *AvailableServiceAliasesClient) listByResourceGroupHandleResponse(resp *http.Response) (AvailableServiceAliasesListByResourceGroupResponse, error) { result := AvailableServiceAliasesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailableServiceAliasesResult); err != nil { - return AvailableServiceAliasesListByResourceGroupResponse{}, err + return AvailableServiceAliasesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_azurefirewallfqdntags_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_azurefirewallfqdntags_client.go index b1bfd534db32..a82ee371e570 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_azurefirewallfqdntags_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_azurefirewallfqdntags_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AzureFirewallFqdnTagsClient contains the methods for the AzureFirewallFqdnTags group. @@ -30,8 +31,15 @@ type AzureFirewallFqdnTagsClient struct { } // NewAzureFirewallFqdnTagsClient creates a new instance of AzureFirewallFqdnTagsClient with the specified values. -func NewAzureFirewallFqdnTagsClient(con *arm.Connection, subscriptionID string) *AzureFirewallFqdnTagsClient { - return &AzureFirewallFqdnTagsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAzureFirewallFqdnTagsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AzureFirewallFqdnTagsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AzureFirewallFqdnTagsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListAll - Gets all the Azure Firewall FQDN Tags in a subscription. @@ -60,7 +68,7 @@ func (client *AzureFirewallFqdnTagsClient) listAllCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -70,7 +78,7 @@ func (client *AzureFirewallFqdnTagsClient) listAllCreateRequest(ctx context.Cont func (client *AzureFirewallFqdnTagsClient) listAllHandleResponse(resp *http.Response) (AzureFirewallFqdnTagsListAllResponse, error) { result := AzureFirewallFqdnTagsListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AzureFirewallFqdnTagListResult); err != nil { - return AzureFirewallFqdnTagsListAllResponse{}, err + return AzureFirewallFqdnTagsListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_azurefirewalls_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_azurefirewalls_client.go index 688ba6054e4c..090c91bfb564 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_azurefirewalls_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_azurefirewalls_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AzureFirewallsClient contains the methods for the AzureFirewalls group. @@ -31,8 +31,15 @@ type AzureFirewallsClient struct { } // NewAzureFirewallsClient creates a new instance of AzureFirewallsClient with the specified values. -func NewAzureFirewallsClient(con *arm.Connection, subscriptionID string) *AzureFirewallsClient { - return &AzureFirewallsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAzureFirewallsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AzureFirewallsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AzureFirewallsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates the specified Azure Firewall. @@ -92,7 +99,7 @@ func (client *AzureFirewallsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *AzureFirewallsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *AzureFirewallsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +241,7 @@ func (client *AzureFirewallsClient) getCreateRequest(ctx context.Context, resour func (client *AzureFirewallsClient) getHandleResponse(resp *http.Response) (AzureFirewallsGetResponse, error) { result := AzureFirewallsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AzureFirewall); err != nil { - return AzureFirewallsGetResponse{}, err + return AzureFirewallsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -282,7 +289,7 @@ func (client *AzureFirewallsClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -292,7 +299,7 @@ func (client *AzureFirewallsClient) listCreateRequest(ctx context.Context, resou func (client *AzureFirewallsClient) listHandleResponse(resp *http.Response) (AzureFirewallsListResponse, error) { result := AzureFirewallsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AzureFirewallListResult); err != nil { - return AzureFirewallsListResponse{}, err + return AzureFirewallsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -336,7 +343,7 @@ func (client *AzureFirewallsClient) listAllCreateRequest(ctx context.Context, op return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -346,7 +353,7 @@ func (client *AzureFirewallsClient) listAllCreateRequest(ctx context.Context, op func (client *AzureFirewallsClient) listAllHandleResponse(resp *http.Response) (AzureFirewallsListAllResponse, error) { result := AzureFirewallsListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AzureFirewallListResult); err != nil { - return AzureFirewallsListAllResponse{}, err + return AzureFirewallsListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -421,7 +428,7 @@ func (client *AzureFirewallsClient) updateTagsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_bastionhosts_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_bastionhosts_client.go index ba0d4c4e8987..0981421862fa 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_bastionhosts_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_bastionhosts_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // BastionHostsClient contains the methods for the BastionHosts group. @@ -31,8 +31,15 @@ type BastionHostsClient struct { } // NewBastionHostsClient creates a new instance of BastionHostsClient with the specified values. -func NewBastionHostsClient(con *arm.Connection, subscriptionID string) *BastionHostsClient { - return &BastionHostsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewBastionHostsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *BastionHostsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &BastionHostsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates the specified Bastion Host. @@ -92,7 +99,7 @@ func (client *BastionHostsClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *BastionHostsClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *BastionHostsClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +241,7 @@ func (client *BastionHostsClient) getCreateRequest(ctx context.Context, resource func (client *BastionHostsClient) getHandleResponse(resp *http.Response) (BastionHostsGetResponse, error) { result := BastionHostsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BastionHost); err != nil { - return BastionHostsGetResponse{}, err + return BastionHostsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -278,7 +285,7 @@ func (client *BastionHostsClient) listCreateRequest(ctx context.Context, options return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -288,7 +295,7 @@ func (client *BastionHostsClient) listCreateRequest(ctx context.Context, options func (client *BastionHostsClient) listHandleResponse(resp *http.Response) (BastionHostsListResponse, error) { result := BastionHostsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BastionHostListResult); err != nil { - return BastionHostsListResponse{}, err + return BastionHostsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -336,7 +343,7 @@ func (client *BastionHostsClient) listByResourceGroupCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -346,7 +353,7 @@ func (client *BastionHostsClient) listByResourceGroupCreateRequest(ctx context.C func (client *BastionHostsClient) listByResourceGroupHandleResponse(resp *http.Response) (BastionHostsListByResourceGroupResponse, error) { result := BastionHostsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BastionHostListResult); err != nil { - return BastionHostsListByResourceGroupResponse{}, err + return BastionHostsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -421,7 +428,7 @@ func (client *BastionHostsClient) updateTagsCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_bgpservicecommunities_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_bgpservicecommunities_client.go index 0ee848a901da..e43364a32ab0 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_bgpservicecommunities_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_bgpservicecommunities_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // BgpServiceCommunitiesClient contains the methods for the BgpServiceCommunities group. @@ -30,8 +31,15 @@ type BgpServiceCommunitiesClient struct { } // NewBgpServiceCommunitiesClient creates a new instance of BgpServiceCommunitiesClient with the specified values. -func NewBgpServiceCommunitiesClient(con *arm.Connection, subscriptionID string) *BgpServiceCommunitiesClient { - return &BgpServiceCommunitiesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewBgpServiceCommunitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *BgpServiceCommunitiesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &BgpServiceCommunitiesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets all the available bgp service communities. @@ -60,7 +68,7 @@ func (client *BgpServiceCommunitiesClient) listCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -70,7 +78,7 @@ func (client *BgpServiceCommunitiesClient) listCreateRequest(ctx context.Context func (client *BgpServiceCommunitiesClient) listHandleResponse(resp *http.Response) (BgpServiceCommunitiesListResponse, error) { result := BgpServiceCommunitiesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BgpServiceCommunityListResult); err != nil { - return BgpServiceCommunitiesListResponse{}, err + return BgpServiceCommunitiesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_connectionmonitors_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_connectionmonitors_client.go index 38f12aa01879..f97599d5067b 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_connectionmonitors_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_connectionmonitors_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ConnectionMonitorsClient contains the methods for the ConnectionMonitors group. @@ -31,8 +31,15 @@ type ConnectionMonitorsClient struct { } // NewConnectionMonitorsClient creates a new instance of ConnectionMonitorsClient with the specified values. -func NewConnectionMonitorsClient(con *arm.Connection, subscriptionID string) *ConnectionMonitorsClient { - return &ConnectionMonitorsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewConnectionMonitorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ConnectionMonitorsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ConnectionMonitorsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update a connection monitor. @@ -96,7 +103,7 @@ func (client *ConnectionMonitorsClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Migrate != nil { reqQP.Set("migrate", *options.Migrate) } @@ -179,7 +186,7 @@ func (client *ConnectionMonitorsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -239,7 +246,7 @@ func (client *ConnectionMonitorsClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -249,7 +256,7 @@ func (client *ConnectionMonitorsClient) getCreateRequest(ctx context.Context, re func (client *ConnectionMonitorsClient) getHandleResponse(resp *http.Response) (ConnectionMonitorsGetResponse, error) { result := ConnectionMonitorsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionMonitorResult); err != nil { - return ConnectionMonitorsGetResponse{}, err + return ConnectionMonitorsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -304,7 +311,7 @@ func (client *ConnectionMonitorsClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -314,7 +321,7 @@ func (client *ConnectionMonitorsClient) listCreateRequest(ctx context.Context, r func (client *ConnectionMonitorsClient) listHandleResponse(resp *http.Response) (ConnectionMonitorsListResponse, error) { result := ConnectionMonitorsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionMonitorListResult); err != nil { - return ConnectionMonitorsListResponse{}, err + return ConnectionMonitorsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -393,7 +400,7 @@ func (client *ConnectionMonitorsClient) queryCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -473,7 +480,7 @@ func (client *ConnectionMonitorsClient) startCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -553,7 +560,7 @@ func (client *ConnectionMonitorsClient) stopCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -613,7 +620,7 @@ func (client *ConnectionMonitorsClient) updateTagsCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -623,7 +630,7 @@ func (client *ConnectionMonitorsClient) updateTagsCreateRequest(ctx context.Cont func (client *ConnectionMonitorsClient) updateTagsHandleResponse(resp *http.Response) (ConnectionMonitorsUpdateTagsResponse, error) { result := ConnectionMonitorsUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionMonitorResult); err != nil { - return ConnectionMonitorsUpdateTagsResponse{}, err + return ConnectionMonitorsUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_constants.go b/sdk/resourcemanager/network/armnetwork/zz_generated_constants.go index 18f713d3f3d0..7b0f4d65f879 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_constants.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_constants.go @@ -10,7 +10,7 @@ package armnetwork const ( module = "armnetwork" - version = "v0.1.0" + version = "v0.2.0" ) // Access - Access to be allowed or denied. @@ -613,6 +613,7 @@ func (c AzureFirewallSKUName) ToPtr() *AzureFirewallSKUName { type AzureFirewallSKUTier string const ( + AzureFirewallSKUTierBasic AzureFirewallSKUTier = "Basic" AzureFirewallSKUTierPremium AzureFirewallSKUTier = "Premium" AzureFirewallSKUTierStandard AzureFirewallSKUTier = "Standard" ) @@ -620,6 +621,7 @@ const ( // PossibleAzureFirewallSKUTierValues returns the possible values for the AzureFirewallSKUTier const type. func PossibleAzureFirewallSKUTierValues() []AzureFirewallSKUTier { return []AzureFirewallSKUTier{ + AzureFirewallSKUTierBasic, AzureFirewallSKUTierPremium, AzureFirewallSKUTierStandard, } @@ -1690,6 +1692,7 @@ func (c FirewallPolicyRuleType) ToPtr() *FirewallPolicyRuleType { type FirewallPolicySKUTier string const ( + FirewallPolicySKUTierBasic FirewallPolicySKUTier = "Basic" FirewallPolicySKUTierPremium FirewallPolicySKUTier = "Premium" FirewallPolicySKUTierStandard FirewallPolicySKUTier = "Standard" ) @@ -1697,6 +1700,7 @@ const ( // PossibleFirewallPolicySKUTierValues returns the possible values for the FirewallPolicySKUTier const type. func PossibleFirewallPolicySKUTierValues() []FirewallPolicySKUTier { return []FirewallPolicySKUTier{ + FirewallPolicySKUTierBasic, FirewallPolicySKUTierPremium, FirewallPolicySKUTierStandard, } @@ -2379,6 +2383,27 @@ func (c OfficeTrafficCategory) ToPtr() *OfficeTrafficCategory { return &c } +// OrderByOrder - Describes if results should be in ascending/descending order +type OrderByOrder string + +const ( + OrderByOrderAscending OrderByOrder = "Ascending" + OrderByOrderDescending OrderByOrder = "Descending" +) + +// PossibleOrderByOrderValues returns the possible values for the OrderByOrder const type. +func PossibleOrderByOrderValues() []OrderByOrder { + return []OrderByOrder{ + OrderByOrderAscending, + OrderByOrderDescending, + } +} + +// ToPtr returns a *OrderByOrder pointing to the current value. +func (c OrderByOrder) ToPtr() *OrderByOrder { + return &c +} + // Origin - The origin of the issue. type Origin string @@ -2425,17 +2450,29 @@ func (c OutputType) ToPtr() *OutputType { type OwaspCrsExclusionEntryMatchVariable string const ( - OwaspCrsExclusionEntryMatchVariableRequestArgNames OwaspCrsExclusionEntryMatchVariable = "RequestArgNames" - OwaspCrsExclusionEntryMatchVariableRequestCookieNames OwaspCrsExclusionEntryMatchVariable = "RequestCookieNames" - OwaspCrsExclusionEntryMatchVariableRequestHeaderNames OwaspCrsExclusionEntryMatchVariable = "RequestHeaderNames" + OwaspCrsExclusionEntryMatchVariableRequestArgKeys OwaspCrsExclusionEntryMatchVariable = "RequestArgKeys" + OwaspCrsExclusionEntryMatchVariableRequestArgNames OwaspCrsExclusionEntryMatchVariable = "RequestArgNames" + OwaspCrsExclusionEntryMatchVariableRequestArgValues OwaspCrsExclusionEntryMatchVariable = "RequestArgValues" + OwaspCrsExclusionEntryMatchVariableRequestCookieKeys OwaspCrsExclusionEntryMatchVariable = "RequestCookieKeys" + OwaspCrsExclusionEntryMatchVariableRequestCookieNames OwaspCrsExclusionEntryMatchVariable = "RequestCookieNames" + OwaspCrsExclusionEntryMatchVariableRequestCookieValues OwaspCrsExclusionEntryMatchVariable = "RequestCookieValues" + OwaspCrsExclusionEntryMatchVariableRequestHeaderKeys OwaspCrsExclusionEntryMatchVariable = "RequestHeaderKeys" + OwaspCrsExclusionEntryMatchVariableRequestHeaderNames OwaspCrsExclusionEntryMatchVariable = "RequestHeaderNames" + OwaspCrsExclusionEntryMatchVariableRequestHeaderValues OwaspCrsExclusionEntryMatchVariable = "RequestHeaderValues" ) // PossibleOwaspCrsExclusionEntryMatchVariableValues returns the possible values for the OwaspCrsExclusionEntryMatchVariable const type. func PossibleOwaspCrsExclusionEntryMatchVariableValues() []OwaspCrsExclusionEntryMatchVariable { return []OwaspCrsExclusionEntryMatchVariable{ + OwaspCrsExclusionEntryMatchVariableRequestArgKeys, OwaspCrsExclusionEntryMatchVariableRequestArgNames, + OwaspCrsExclusionEntryMatchVariableRequestArgValues, + OwaspCrsExclusionEntryMatchVariableRequestCookieKeys, OwaspCrsExclusionEntryMatchVariableRequestCookieNames, + OwaspCrsExclusionEntryMatchVariableRequestCookieValues, + OwaspCrsExclusionEntryMatchVariableRequestHeaderKeys, OwaspCrsExclusionEntryMatchVariableRequestHeaderNames, + OwaspCrsExclusionEntryMatchVariableRequestHeaderValues, } } @@ -3131,6 +3168,75 @@ func (c Severity) ToPtr() *Severity { return &c } +// SingleQueryResultDirection - Describes in which direction signature is being enforced: 0 - Inbound, 1 - OutBound, 2 - Bidirectional +type SingleQueryResultDirection int32 + +const ( + SingleQueryResultDirectionOne SingleQueryResultDirection = 1 + SingleQueryResultDirectionTwo SingleQueryResultDirection = 2 + SingleQueryResultDirectionZero SingleQueryResultDirection = 0 +) + +// PossibleSingleQueryResultDirectionValues returns the possible values for the SingleQueryResultDirection const type. +func PossibleSingleQueryResultDirectionValues() []SingleQueryResultDirection { + return []SingleQueryResultDirection{ + SingleQueryResultDirectionOne, + SingleQueryResultDirectionTwo, + SingleQueryResultDirectionZero, + } +} + +// ToPtr returns a *SingleQueryResultDirection pointing to the current value. +func (c SingleQueryResultDirection) ToPtr() *SingleQueryResultDirection { + return &c +} + +// SingleQueryResultMode - The current mode enforced, 0 - Disabled, 1 - Alert, 2 -Deny +type SingleQueryResultMode int32 + +const ( + SingleQueryResultModeOne SingleQueryResultMode = 1 + SingleQueryResultModeTwo SingleQueryResultMode = 2 + SingleQueryResultModeZero SingleQueryResultMode = 0 +) + +// PossibleSingleQueryResultModeValues returns the possible values for the SingleQueryResultMode const type. +func PossibleSingleQueryResultModeValues() []SingleQueryResultMode { + return []SingleQueryResultMode{ + SingleQueryResultModeOne, + SingleQueryResultModeTwo, + SingleQueryResultModeZero, + } +} + +// ToPtr returns a *SingleQueryResultMode pointing to the current value. +func (c SingleQueryResultMode) ToPtr() *SingleQueryResultMode { + return &c +} + +// SingleQueryResultSeverity - Describes the severity of signature: 1 - Low, 2 - Medium, 3 - High +type SingleQueryResultSeverity int32 + +const ( + SingleQueryResultSeverityOne SingleQueryResultSeverity = 1 + SingleQueryResultSeverityThree SingleQueryResultSeverity = 3 + SingleQueryResultSeverityTwo SingleQueryResultSeverity = 2 +) + +// PossibleSingleQueryResultSeverityValues returns the possible values for the SingleQueryResultSeverity const type. +func PossibleSingleQueryResultSeverityValues() []SingleQueryResultSeverity { + return []SingleQueryResultSeverity{ + SingleQueryResultSeverityOne, + SingleQueryResultSeverityThree, + SingleQueryResultSeverityTwo, + } +} + +// ToPtr returns a *SingleQueryResultSeverity pointing to the current value. +func (c SingleQueryResultSeverity) ToPtr() *SingleQueryResultSeverity { + return &c +} + type SyncRemoteAddressSpace string const ( @@ -3440,6 +3546,27 @@ func (c VerbosityLevel) ToPtr() *VerbosityLevel { return &c } +// VirtualNetworkEncryptionEnforcement - If the encrypted VNet allows VM that does not support encryption +type VirtualNetworkEncryptionEnforcement string + +const ( + VirtualNetworkEncryptionEnforcementAllowUnencrypted VirtualNetworkEncryptionEnforcement = "AllowUnencrypted" + VirtualNetworkEncryptionEnforcementDropUnencrypted VirtualNetworkEncryptionEnforcement = "DropUnencrypted" +) + +// PossibleVirtualNetworkEncryptionEnforcementValues returns the possible values for the VirtualNetworkEncryptionEnforcement const type. +func PossibleVirtualNetworkEncryptionEnforcementValues() []VirtualNetworkEncryptionEnforcement { + return []VirtualNetworkEncryptionEnforcement{ + VirtualNetworkEncryptionEnforcementAllowUnencrypted, + VirtualNetworkEncryptionEnforcementDropUnencrypted, + } +} + +// ToPtr returns a *VirtualNetworkEncryptionEnforcement pointing to the current value. +func (c VirtualNetworkEncryptionEnforcement) ToPtr() *VirtualNetworkEncryptionEnforcement { + return &c +} + // VirtualNetworkGatewayConnectionMode - Gateway connection type. type VirtualNetworkGatewayConnectionMode string diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_customipprefixes_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_customipprefixes_client.go index dbad92bb23f0..17cac540680a 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_customipprefixes_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_customipprefixes_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CustomIPPrefixesClient contains the methods for the CustomIPPrefixes group. @@ -31,8 +31,15 @@ type CustomIPPrefixesClient struct { } // NewCustomIPPrefixesClient creates a new instance of CustomIPPrefixesClient with the specified values. -func NewCustomIPPrefixesClient(con *arm.Connection, subscriptionID string) *CustomIPPrefixesClient { - return &CustomIPPrefixesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCustomIPPrefixesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CustomIPPrefixesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CustomIPPrefixesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a custom IP prefix. @@ -92,7 +99,7 @@ func (client *CustomIPPrefixesClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *CustomIPPrefixesClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *CustomIPPrefixesClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -237,7 +244,7 @@ func (client *CustomIPPrefixesClient) getCreateRequest(ctx context.Context, reso func (client *CustomIPPrefixesClient) getHandleResponse(resp *http.Response) (CustomIPPrefixesGetResponse, error) { result := CustomIPPrefixesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CustomIPPrefix); err != nil { - return CustomIPPrefixesGetResponse{}, err + return CustomIPPrefixesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -285,7 +292,7 @@ func (client *CustomIPPrefixesClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -295,7 +302,7 @@ func (client *CustomIPPrefixesClient) listCreateRequest(ctx context.Context, res func (client *CustomIPPrefixesClient) listHandleResponse(resp *http.Response) (CustomIPPrefixesListResponse, error) { result := CustomIPPrefixesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CustomIPPrefixListResult); err != nil { - return CustomIPPrefixesListResponse{}, err + return CustomIPPrefixesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -339,7 +346,7 @@ func (client *CustomIPPrefixesClient) listAllCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -349,7 +356,7 @@ func (client *CustomIPPrefixesClient) listAllCreateRequest(ctx context.Context, func (client *CustomIPPrefixesClient) listAllHandleResponse(resp *http.Response) (CustomIPPrefixesListAllResponse, error) { result := CustomIPPrefixesListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CustomIPPrefixListResult); err != nil { - return CustomIPPrefixesListAllResponse{}, err + return CustomIPPrefixesListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -404,7 +411,7 @@ func (client *CustomIPPrefixesClient) updateTagsCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -414,7 +421,7 @@ func (client *CustomIPPrefixesClient) updateTagsCreateRequest(ctx context.Contex func (client *CustomIPPrefixesClient) updateTagsHandleResponse(resp *http.Response) (CustomIPPrefixesUpdateTagsResponse, error) { result := CustomIPPrefixesUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CustomIPPrefix); err != nil { - return CustomIPPrefixesUpdateTagsResponse{}, err + return CustomIPPrefixesUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_ddoscustompolicies_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_ddoscustompolicies_client.go index 4ca7ab10b1ef..c8d31f2e7d3b 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_ddoscustompolicies_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_ddoscustompolicies_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DdosCustomPoliciesClient contains the methods for the DdosCustomPolicies group. @@ -31,8 +31,15 @@ type DdosCustomPoliciesClient struct { } // NewDdosCustomPoliciesClient creates a new instance of DdosCustomPoliciesClient with the specified values. -func NewDdosCustomPoliciesClient(con *arm.Connection, subscriptionID string) *DdosCustomPoliciesClient { - return &DdosCustomPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDdosCustomPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DdosCustomPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DdosCustomPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a DDoS custom policy. @@ -92,7 +99,7 @@ func (client *DdosCustomPoliciesClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *DdosCustomPoliciesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *DdosCustomPoliciesClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +241,7 @@ func (client *DdosCustomPoliciesClient) getCreateRequest(ctx context.Context, re func (client *DdosCustomPoliciesClient) getHandleResponse(resp *http.Response) (DdosCustomPoliciesGetResponse, error) { result := DdosCustomPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DdosCustomPolicy); err != nil { - return DdosCustomPoliciesGetResponse{}, err + return DdosCustomPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -289,7 +296,7 @@ func (client *DdosCustomPoliciesClient) updateTagsCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -299,7 +306,7 @@ func (client *DdosCustomPoliciesClient) updateTagsCreateRequest(ctx context.Cont func (client *DdosCustomPoliciesClient) updateTagsHandleResponse(resp *http.Response) (DdosCustomPoliciesUpdateTagsResponse, error) { result := DdosCustomPoliciesUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DdosCustomPolicy); err != nil { - return DdosCustomPoliciesUpdateTagsResponse{}, err + return DdosCustomPoliciesUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_ddosprotectionplans_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_ddosprotectionplans_client.go index 211adaf37364..fc5dc3b34707 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_ddosprotectionplans_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_ddosprotectionplans_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DdosProtectionPlansClient contains the methods for the DdosProtectionPlans group. @@ -31,8 +31,15 @@ type DdosProtectionPlansClient struct { } // NewDdosProtectionPlansClient creates a new instance of DdosProtectionPlansClient with the specified values. -func NewDdosProtectionPlansClient(con *arm.Connection, subscriptionID string) *DdosProtectionPlansClient { - return &DdosProtectionPlansClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDdosProtectionPlansClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DdosProtectionPlansClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DdosProtectionPlansClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a DDoS protection plan. @@ -92,7 +99,7 @@ func (client *DdosProtectionPlansClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *DdosProtectionPlansClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *DdosProtectionPlansClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +241,7 @@ func (client *DdosProtectionPlansClient) getCreateRequest(ctx context.Context, r func (client *DdosProtectionPlansClient) getHandleResponse(resp *http.Response) (DdosProtectionPlansGetResponse, error) { result := DdosProtectionPlansGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DdosProtectionPlan); err != nil { - return DdosProtectionPlansGetResponse{}, err + return DdosProtectionPlansGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -278,7 +285,7 @@ func (client *DdosProtectionPlansClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -288,7 +295,7 @@ func (client *DdosProtectionPlansClient) listCreateRequest(ctx context.Context, func (client *DdosProtectionPlansClient) listHandleResponse(resp *http.Response) (DdosProtectionPlansListResponse, error) { result := DdosProtectionPlansListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DdosProtectionPlanListResult); err != nil { - return DdosProtectionPlansListResponse{}, err + return DdosProtectionPlansListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -336,7 +343,7 @@ func (client *DdosProtectionPlansClient) listByResourceGroupCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -346,7 +353,7 @@ func (client *DdosProtectionPlansClient) listByResourceGroupCreateRequest(ctx co func (client *DdosProtectionPlansClient) listByResourceGroupHandleResponse(resp *http.Response) (DdosProtectionPlansListByResourceGroupResponse, error) { result := DdosProtectionPlansListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DdosProtectionPlanListResult); err != nil { - return DdosProtectionPlansListByResourceGroupResponse{}, err + return DdosProtectionPlansListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -401,7 +408,7 @@ func (client *DdosProtectionPlansClient) updateTagsCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -411,7 +418,7 @@ func (client *DdosProtectionPlansClient) updateTagsCreateRequest(ctx context.Con func (client *DdosProtectionPlansClient) updateTagsHandleResponse(resp *http.Response) (DdosProtectionPlansUpdateTagsResponse, error) { result := DdosProtectionPlansUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DdosProtectionPlan); err != nil { - return DdosProtectionPlansUpdateTagsResponse{}, err + return DdosProtectionPlansUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_defaultsecurityrules_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_defaultsecurityrules_client.go index a2631cc07cfa..63b41a65f745 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_defaultsecurityrules_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_defaultsecurityrules_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DefaultSecurityRulesClient contains the methods for the DefaultSecurityRules group. @@ -30,8 +31,15 @@ type DefaultSecurityRulesClient struct { } // NewDefaultSecurityRulesClient creates a new instance of DefaultSecurityRulesClient with the specified values. -func NewDefaultSecurityRulesClient(con *arm.Connection, subscriptionID string) *DefaultSecurityRulesClient { - return &DefaultSecurityRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDefaultSecurityRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DefaultSecurityRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DefaultSecurityRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get the specified default network security rule. @@ -75,7 +83,7 @@ func (client *DefaultSecurityRulesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -85,7 +93,7 @@ func (client *DefaultSecurityRulesClient) getCreateRequest(ctx context.Context, func (client *DefaultSecurityRulesClient) getHandleResponse(resp *http.Response) (DefaultSecurityRulesGetResponse, error) { result := DefaultSecurityRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityRule); err != nil { - return DefaultSecurityRulesGetResponse{}, err + return DefaultSecurityRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -137,7 +145,7 @@ func (client *DefaultSecurityRulesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -147,7 +155,7 @@ func (client *DefaultSecurityRulesClient) listCreateRequest(ctx context.Context, func (client *DefaultSecurityRulesClient) listHandleResponse(resp *http.Response) (DefaultSecurityRulesListResponse, error) { result := DefaultSecurityRulesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityRuleListResult); err != nil { - return DefaultSecurityRulesListResponse{}, err + return DefaultSecurityRulesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_dscpconfiguration_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_dscpconfiguration_client.go index 991c12744aea..2e1570b2c662 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_dscpconfiguration_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_dscpconfiguration_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DscpConfigurationClient contains the methods for the DscpConfiguration group. @@ -31,8 +31,15 @@ type DscpConfigurationClient struct { } // NewDscpConfigurationClient creates a new instance of DscpConfigurationClient with the specified values. -func NewDscpConfigurationClient(con *arm.Connection, subscriptionID string) *DscpConfigurationClient { - return &DscpConfigurationClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDscpConfigurationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DscpConfigurationClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DscpConfigurationClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a DSCP Configuration. @@ -92,7 +99,7 @@ func (client *DscpConfigurationClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *DscpConfigurationClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *DscpConfigurationClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +241,7 @@ func (client *DscpConfigurationClient) getCreateRequest(ctx context.Context, res func (client *DscpConfigurationClient) getHandleResponse(resp *http.Response) (DscpConfigurationGetResponse, error) { result := DscpConfigurationGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DscpConfiguration); err != nil { - return DscpConfigurationGetResponse{}, err + return DscpConfigurationGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -282,7 +289,7 @@ func (client *DscpConfigurationClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -292,7 +299,7 @@ func (client *DscpConfigurationClient) listCreateRequest(ctx context.Context, re func (client *DscpConfigurationClient) listHandleResponse(resp *http.Response) (DscpConfigurationListResponse, error) { result := DscpConfigurationListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DscpConfigurationListResult); err != nil { - return DscpConfigurationListResponse{}, err + return DscpConfigurationListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -336,7 +343,7 @@ func (client *DscpConfigurationClient) listAllCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -346,7 +353,7 @@ func (client *DscpConfigurationClient) listAllCreateRequest(ctx context.Context, func (client *DscpConfigurationClient) listAllHandleResponse(resp *http.Response) (DscpConfigurationListAllResponse, error) { result := DscpConfigurationListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DscpConfigurationListResult); err != nil { - return DscpConfigurationListAllResponse{}, err + return DscpConfigurationListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecircuitauthorizations_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecircuitauthorizations_client.go index ee0bafbe3b98..5a1b77f04b0b 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecircuitauthorizations_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecircuitauthorizations_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ExpressRouteCircuitAuthorizationsClient contains the methods for the ExpressRouteCircuitAuthorizations group. @@ -31,8 +31,15 @@ type ExpressRouteCircuitAuthorizationsClient struct { } // NewExpressRouteCircuitAuthorizationsClient creates a new instance of ExpressRouteCircuitAuthorizationsClient with the specified values. -func NewExpressRouteCircuitAuthorizationsClient(con *arm.Connection, subscriptionID string) *ExpressRouteCircuitAuthorizationsClient { - return &ExpressRouteCircuitAuthorizationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewExpressRouteCircuitAuthorizationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExpressRouteCircuitAuthorizationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ExpressRouteCircuitAuthorizationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates an authorization in the specified express route circuit. @@ -96,7 +103,7 @@ func (client *ExpressRouteCircuitAuthorizationsClient) createOrUpdateCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, authorizationParameters) @@ -176,7 +183,7 @@ func (client *ExpressRouteCircuitAuthorizationsClient) deleteCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *ExpressRouteCircuitAuthorizationsClient) getCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *ExpressRouteCircuitAuthorizationsClient) getCreateRequest(ctx cont func (client *ExpressRouteCircuitAuthorizationsClient) getHandleResponse(resp *http.Response) (ExpressRouteCircuitAuthorizationsGetResponse, error) { result := ExpressRouteCircuitAuthorizationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitAuthorization); err != nil { - return ExpressRouteCircuitAuthorizationsGetResponse{}, err + return ExpressRouteCircuitAuthorizationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *ExpressRouteCircuitAuthorizationsClient) listCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *ExpressRouteCircuitAuthorizationsClient) listCreateRequest(ctx con func (client *ExpressRouteCircuitAuthorizationsClient) listHandleResponse(resp *http.Response) (ExpressRouteCircuitAuthorizationsListResponse, error) { result := ExpressRouteCircuitAuthorizationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationListResult); err != nil { - return ExpressRouteCircuitAuthorizationsListResponse{}, err + return ExpressRouteCircuitAuthorizationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecircuitconnections_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecircuitconnections_client.go index 311e542ead79..0351d83b6dcd 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecircuitconnections_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecircuitconnections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ExpressRouteCircuitConnectionsClient contains the methods for the ExpressRouteCircuitConnections group. @@ -31,8 +31,15 @@ type ExpressRouteCircuitConnectionsClient struct { } // NewExpressRouteCircuitConnectionsClient creates a new instance of ExpressRouteCircuitConnectionsClient with the specified values. -func NewExpressRouteCircuitConnectionsClient(con *arm.Connection, subscriptionID string) *ExpressRouteCircuitConnectionsClient { - return &ExpressRouteCircuitConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewExpressRouteCircuitConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExpressRouteCircuitConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ExpressRouteCircuitConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a Express Route Circuit Connection in the specified express route circuits. @@ -100,7 +107,7 @@ func (client *ExpressRouteCircuitConnectionsClient) createOrUpdateCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, expressRouteCircuitConnectionParameters) @@ -184,7 +191,7 @@ func (client *ExpressRouteCircuitConnectionsClient) deleteCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -248,7 +255,7 @@ func (client *ExpressRouteCircuitConnectionsClient) getCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -258,7 +265,7 @@ func (client *ExpressRouteCircuitConnectionsClient) getCreateRequest(ctx context func (client *ExpressRouteCircuitConnectionsClient) getHandleResponse(resp *http.Response) (ExpressRouteCircuitConnectionsGetResponse, error) { result := ExpressRouteCircuitConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitConnection); err != nil { - return ExpressRouteCircuitConnectionsGetResponse{}, err + return ExpressRouteCircuitConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -314,7 +321,7 @@ func (client *ExpressRouteCircuitConnectionsClient) listCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -324,7 +331,7 @@ func (client *ExpressRouteCircuitConnectionsClient) listCreateRequest(ctx contex func (client *ExpressRouteCircuitConnectionsClient) listHandleResponse(resp *http.Response) (ExpressRouteCircuitConnectionsListResponse, error) { result := ExpressRouteCircuitConnectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitConnectionListResult); err != nil { - return ExpressRouteCircuitConnectionsListResponse{}, err + return ExpressRouteCircuitConnectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecircuitpeerings_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecircuitpeerings_client.go index 64a99e481b72..aec2424391ef 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecircuitpeerings_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecircuitpeerings_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ExpressRouteCircuitPeeringsClient contains the methods for the ExpressRouteCircuitPeerings group. @@ -31,8 +31,15 @@ type ExpressRouteCircuitPeeringsClient struct { } // NewExpressRouteCircuitPeeringsClient creates a new instance of ExpressRouteCircuitPeeringsClient with the specified values. -func NewExpressRouteCircuitPeeringsClient(con *arm.Connection, subscriptionID string) *ExpressRouteCircuitPeeringsClient { - return &ExpressRouteCircuitPeeringsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewExpressRouteCircuitPeeringsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExpressRouteCircuitPeeringsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ExpressRouteCircuitPeeringsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a peering in the specified express route circuits. @@ -96,7 +103,7 @@ func (client *ExpressRouteCircuitPeeringsClient) createOrUpdateCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, peeringParameters) @@ -176,7 +183,7 @@ func (client *ExpressRouteCircuitPeeringsClient) deleteCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *ExpressRouteCircuitPeeringsClient) getCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *ExpressRouteCircuitPeeringsClient) getCreateRequest(ctx context.Co func (client *ExpressRouteCircuitPeeringsClient) getHandleResponse(resp *http.Response) (ExpressRouteCircuitPeeringsGetResponse, error) { result := ExpressRouteCircuitPeeringsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitPeering); err != nil { - return ExpressRouteCircuitPeeringsGetResponse{}, err + return ExpressRouteCircuitPeeringsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *ExpressRouteCircuitPeeringsClient) listCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *ExpressRouteCircuitPeeringsClient) listCreateRequest(ctx context.C func (client *ExpressRouteCircuitPeeringsClient) listHandleResponse(resp *http.Response) (ExpressRouteCircuitPeeringsListResponse, error) { result := ExpressRouteCircuitPeeringsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitPeeringListResult); err != nil { - return ExpressRouteCircuitPeeringsListResponse{}, err + return ExpressRouteCircuitPeeringsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecircuits_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecircuits_client.go index 88a4e7910d05..7c32cb395ada 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecircuits_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecircuits_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ExpressRouteCircuitsClient contains the methods for the ExpressRouteCircuits group. @@ -31,8 +31,15 @@ type ExpressRouteCircuitsClient struct { } // NewExpressRouteCircuitsClient creates a new instance of ExpressRouteCircuitsClient with the specified values. -func NewExpressRouteCircuitsClient(con *arm.Connection, subscriptionID string) *ExpressRouteCircuitsClient { - return &ExpressRouteCircuitsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewExpressRouteCircuitsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExpressRouteCircuitsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ExpressRouteCircuitsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates an express route circuit. @@ -92,7 +99,7 @@ func (client *ExpressRouteCircuitsClient) createOrUpdateCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *ExpressRouteCircuitsClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *ExpressRouteCircuitsClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +241,7 @@ func (client *ExpressRouteCircuitsClient) getCreateRequest(ctx context.Context, func (client *ExpressRouteCircuitsClient) getHandleResponse(resp *http.Response) (ExpressRouteCircuitsGetResponse, error) { result := ExpressRouteCircuitsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuit); err != nil { - return ExpressRouteCircuitsGetResponse{}, err + return ExpressRouteCircuitsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -293,7 +300,7 @@ func (client *ExpressRouteCircuitsClient) getPeeringStatsCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -303,7 +310,7 @@ func (client *ExpressRouteCircuitsClient) getPeeringStatsCreateRequest(ctx conte func (client *ExpressRouteCircuitsClient) getPeeringStatsHandleResponse(resp *http.Response) (ExpressRouteCircuitsGetPeeringStatsResponse, error) { result := ExpressRouteCircuitsGetPeeringStatsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitStats); err != nil { - return ExpressRouteCircuitsGetPeeringStatsResponse{}, err + return ExpressRouteCircuitsGetPeeringStatsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -358,7 +365,7 @@ func (client *ExpressRouteCircuitsClient) getStatsCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -368,7 +375,7 @@ func (client *ExpressRouteCircuitsClient) getStatsCreateRequest(ctx context.Cont func (client *ExpressRouteCircuitsClient) getStatsHandleResponse(resp *http.Response) (ExpressRouteCircuitsGetStatsResponse, error) { result := ExpressRouteCircuitsGetStatsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitStats); err != nil { - return ExpressRouteCircuitsGetStatsResponse{}, err + return ExpressRouteCircuitsGetStatsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -416,7 +423,7 @@ func (client *ExpressRouteCircuitsClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -426,7 +433,7 @@ func (client *ExpressRouteCircuitsClient) listCreateRequest(ctx context.Context, func (client *ExpressRouteCircuitsClient) listHandleResponse(resp *http.Response) (ExpressRouteCircuitsListResponse, error) { result := ExpressRouteCircuitsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitListResult); err != nil { - return ExpressRouteCircuitsListResponse{}, err + return ExpressRouteCircuitsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -470,7 +477,7 @@ func (client *ExpressRouteCircuitsClient) listAllCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -480,7 +487,7 @@ func (client *ExpressRouteCircuitsClient) listAllCreateRequest(ctx context.Conte func (client *ExpressRouteCircuitsClient) listAllHandleResponse(resp *http.Response) (ExpressRouteCircuitsListAllResponse, error) { result := ExpressRouteCircuitsListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuitListResult); err != nil { - return ExpressRouteCircuitsListAllResponse{}, err + return ExpressRouteCircuitsListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -563,7 +570,7 @@ func (client *ExpressRouteCircuitsClient) listArpTableCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -647,7 +654,7 @@ func (client *ExpressRouteCircuitsClient) listRoutesTableCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -731,7 +738,7 @@ func (client *ExpressRouteCircuitsClient) listRoutesTableSummaryCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -787,7 +794,7 @@ func (client *ExpressRouteCircuitsClient) updateTagsCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -797,7 +804,7 @@ func (client *ExpressRouteCircuitsClient) updateTagsCreateRequest(ctx context.Co func (client *ExpressRouteCircuitsClient) updateTagsHandleResponse(resp *http.Response) (ExpressRouteCircuitsUpdateTagsResponse, error) { result := ExpressRouteCircuitsUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCircuit); err != nil { - return ExpressRouteCircuitsUpdateTagsResponse{}, err + return ExpressRouteCircuitsUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_expressrouteconnections_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_expressrouteconnections_client.go index 11bf3cd664ab..0bcfc9dd14fd 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_expressrouteconnections_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_expressrouteconnections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ExpressRouteConnectionsClient contains the methods for the ExpressRouteConnections group. @@ -31,8 +31,15 @@ type ExpressRouteConnectionsClient struct { } // NewExpressRouteConnectionsClient creates a new instance of ExpressRouteConnectionsClient with the specified values. -func NewExpressRouteConnectionsClient(con *arm.Connection, subscriptionID string) *ExpressRouteConnectionsClient { - return &ExpressRouteConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewExpressRouteConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExpressRouteConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ExpressRouteConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a connection between an ExpressRoute gateway and an ExpressRoute circuit. @@ -96,7 +103,7 @@ func (client *ExpressRouteConnectionsClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, putExpressRouteConnectionParameters) @@ -176,7 +183,7 @@ func (client *ExpressRouteConnectionsClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *ExpressRouteConnectionsClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *ExpressRouteConnectionsClient) getCreateRequest(ctx context.Contex func (client *ExpressRouteConnectionsClient) getHandleResponse(resp *http.Response) (ExpressRouteConnectionsGetResponse, error) { result := ExpressRouteConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteConnection); err != nil { - return ExpressRouteConnectionsGetResponse{}, err + return ExpressRouteConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -301,7 +308,7 @@ func (client *ExpressRouteConnectionsClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -311,7 +318,7 @@ func (client *ExpressRouteConnectionsClient) listCreateRequest(ctx context.Conte func (client *ExpressRouteConnectionsClient) listHandleResponse(resp *http.Response) (ExpressRouteConnectionsListResponse, error) { result := ExpressRouteConnectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteConnectionList); err != nil { - return ExpressRouteConnectionsListResponse{}, err + return ExpressRouteConnectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecrossconnectionpeerings_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecrossconnectionpeerings_client.go index 553d0a775efb..f5c2d840e191 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecrossconnectionpeerings_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecrossconnectionpeerings_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ExpressRouteCrossConnectionPeeringsClient contains the methods for the ExpressRouteCrossConnectionPeerings group. @@ -31,8 +31,15 @@ type ExpressRouteCrossConnectionPeeringsClient struct { } // NewExpressRouteCrossConnectionPeeringsClient creates a new instance of ExpressRouteCrossConnectionPeeringsClient with the specified values. -func NewExpressRouteCrossConnectionPeeringsClient(con *arm.Connection, subscriptionID string) *ExpressRouteCrossConnectionPeeringsClient { - return &ExpressRouteCrossConnectionPeeringsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewExpressRouteCrossConnectionPeeringsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExpressRouteCrossConnectionPeeringsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ExpressRouteCrossConnectionPeeringsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a peering in the specified ExpressRouteCrossConnection. @@ -96,7 +103,7 @@ func (client *ExpressRouteCrossConnectionPeeringsClient) createOrUpdateCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, peeringParameters) @@ -176,7 +183,7 @@ func (client *ExpressRouteCrossConnectionPeeringsClient) deleteCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *ExpressRouteCrossConnectionPeeringsClient) getCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *ExpressRouteCrossConnectionPeeringsClient) getCreateRequest(ctx co func (client *ExpressRouteCrossConnectionPeeringsClient) getHandleResponse(resp *http.Response) (ExpressRouteCrossConnectionPeeringsGetResponse, error) { result := ExpressRouteCrossConnectionPeeringsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCrossConnectionPeering); err != nil { - return ExpressRouteCrossConnectionPeeringsGetResponse{}, err + return ExpressRouteCrossConnectionPeeringsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *ExpressRouteCrossConnectionPeeringsClient) listCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *ExpressRouteCrossConnectionPeeringsClient) listCreateRequest(ctx c func (client *ExpressRouteCrossConnectionPeeringsClient) listHandleResponse(resp *http.Response) (ExpressRouteCrossConnectionPeeringsListResponse, error) { result := ExpressRouteCrossConnectionPeeringsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCrossConnectionPeeringList); err != nil { - return ExpressRouteCrossConnectionPeeringsListResponse{}, err + return ExpressRouteCrossConnectionPeeringsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecrossconnections_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecrossconnections_client.go index 86dc6e4374c3..64afa6022fa3 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecrossconnections_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutecrossconnections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ExpressRouteCrossConnectionsClient contains the methods for the ExpressRouteCrossConnections group. @@ -31,8 +31,15 @@ type ExpressRouteCrossConnectionsClient struct { } // NewExpressRouteCrossConnectionsClient creates a new instance of ExpressRouteCrossConnectionsClient with the specified values. -func NewExpressRouteCrossConnectionsClient(con *arm.Connection, subscriptionID string) *ExpressRouteCrossConnectionsClient { - return &ExpressRouteCrossConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewExpressRouteCrossConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExpressRouteCrossConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ExpressRouteCrossConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Update the specified ExpressRouteCrossConnection. @@ -92,7 +99,7 @@ func (client *ExpressRouteCrossConnectionsClient) createOrUpdateCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -148,7 +155,7 @@ func (client *ExpressRouteCrossConnectionsClient) getCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -158,7 +165,7 @@ func (client *ExpressRouteCrossConnectionsClient) getCreateRequest(ctx context.C func (client *ExpressRouteCrossConnectionsClient) getHandleResponse(resp *http.Response) (ExpressRouteCrossConnectionsGetResponse, error) { result := ExpressRouteCrossConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCrossConnection); err != nil { - return ExpressRouteCrossConnectionsGetResponse{}, err + return ExpressRouteCrossConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -202,7 +209,7 @@ func (client *ExpressRouteCrossConnectionsClient) listCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -212,7 +219,7 @@ func (client *ExpressRouteCrossConnectionsClient) listCreateRequest(ctx context. func (client *ExpressRouteCrossConnectionsClient) listHandleResponse(resp *http.Response) (ExpressRouteCrossConnectionsListResponse, error) { result := ExpressRouteCrossConnectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCrossConnectionListResult); err != nil { - return ExpressRouteCrossConnectionsListResponse{}, err + return ExpressRouteCrossConnectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -295,7 +302,7 @@ func (client *ExpressRouteCrossConnectionsClient) listArpTableCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -344,7 +351,7 @@ func (client *ExpressRouteCrossConnectionsClient) listByResourceGroupCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -354,7 +361,7 @@ func (client *ExpressRouteCrossConnectionsClient) listByResourceGroupCreateReque func (client *ExpressRouteCrossConnectionsClient) listByResourceGroupHandleResponse(resp *http.Response) (ExpressRouteCrossConnectionsListByResourceGroupResponse, error) { result := ExpressRouteCrossConnectionsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCrossConnectionListResult); err != nil { - return ExpressRouteCrossConnectionsListByResourceGroupResponse{}, err + return ExpressRouteCrossConnectionsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -437,7 +444,7 @@ func (client *ExpressRouteCrossConnectionsClient) listRoutesTableCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -521,7 +528,7 @@ func (client *ExpressRouteCrossConnectionsClient) listRoutesTableSummaryCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -577,7 +584,7 @@ func (client *ExpressRouteCrossConnectionsClient) updateTagsCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, crossConnectionParameters) @@ -587,7 +594,7 @@ func (client *ExpressRouteCrossConnectionsClient) updateTagsCreateRequest(ctx co func (client *ExpressRouteCrossConnectionsClient) updateTagsHandleResponse(resp *http.Response) (ExpressRouteCrossConnectionsUpdateTagsResponse, error) { result := ExpressRouteCrossConnectionsUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteCrossConnection); err != nil { - return ExpressRouteCrossConnectionsUpdateTagsResponse{}, err + return ExpressRouteCrossConnectionsUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutegateways_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutegateways_client.go index 90b9fc48e45b..b6830065329a 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutegateways_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutegateways_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ExpressRouteGatewaysClient contains the methods for the ExpressRouteGateways group. @@ -31,8 +31,15 @@ type ExpressRouteGatewaysClient struct { } // NewExpressRouteGatewaysClient creates a new instance of ExpressRouteGatewaysClient with the specified values. -func NewExpressRouteGatewaysClient(con *arm.Connection, subscriptionID string) *ExpressRouteGatewaysClient { - return &ExpressRouteGatewaysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewExpressRouteGatewaysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExpressRouteGatewaysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ExpressRouteGatewaysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a ExpressRoute gateway in a specified resource group. @@ -92,7 +99,7 @@ func (client *ExpressRouteGatewaysClient) createOrUpdateCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, putExpressRouteGatewayParameters) @@ -170,7 +177,7 @@ func (client *ExpressRouteGatewaysClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -226,7 +233,7 @@ func (client *ExpressRouteGatewaysClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *ExpressRouteGatewaysClient) getCreateRequest(ctx context.Context, func (client *ExpressRouteGatewaysClient) getHandleResponse(resp *http.Response) (ExpressRouteGatewaysGetResponse, error) { result := ExpressRouteGatewaysGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteGateway); err != nil { - return ExpressRouteGatewaysGetResponse{}, err + return ExpressRouteGatewaysGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -287,7 +294,7 @@ func (client *ExpressRouteGatewaysClient) listByResourceGroupCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -297,7 +304,7 @@ func (client *ExpressRouteGatewaysClient) listByResourceGroupCreateRequest(ctx c func (client *ExpressRouteGatewaysClient) listByResourceGroupHandleResponse(resp *http.Response) (ExpressRouteGatewaysListByResourceGroupResponse, error) { result := ExpressRouteGatewaysListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteGatewayList); err != nil { - return ExpressRouteGatewaysListByResourceGroupResponse{}, err + return ExpressRouteGatewaysListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -344,7 +351,7 @@ func (client *ExpressRouteGatewaysClient) listBySubscriptionCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -354,7 +361,7 @@ func (client *ExpressRouteGatewaysClient) listBySubscriptionCreateRequest(ctx co func (client *ExpressRouteGatewaysClient) listBySubscriptionHandleResponse(resp *http.Response) (ExpressRouteGatewaysListBySubscriptionResponse, error) { result := ExpressRouteGatewaysListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteGatewayList); err != nil { - return ExpressRouteGatewaysListBySubscriptionResponse{}, err + return ExpressRouteGatewaysListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -429,7 +436,7 @@ func (client *ExpressRouteGatewaysClient) updateTagsCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, expressRouteGatewayParameters) diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutelinks_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutelinks_client.go index d8e65c392f0e..a6c47c0475e1 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutelinks_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_expressroutelinks_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ExpressRouteLinksClient contains the methods for the ExpressRouteLinks group. @@ -30,8 +31,15 @@ type ExpressRouteLinksClient struct { } // NewExpressRouteLinksClient creates a new instance of ExpressRouteLinksClient with the specified values. -func NewExpressRouteLinksClient(con *arm.Connection, subscriptionID string) *ExpressRouteLinksClient { - return &ExpressRouteLinksClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewExpressRouteLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExpressRouteLinksClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ExpressRouteLinksClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Retrieves the specified ExpressRouteLink resource. @@ -75,7 +83,7 @@ func (client *ExpressRouteLinksClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -85,7 +93,7 @@ func (client *ExpressRouteLinksClient) getCreateRequest(ctx context.Context, res func (client *ExpressRouteLinksClient) getHandleResponse(resp *http.Response) (ExpressRouteLinksGetResponse, error) { result := ExpressRouteLinksGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteLink); err != nil { - return ExpressRouteLinksGetResponse{}, err + return ExpressRouteLinksGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -137,7 +145,7 @@ func (client *ExpressRouteLinksClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -147,7 +155,7 @@ func (client *ExpressRouteLinksClient) listCreateRequest(ctx context.Context, re func (client *ExpressRouteLinksClient) listHandleResponse(resp *http.Response) (ExpressRouteLinksListResponse, error) { result := ExpressRouteLinksListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteLinkListResult); err != nil { - return ExpressRouteLinksListResponse{}, err + return ExpressRouteLinksListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_expressrouteports_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_expressrouteports_client.go index ee0849d81eeb..844a014e032b 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_expressrouteports_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_expressrouteports_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ExpressRoutePortsClient contains the methods for the ExpressRoutePorts group. @@ -31,8 +31,15 @@ type ExpressRoutePortsClient struct { } // NewExpressRoutePortsClient creates a new instance of ExpressRoutePortsClient with the specified values. -func NewExpressRoutePortsClient(con *arm.Connection, subscriptionID string) *ExpressRoutePortsClient { - return &ExpressRoutePortsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewExpressRoutePortsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExpressRoutePortsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ExpressRoutePortsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates the specified ExpressRoutePort resource. @@ -92,7 +99,7 @@ func (client *ExpressRoutePortsClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *ExpressRoutePortsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *ExpressRoutePortsClient) generateLOACreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, request) @@ -234,7 +241,7 @@ func (client *ExpressRoutePortsClient) generateLOACreateRequest(ctx context.Cont func (client *ExpressRoutePortsClient) generateLOAHandleResponse(resp *http.Response) (ExpressRoutePortsGenerateLOAResponse, error) { result := ExpressRoutePortsGenerateLOAResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GenerateExpressRoutePortsLOAResult); err != nil { - return ExpressRoutePortsGenerateLOAResponse{}, err + return ExpressRoutePortsGenerateLOAResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -289,7 +296,7 @@ func (client *ExpressRoutePortsClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -299,7 +306,7 @@ func (client *ExpressRoutePortsClient) getCreateRequest(ctx context.Context, res func (client *ExpressRoutePortsClient) getHandleResponse(resp *http.Response) (ExpressRoutePortsGetResponse, error) { result := ExpressRoutePortsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRoutePort); err != nil { - return ExpressRoutePortsGetResponse{}, err + return ExpressRoutePortsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -343,7 +350,7 @@ func (client *ExpressRoutePortsClient) listCreateRequest(ctx context.Context, op return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -353,7 +360,7 @@ func (client *ExpressRoutePortsClient) listCreateRequest(ctx context.Context, op func (client *ExpressRoutePortsClient) listHandleResponse(resp *http.Response) (ExpressRoutePortsListResponse, error) { result := ExpressRoutePortsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRoutePortListResult); err != nil { - return ExpressRoutePortsListResponse{}, err + return ExpressRoutePortsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -401,7 +408,7 @@ func (client *ExpressRoutePortsClient) listByResourceGroupCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -411,7 +418,7 @@ func (client *ExpressRoutePortsClient) listByResourceGroupCreateRequest(ctx cont func (client *ExpressRoutePortsClient) listByResourceGroupHandleResponse(resp *http.Response) (ExpressRoutePortsListByResourceGroupResponse, error) { result := ExpressRoutePortsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRoutePortListResult); err != nil { - return ExpressRoutePortsListByResourceGroupResponse{}, err + return ExpressRoutePortsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -466,7 +473,7 @@ func (client *ExpressRoutePortsClient) updateTagsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -476,7 +483,7 @@ func (client *ExpressRoutePortsClient) updateTagsCreateRequest(ctx context.Conte func (client *ExpressRoutePortsClient) updateTagsHandleResponse(resp *http.Response) (ExpressRoutePortsUpdateTagsResponse, error) { result := ExpressRoutePortsUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRoutePort); err != nil { - return ExpressRoutePortsUpdateTagsResponse{}, err + return ExpressRoutePortsUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_expressrouteportslocations_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_expressrouteportslocations_client.go index d23298684081..c64843344e50 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_expressrouteportslocations_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_expressrouteportslocations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ExpressRoutePortsLocationsClient contains the methods for the ExpressRoutePortsLocations group. @@ -30,8 +31,15 @@ type ExpressRoutePortsLocationsClient struct { } // NewExpressRoutePortsLocationsClient creates a new instance of ExpressRoutePortsLocationsClient with the specified values. -func NewExpressRoutePortsLocationsClient(con *arm.Connection, subscriptionID string) *ExpressRoutePortsLocationsClient { - return &ExpressRoutePortsLocationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewExpressRoutePortsLocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExpressRoutePortsLocationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ExpressRoutePortsLocationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Retrieves a single ExpressRoutePort peering location, including the list of available bandwidths available at said peering location. @@ -67,7 +75,7 @@ func (client *ExpressRoutePortsLocationsClient) getCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -77,7 +85,7 @@ func (client *ExpressRoutePortsLocationsClient) getCreateRequest(ctx context.Con func (client *ExpressRoutePortsLocationsClient) getHandleResponse(resp *http.Response) (ExpressRoutePortsLocationsGetResponse, error) { result := ExpressRoutePortsLocationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRoutePortsLocation); err != nil { - return ExpressRoutePortsLocationsGetResponse{}, err + return ExpressRoutePortsLocationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -122,7 +130,7 @@ func (client *ExpressRoutePortsLocationsClient) listCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -132,7 +140,7 @@ func (client *ExpressRoutePortsLocationsClient) listCreateRequest(ctx context.Co func (client *ExpressRoutePortsLocationsClient) listHandleResponse(resp *http.Response) (ExpressRoutePortsLocationsListResponse, error) { result := ExpressRoutePortsLocationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRoutePortsLocationListResult); err != nil { - return ExpressRoutePortsLocationsListResponse{}, err + return ExpressRoutePortsLocationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_expressrouteserviceproviders_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_expressrouteserviceproviders_client.go index 8a8f3f196207..0101a82b1d0b 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_expressrouteserviceproviders_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_expressrouteserviceproviders_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ExpressRouteServiceProvidersClient contains the methods for the ExpressRouteServiceProviders group. @@ -30,8 +31,15 @@ type ExpressRouteServiceProvidersClient struct { } // NewExpressRouteServiceProvidersClient creates a new instance of ExpressRouteServiceProvidersClient with the specified values. -func NewExpressRouteServiceProvidersClient(con *arm.Connection, subscriptionID string) *ExpressRouteServiceProvidersClient { - return &ExpressRouteServiceProvidersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewExpressRouteServiceProvidersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExpressRouteServiceProvidersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ExpressRouteServiceProvidersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets all the available express route service providers. @@ -60,7 +68,7 @@ func (client *ExpressRouteServiceProvidersClient) listCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -70,7 +78,7 @@ func (client *ExpressRouteServiceProvidersClient) listCreateRequest(ctx context. func (client *ExpressRouteServiceProvidersClient) listHandleResponse(resp *http.Response) (ExpressRouteServiceProvidersListResponse, error) { result := ExpressRouteServiceProvidersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExpressRouteServiceProviderListResult); err != nil { - return ExpressRouteServiceProvidersListResponse{}, err + return ExpressRouteServiceProvidersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicies_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicies_client.go index 14e606410e1c..890c03803de8 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicies_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicies_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // FirewallPoliciesClient contains the methods for the FirewallPolicies group. @@ -31,8 +31,15 @@ type FirewallPoliciesClient struct { } // NewFirewallPoliciesClient creates a new instance of FirewallPoliciesClient with the specified values. -func NewFirewallPoliciesClient(con *arm.Connection, subscriptionID string) *FirewallPoliciesClient { - return &FirewallPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewFirewallPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FirewallPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FirewallPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates the specified Firewall Policy. @@ -92,7 +99,7 @@ func (client *FirewallPoliciesClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *FirewallPoliciesClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *FirewallPoliciesClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -237,7 +244,7 @@ func (client *FirewallPoliciesClient) getCreateRequest(ctx context.Context, reso func (client *FirewallPoliciesClient) getHandleResponse(resp *http.Response) (FirewallPoliciesGetResponse, error) { result := FirewallPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallPolicy); err != nil { - return FirewallPoliciesGetResponse{}, err + return FirewallPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -285,7 +292,7 @@ func (client *FirewallPoliciesClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -295,7 +302,7 @@ func (client *FirewallPoliciesClient) listCreateRequest(ctx context.Context, res func (client *FirewallPoliciesClient) listHandleResponse(resp *http.Response) (FirewallPoliciesListResponse, error) { result := FirewallPoliciesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallPolicyListResult); err != nil { - return FirewallPoliciesListResponse{}, err + return FirewallPoliciesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -339,7 +346,7 @@ func (client *FirewallPoliciesClient) listAllCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -349,7 +356,7 @@ func (client *FirewallPoliciesClient) listAllCreateRequest(ctx context.Context, func (client *FirewallPoliciesClient) listAllHandleResponse(resp *http.Response) (FirewallPoliciesListAllResponse, error) { result := FirewallPoliciesListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallPolicyListResult); err != nil { - return FirewallPoliciesListAllResponse{}, err + return FirewallPoliciesListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicyidpssignatures_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicyidpssignatures_client.go new file mode 100644 index 000000000000..afa4066fb0e5 --- /dev/null +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicyidpssignatures_client.go @@ -0,0 +1,105 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armnetwork + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FirewallPolicyIdpsSignaturesClient contains the methods for the FirewallPolicyIdpsSignatures group. +// Don't use this type directly, use NewFirewallPolicyIdpsSignaturesClient() instead. +type FirewallPolicyIdpsSignaturesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewFirewallPolicyIdpsSignaturesClient creates a new instance of FirewallPolicyIdpsSignaturesClient with the specified values. +func NewFirewallPolicyIdpsSignaturesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FirewallPolicyIdpsSignaturesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FirewallPolicyIdpsSignaturesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// List - Retrieves the current status of IDPS signatures for the relevant policy +// If the operation fails it returns the *CloudError error type. +func (client *FirewallPolicyIdpsSignaturesClient) List(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters IDPSQueryObject, options *FirewallPolicyIdpsSignaturesListOptions) (FirewallPolicyIdpsSignaturesListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, firewallPolicyName, parameters, options) + if err != nil { + return FirewallPolicyIdpsSignaturesListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FirewallPolicyIdpsSignaturesListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallPolicyIdpsSignaturesListResponse{}, client.listHandleError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *FirewallPolicyIdpsSignaturesClient) listCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters IDPSQueryObject, options *FirewallPolicyIdpsSignaturesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/listIdpsSignatures" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// listHandleResponse handles the List response. +func (client *FirewallPolicyIdpsSignaturesClient) listHandleResponse(resp *http.Response) (FirewallPolicyIdpsSignaturesListResponse, error) { + result := FirewallPolicyIdpsSignaturesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.QueryResults); err != nil { + return FirewallPolicyIdpsSignaturesListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *FirewallPolicyIdpsSignaturesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicyidpssignaturesfiltervalues_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicyidpssignaturesfiltervalues_client.go new file mode 100644 index 000000000000..2bb2028a3919 --- /dev/null +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicyidpssignaturesfiltervalues_client.go @@ -0,0 +1,105 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armnetwork + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FirewallPolicyIdpsSignaturesFilterValuesClient contains the methods for the FirewallPolicyIdpsSignaturesFilterValues group. +// Don't use this type directly, use NewFirewallPolicyIdpsSignaturesFilterValuesClient() instead. +type FirewallPolicyIdpsSignaturesFilterValuesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewFirewallPolicyIdpsSignaturesFilterValuesClient creates a new instance of FirewallPolicyIdpsSignaturesFilterValuesClient with the specified values. +func NewFirewallPolicyIdpsSignaturesFilterValuesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FirewallPolicyIdpsSignaturesFilterValuesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FirewallPolicyIdpsSignaturesFilterValuesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// List - Retrieves the current filter values for the signatures overrides +// If the operation fails it returns the *CloudError error type. +func (client *FirewallPolicyIdpsSignaturesFilterValuesClient) List(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters SignatureOverridesFilterValuesQuery, options *FirewallPolicyIdpsSignaturesFilterValuesListOptions) (FirewallPolicyIdpsSignaturesFilterValuesListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, firewallPolicyName, parameters, options) + if err != nil { + return FirewallPolicyIdpsSignaturesFilterValuesListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FirewallPolicyIdpsSignaturesFilterValuesListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallPolicyIdpsSignaturesFilterValuesListResponse{}, client.listHandleError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *FirewallPolicyIdpsSignaturesFilterValuesClient) listCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters SignatureOverridesFilterValuesQuery, options *FirewallPolicyIdpsSignaturesFilterValuesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/listIdpsFilterOptions" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// listHandleResponse handles the List response. +func (client *FirewallPolicyIdpsSignaturesFilterValuesClient) listHandleResponse(resp *http.Response) (FirewallPolicyIdpsSignaturesFilterValuesListResponse, error) { + result := FirewallPolicyIdpsSignaturesFilterValuesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SignatureOverridesFilterValuesResponse); err != nil { + return FirewallPolicyIdpsSignaturesFilterValuesListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *FirewallPolicyIdpsSignaturesFilterValuesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicyidpssignaturesoverrides_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicyidpssignaturesoverrides_client.go new file mode 100644 index 000000000000..c5024e19ef73 --- /dev/null +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicyidpssignaturesoverrides_client.go @@ -0,0 +1,291 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armnetwork + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// FirewallPolicyIdpsSignaturesOverridesClient contains the methods for the FirewallPolicyIdpsSignaturesOverrides group. +// Don't use this type directly, use NewFirewallPolicyIdpsSignaturesOverridesClient() instead. +type FirewallPolicyIdpsSignaturesOverridesClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewFirewallPolicyIdpsSignaturesOverridesClient creates a new instance of FirewallPolicyIdpsSignaturesOverridesClient with the specified values. +func NewFirewallPolicyIdpsSignaturesOverridesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FirewallPolicyIdpsSignaturesOverridesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FirewallPolicyIdpsSignaturesOverridesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// Get - Returns all signatures overrides for a specific policy. +// If the operation fails it returns the *CloudError error type. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) Get(ctx context.Context, resourceGroupName string, firewallPolicyName string, options *FirewallPolicyIdpsSignaturesOverridesGetOptions) (FirewallPolicyIdpsSignaturesOverridesGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, firewallPolicyName, options) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallPolicyIdpsSignaturesOverridesGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) getCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, options *FirewallPolicyIdpsSignaturesOverridesGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides/default" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) getHandleResponse(resp *http.Response) (FirewallPolicyIdpsSignaturesOverridesGetResponse, error) { + result := FirewallPolicyIdpsSignaturesOverridesGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SignaturesOverrides); err != nil { + return FirewallPolicyIdpsSignaturesOverridesGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Returns all signatures overrides objects for a specific policy as a list containing a single value. +// If the operation fails it returns the *CloudError error type. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) List(ctx context.Context, resourceGroupName string, firewallPolicyName string, options *FirewallPolicyIdpsSignaturesOverridesListOptions) (FirewallPolicyIdpsSignaturesOverridesListResponse, error) { + req, err := client.listCreateRequest(ctx, resourceGroupName, firewallPolicyName, options) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallPolicyIdpsSignaturesOverridesListResponse{}, client.listHandleError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) listCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, options *FirewallPolicyIdpsSignaturesOverridesListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) listHandleResponse(resp *http.Response) (FirewallPolicyIdpsSignaturesOverridesListResponse, error) { + result := FirewallPolicyIdpsSignaturesOverridesListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SignaturesOverridesList); err != nil { + return FirewallPolicyIdpsSignaturesOverridesListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Patch - Will update the status of policy's signature overrides for IDPS +// If the operation fails it returns the *CloudError error type. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) Patch(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters SignaturesOverrides, options *FirewallPolicyIdpsSignaturesOverridesPatchOptions) (FirewallPolicyIdpsSignaturesOverridesPatchResponse, error) { + req, err := client.patchCreateRequest(ctx, resourceGroupName, firewallPolicyName, parameters, options) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesPatchResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesPatchResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallPolicyIdpsSignaturesOverridesPatchResponse{}, client.patchHandleError(resp) + } + return client.patchHandleResponse(resp) +} + +// patchCreateRequest creates the Patch request. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) patchCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters SignaturesOverrides, options *FirewallPolicyIdpsSignaturesOverridesPatchOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides/default" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// patchHandleResponse handles the Patch response. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) patchHandleResponse(resp *http.Response) (FirewallPolicyIdpsSignaturesOverridesPatchResponse, error) { + result := FirewallPolicyIdpsSignaturesOverridesPatchResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SignaturesOverrides); err != nil { + return FirewallPolicyIdpsSignaturesOverridesPatchResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// patchHandleError handles the Patch error response. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) patchHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Put - Will override/create a new signature overrides for the policy's IDPS +// If the operation fails it returns the *CloudError error type. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) Put(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters SignaturesOverrides, options *FirewallPolicyIdpsSignaturesOverridesPutOptions) (FirewallPolicyIdpsSignaturesOverridesPutResponse, error) { + req, err := client.putCreateRequest(ctx, resourceGroupName, firewallPolicyName, parameters, options) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesPutResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return FirewallPolicyIdpsSignaturesOverridesPutResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return FirewallPolicyIdpsSignaturesOverridesPutResponse{}, client.putHandleError(resp) + } + return client.putHandleResponse(resp) +} + +// putCreateRequest creates the Put request. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) putCreateRequest(ctx context.Context, resourceGroupName string, firewallPolicyName string, parameters SignaturesOverrides, options *FirewallPolicyIdpsSignaturesOverridesPutOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/firewallPolicies/{firewallPolicyName}/signatureOverrides/default" + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if firewallPolicyName == "" { + return nil, errors.New("parameter firewallPolicyName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{firewallPolicyName}", url.PathEscape(firewallPolicyName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// putHandleResponse handles the Put response. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) putHandleResponse(resp *http.Response) (FirewallPolicyIdpsSignaturesOverridesPutResponse, error) { + result := FirewallPolicyIdpsSignaturesOverridesPutResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SignaturesOverrides); err != nil { + return FirewallPolicyIdpsSignaturesOverridesPutResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// putHandleError handles the Put error response. +func (client *FirewallPolicyIdpsSignaturesOverridesClient) putHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicyrulecollectiongroups_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicyrulecollectiongroups_client.go index b6dcc4b5821a..9ca4a0391644 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicyrulecollectiongroups_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_firewallpolicyrulecollectiongroups_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // FirewallPolicyRuleCollectionGroupsClient contains the methods for the FirewallPolicyRuleCollectionGroups group. @@ -31,8 +31,15 @@ type FirewallPolicyRuleCollectionGroupsClient struct { } // NewFirewallPolicyRuleCollectionGroupsClient creates a new instance of FirewallPolicyRuleCollectionGroupsClient with the specified values. -func NewFirewallPolicyRuleCollectionGroupsClient(con *arm.Connection, subscriptionID string) *FirewallPolicyRuleCollectionGroupsClient { - return &FirewallPolicyRuleCollectionGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewFirewallPolicyRuleCollectionGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FirewallPolicyRuleCollectionGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FirewallPolicyRuleCollectionGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates the specified FirewallPolicyRuleCollectionGroup. @@ -96,7 +103,7 @@ func (client *FirewallPolicyRuleCollectionGroupsClient) createOrUpdateCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -176,7 +183,7 @@ func (client *FirewallPolicyRuleCollectionGroupsClient) deleteCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *FirewallPolicyRuleCollectionGroupsClient) getCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *FirewallPolicyRuleCollectionGroupsClient) getCreateRequest(ctx con func (client *FirewallPolicyRuleCollectionGroupsClient) getHandleResponse(resp *http.Response) (FirewallPolicyRuleCollectionGroupsGetResponse, error) { result := FirewallPolicyRuleCollectionGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallPolicyRuleCollectionGroup); err != nil { - return FirewallPolicyRuleCollectionGroupsGetResponse{}, err + return FirewallPolicyRuleCollectionGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *FirewallPolicyRuleCollectionGroupsClient) listCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *FirewallPolicyRuleCollectionGroupsClient) listCreateRequest(ctx co func (client *FirewallPolicyRuleCollectionGroupsClient) listHandleResponse(resp *http.Response) (FirewallPolicyRuleCollectionGroupsListResponse, error) { result := FirewallPolicyRuleCollectionGroupsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallPolicyRuleCollectionGroupListResult); err != nil { - return FirewallPolicyRuleCollectionGroupsListResponse{}, err + return FirewallPolicyRuleCollectionGroupsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_flowlogs_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_flowlogs_client.go index e37e23b65a31..a7942c699e98 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_flowlogs_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_flowlogs_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // FlowLogsClient contains the methods for the FlowLogs group. @@ -31,8 +31,15 @@ type FlowLogsClient struct { } // NewFlowLogsClient creates a new instance of FlowLogsClient with the specified values. -func NewFlowLogsClient(con *arm.Connection, subscriptionID string) *FlowLogsClient { - return &FlowLogsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewFlowLogsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FlowLogsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FlowLogsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update a flow log for the specified network security group. @@ -96,7 +103,7 @@ func (client *FlowLogsClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -176,7 +183,7 @@ func (client *FlowLogsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *FlowLogsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *FlowLogsClient) getCreateRequest(ctx context.Context, resourceGrou func (client *FlowLogsClient) getHandleResponse(resp *http.Response) (FlowLogsGetResponse, error) { result := FlowLogsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FlowLog); err != nil { - return FlowLogsGetResponse{}, err + return FlowLogsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *FlowLogsClient) listCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *FlowLogsClient) listCreateRequest(ctx context.Context, resourceGro func (client *FlowLogsClient) listHandleResponse(resp *http.Response) (FlowLogsListResponse, error) { result := FlowLogsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FlowLogListResult); err != nil { - return FlowLogsListResponse{}, err + return FlowLogsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -367,7 +374,7 @@ func (client *FlowLogsClient) updateTagsCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -377,7 +384,7 @@ func (client *FlowLogsClient) updateTagsCreateRequest(ctx context.Context, resou func (client *FlowLogsClient) updateTagsHandleResponse(resp *http.Response) (FlowLogsUpdateTagsResponse, error) { result := FlowLogsUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FlowLog); err != nil { - return FlowLogsUpdateTagsResponse{}, err + return FlowLogsUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_hubroutetables_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_hubroutetables_client.go index bd33b3141368..7f2509a55117 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_hubroutetables_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_hubroutetables_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // HubRouteTablesClient contains the methods for the HubRouteTables group. @@ -31,8 +31,15 @@ type HubRouteTablesClient struct { } // NewHubRouteTablesClient creates a new instance of HubRouteTablesClient with the specified values. -func NewHubRouteTablesClient(con *arm.Connection, subscriptionID string) *HubRouteTablesClient { - return &HubRouteTablesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewHubRouteTablesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *HubRouteTablesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &HubRouteTablesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a RouteTable resource if it doesn't exist else updates the existing RouteTable. @@ -96,7 +103,7 @@ func (client *HubRouteTablesClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, routeTableParameters) @@ -176,7 +183,7 @@ func (client *HubRouteTablesClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *HubRouteTablesClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *HubRouteTablesClient) getCreateRequest(ctx context.Context, resour func (client *HubRouteTablesClient) getHandleResponse(resp *http.Response) (HubRouteTablesGetResponse, error) { result := HubRouteTablesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HubRouteTable); err != nil { - return HubRouteTablesGetResponse{}, err + return HubRouteTablesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *HubRouteTablesClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *HubRouteTablesClient) listCreateRequest(ctx context.Context, resou func (client *HubRouteTablesClient) listHandleResponse(resp *http.Response) (HubRouteTablesListResponse, error) { result := HubRouteTablesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListHubRouteTablesResult); err != nil { - return HubRouteTablesListResponse{}, err + return HubRouteTablesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_hubvirtualnetworkconnections_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_hubvirtualnetworkconnections_client.go index b9c1261a163a..b0b80cdfad48 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_hubvirtualnetworkconnections_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_hubvirtualnetworkconnections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // HubVirtualNetworkConnectionsClient contains the methods for the HubVirtualNetworkConnections group. @@ -31,8 +31,15 @@ type HubVirtualNetworkConnectionsClient struct { } // NewHubVirtualNetworkConnectionsClient creates a new instance of HubVirtualNetworkConnectionsClient with the specified values. -func NewHubVirtualNetworkConnectionsClient(con *arm.Connection, subscriptionID string) *HubVirtualNetworkConnectionsClient { - return &HubVirtualNetworkConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewHubVirtualNetworkConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *HubVirtualNetworkConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &HubVirtualNetworkConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a hub virtual network connection if it doesn't exist else updates the existing one. @@ -96,7 +103,7 @@ func (client *HubVirtualNetworkConnectionsClient) createOrUpdateCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, hubVirtualNetworkConnectionParameters) @@ -176,7 +183,7 @@ func (client *HubVirtualNetworkConnectionsClient) deleteCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *HubVirtualNetworkConnectionsClient) getCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *HubVirtualNetworkConnectionsClient) getCreateRequest(ctx context.C func (client *HubVirtualNetworkConnectionsClient) getHandleResponse(resp *http.Response) (HubVirtualNetworkConnectionsGetResponse, error) { result := HubVirtualNetworkConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HubVirtualNetworkConnection); err != nil { - return HubVirtualNetworkConnectionsGetResponse{}, err + return HubVirtualNetworkConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *HubVirtualNetworkConnectionsClient) listCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *HubVirtualNetworkConnectionsClient) listCreateRequest(ctx context. func (client *HubVirtualNetworkConnectionsClient) listHandleResponse(resp *http.Response) (HubVirtualNetworkConnectionsListResponse, error) { result := HubVirtualNetworkConnectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListHubVirtualNetworkConnectionsResult); err != nil { - return HubVirtualNetworkConnectionsListResponse{}, err + return HubVirtualNetworkConnectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_inboundnatrules_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_inboundnatrules_client.go index c3122917124d..f026ca8ff5ba 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_inboundnatrules_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_inboundnatrules_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // InboundNatRulesClient contains the methods for the InboundNatRules group. @@ -31,11 +31,18 @@ type InboundNatRulesClient struct { } // NewInboundNatRulesClient creates a new instance of InboundNatRulesClient with the specified values. -func NewInboundNatRulesClient(con *arm.Connection, subscriptionID string) *InboundNatRulesClient { - return &InboundNatRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewInboundNatRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *InboundNatRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &InboundNatRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } -// BeginCreateOrUpdate - Creates or updates a load balancer inbound nat rule. +// BeginCreateOrUpdate - Creates or updates a load balancer inbound NAT rule. // If the operation fails it returns the *CloudError error type. func (client *InboundNatRulesClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, inboundNatRuleParameters InboundNatRule, options *InboundNatRulesBeginCreateOrUpdateOptions) (InboundNatRulesCreateOrUpdatePollerResponse, error) { resp, err := client.createOrUpdate(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, options) @@ -55,7 +62,7 @@ func (client *InboundNatRulesClient) BeginCreateOrUpdate(ctx context.Context, re return result, nil } -// CreateOrUpdate - Creates or updates a load balancer inbound nat rule. +// CreateOrUpdate - Creates or updates a load balancer inbound NAT rule. // If the operation fails it returns the *CloudError error type. func (client *InboundNatRulesClient) createOrUpdate(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, inboundNatRuleParameters InboundNatRule, options *InboundNatRulesBeginCreateOrUpdateOptions) (*http.Response, error) { req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, inboundNatRuleParameters, options) @@ -96,7 +103,7 @@ func (client *InboundNatRulesClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, inboundNatRuleParameters) @@ -115,7 +122,7 @@ func (client *InboundNatRulesClient) createOrUpdateHandleError(resp *http.Respon return runtime.NewResponseError(&errType, resp) } -// BeginDelete - Deletes the specified load balancer inbound nat rule. +// BeginDelete - Deletes the specified load balancer inbound NAT rule. // If the operation fails it returns the *CloudError error type. func (client *InboundNatRulesClient) BeginDelete(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, options *InboundNatRulesBeginDeleteOptions) (InboundNatRulesDeletePollerResponse, error) { resp, err := client.deleteOperation(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, options) @@ -135,7 +142,7 @@ func (client *InboundNatRulesClient) BeginDelete(ctx context.Context, resourceGr return result, nil } -// Delete - Deletes the specified load balancer inbound nat rule. +// Delete - Deletes the specified load balancer inbound NAT rule. // If the operation fails it returns the *CloudError error type. func (client *InboundNatRulesClient) deleteOperation(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, options *InboundNatRulesBeginDeleteOptions) (*http.Response, error) { req, err := client.deleteCreateRequest(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, options) @@ -176,7 +183,7 @@ func (client *InboundNatRulesClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -195,7 +202,7 @@ func (client *InboundNatRulesClient) deleteHandleError(resp *http.Response) erro return runtime.NewResponseError(&errType, resp) } -// Get - Gets the specified load balancer inbound nat rule. +// Get - Gets the specified load balancer inbound NAT rule. // If the operation fails it returns the *CloudError error type. func (client *InboundNatRulesClient) Get(ctx context.Context, resourceGroupName string, loadBalancerName string, inboundNatRuleName string, options *InboundNatRulesGetOptions) (InboundNatRulesGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceGroupName, loadBalancerName, inboundNatRuleName, options) @@ -236,7 +243,7 @@ func (client *InboundNatRulesClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -249,7 +256,7 @@ func (client *InboundNatRulesClient) getCreateRequest(ctx context.Context, resou func (client *InboundNatRulesClient) getHandleResponse(resp *http.Response) (InboundNatRulesGetResponse, error) { result := InboundNatRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.InboundNatRule); err != nil { - return InboundNatRulesGetResponse{}, err + return InboundNatRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -267,7 +274,7 @@ func (client *InboundNatRulesClient) getHandleError(resp *http.Response) error { return runtime.NewResponseError(&errType, resp) } -// List - Gets all the inbound nat rules in a load balancer. +// List - Gets all the inbound NAT rules in a load balancer. // If the operation fails it returns the *CloudError error type. func (client *InboundNatRulesClient) List(resourceGroupName string, loadBalancerName string, options *InboundNatRulesListOptions) *InboundNatRulesListPager { return &InboundNatRulesListPager{ @@ -301,7 +308,7 @@ func (client *InboundNatRulesClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -311,7 +318,7 @@ func (client *InboundNatRulesClient) listCreateRequest(ctx context.Context, reso func (client *InboundNatRulesClient) listHandleResponse(resp *http.Response) (InboundNatRulesListResponse, error) { result := InboundNatRulesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.InboundNatRuleListResult); err != nil { - return InboundNatRulesListResponse{}, err + return InboundNatRulesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_inboundsecurityrule_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_inboundsecurityrule_client.go index fac721406eac..59742005feee 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_inboundsecurityrule_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_inboundsecurityrule_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // InboundSecurityRuleClient contains the methods for the InboundSecurityRule group. @@ -31,8 +31,15 @@ type InboundSecurityRuleClient struct { } // NewInboundSecurityRuleClient creates a new instance of InboundSecurityRuleClient with the specified values. -func NewInboundSecurityRuleClient(con *arm.Connection, subscriptionID string) *InboundSecurityRuleClient { - return &InboundSecurityRuleClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewInboundSecurityRuleClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *InboundSecurityRuleClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &InboundSecurityRuleClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates the specified Network Virtual Appliance Inbound Security Rules. @@ -96,7 +103,7 @@ func (client *InboundSecurityRuleClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_ipallocations_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_ipallocations_client.go index 1c3172b42db6..ac55f0359849 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_ipallocations_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_ipallocations_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // IPAllocationsClient contains the methods for the IPAllocations group. @@ -31,8 +31,15 @@ type IPAllocationsClient struct { } // NewIPAllocationsClient creates a new instance of IPAllocationsClient with the specified values. -func NewIPAllocationsClient(con *arm.Connection, subscriptionID string) *IPAllocationsClient { - return &IPAllocationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIPAllocationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IPAllocationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IPAllocationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates an IpAllocation in the specified resource group. @@ -92,7 +99,7 @@ func (client *IPAllocationsClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *IPAllocationsClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *IPAllocationsClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -237,7 +244,7 @@ func (client *IPAllocationsClient) getCreateRequest(ctx context.Context, resourc func (client *IPAllocationsClient) getHandleResponse(resp *http.Response) (IPAllocationsGetResponse, error) { result := IPAllocationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IPAllocation); err != nil { - return IPAllocationsGetResponse{}, err + return IPAllocationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -281,7 +288,7 @@ func (client *IPAllocationsClient) listCreateRequest(ctx context.Context, option return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -291,7 +298,7 @@ func (client *IPAllocationsClient) listCreateRequest(ctx context.Context, option func (client *IPAllocationsClient) listHandleResponse(resp *http.Response) (IPAllocationsListResponse, error) { result := IPAllocationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IPAllocationListResult); err != nil { - return IPAllocationsListResponse{}, err + return IPAllocationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -339,7 +346,7 @@ func (client *IPAllocationsClient) listByResourceGroupCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -349,7 +356,7 @@ func (client *IPAllocationsClient) listByResourceGroupCreateRequest(ctx context. func (client *IPAllocationsClient) listByResourceGroupHandleResponse(resp *http.Response) (IPAllocationsListByResourceGroupResponse, error) { result := IPAllocationsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IPAllocationListResult); err != nil { - return IPAllocationsListByResourceGroupResponse{}, err + return IPAllocationsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -404,7 +411,7 @@ func (client *IPAllocationsClient) updateTagsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -414,7 +421,7 @@ func (client *IPAllocationsClient) updateTagsCreateRequest(ctx context.Context, func (client *IPAllocationsClient) updateTagsHandleResponse(resp *http.Response) (IPAllocationsUpdateTagsResponse, error) { result := IPAllocationsUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IPAllocation); err != nil { - return IPAllocationsUpdateTagsResponse{}, err + return IPAllocationsUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_ipgroups_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_ipgroups_client.go index a82905622e35..824010c11294 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_ipgroups_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_ipgroups_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // IPGroupsClient contains the methods for the IPGroups group. @@ -31,8 +31,15 @@ type IPGroupsClient struct { } // NewIPGroupsClient creates a new instance of IPGroupsClient with the specified values. -func NewIPGroupsClient(con *arm.Connection, subscriptionID string) *IPGroupsClient { - return &IPGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIPGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IPGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IPGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates an ipGroups in a specified resource group. @@ -92,7 +99,7 @@ func (client *IPGroupsClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *IPGroupsClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *IPGroupsClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -237,7 +244,7 @@ func (client *IPGroupsClient) getCreateRequest(ctx context.Context, resourceGrou func (client *IPGroupsClient) getHandleResponse(resp *http.Response) (IPGroupsGetResponse, error) { result := IPGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IPGroup); err != nil { - return IPGroupsGetResponse{}, err + return IPGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -281,7 +288,7 @@ func (client *IPGroupsClient) listCreateRequest(ctx context.Context, options *IP return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -291,7 +298,7 @@ func (client *IPGroupsClient) listCreateRequest(ctx context.Context, options *IP func (client *IPGroupsClient) listHandleResponse(resp *http.Response) (IPGroupsListResponse, error) { result := IPGroupsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IPGroupListResult); err != nil { - return IPGroupsListResponse{}, err + return IPGroupsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -339,7 +346,7 @@ func (client *IPGroupsClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -349,7 +356,7 @@ func (client *IPGroupsClient) listByResourceGroupCreateRequest(ctx context.Conte func (client *IPGroupsClient) listByResourceGroupHandleResponse(resp *http.Response) (IPGroupsListByResourceGroupResponse, error) { result := IPGroupsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IPGroupListResult); err != nil { - return IPGroupsListByResourceGroupResponse{}, err + return IPGroupsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -404,7 +411,7 @@ func (client *IPGroupsClient) updateGroupsCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -414,7 +421,7 @@ func (client *IPGroupsClient) updateGroupsCreateRequest(ctx context.Context, res func (client *IPGroupsClient) updateGroupsHandleResponse(resp *http.Response) (IPGroupsUpdateGroupsResponse, error) { result := IPGroupsUpdateGroupsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IPGroup); err != nil { - return IPGroupsUpdateGroupsResponse{}, err + return IPGroupsUpdateGroupsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancerbackendaddresspools_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancerbackendaddresspools_client.go index 31861b70e6bb..7f5cbbe8b9a1 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancerbackendaddresspools_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancerbackendaddresspools_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LoadBalancerBackendAddressPoolsClient contains the methods for the LoadBalancerBackendAddressPools group. @@ -31,8 +31,15 @@ type LoadBalancerBackendAddressPoolsClient struct { } // NewLoadBalancerBackendAddressPoolsClient creates a new instance of LoadBalancerBackendAddressPoolsClient with the specified values. -func NewLoadBalancerBackendAddressPoolsClient(con *arm.Connection, subscriptionID string) *LoadBalancerBackendAddressPoolsClient { - return &LoadBalancerBackendAddressPoolsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLoadBalancerBackendAddressPoolsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LoadBalancerBackendAddressPoolsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LoadBalancerBackendAddressPoolsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a load balancer backend address pool. @@ -96,7 +103,7 @@ func (client *LoadBalancerBackendAddressPoolsClient) createOrUpdateCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -176,7 +183,7 @@ func (client *LoadBalancerBackendAddressPoolsClient) deleteCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *LoadBalancerBackendAddressPoolsClient) getCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *LoadBalancerBackendAddressPoolsClient) getCreateRequest(ctx contex func (client *LoadBalancerBackendAddressPoolsClient) getHandleResponse(resp *http.Response) (LoadBalancerBackendAddressPoolsGetResponse, error) { result := LoadBalancerBackendAddressPoolsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BackendAddressPool); err != nil { - return LoadBalancerBackendAddressPoolsGetResponse{}, err + return LoadBalancerBackendAddressPoolsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *LoadBalancerBackendAddressPoolsClient) listCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *LoadBalancerBackendAddressPoolsClient) listCreateRequest(ctx conte func (client *LoadBalancerBackendAddressPoolsClient) listHandleResponse(resp *http.Response) (LoadBalancerBackendAddressPoolsListResponse, error) { result := LoadBalancerBackendAddressPoolsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancerBackendAddressPoolListResult); err != nil { - return LoadBalancerBackendAddressPoolsListResponse{}, err + return LoadBalancerBackendAddressPoolsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancerfrontendipconfigurations_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancerfrontendipconfigurations_client.go index a0bb29728d8b..56553d6b374c 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancerfrontendipconfigurations_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancerfrontendipconfigurations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LoadBalancerFrontendIPConfigurationsClient contains the methods for the LoadBalancerFrontendIPConfigurations group. @@ -30,8 +31,15 @@ type LoadBalancerFrontendIPConfigurationsClient struct { } // NewLoadBalancerFrontendIPConfigurationsClient creates a new instance of LoadBalancerFrontendIPConfigurationsClient with the specified values. -func NewLoadBalancerFrontendIPConfigurationsClient(con *arm.Connection, subscriptionID string) *LoadBalancerFrontendIPConfigurationsClient { - return &LoadBalancerFrontendIPConfigurationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLoadBalancerFrontendIPConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LoadBalancerFrontendIPConfigurationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LoadBalancerFrontendIPConfigurationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets load balancer frontend IP configuration. @@ -75,7 +83,7 @@ func (client *LoadBalancerFrontendIPConfigurationsClient) getCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -85,7 +93,7 @@ func (client *LoadBalancerFrontendIPConfigurationsClient) getCreateRequest(ctx c func (client *LoadBalancerFrontendIPConfigurationsClient) getHandleResponse(resp *http.Response) (LoadBalancerFrontendIPConfigurationsGetResponse, error) { result := LoadBalancerFrontendIPConfigurationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FrontendIPConfiguration); err != nil { - return LoadBalancerFrontendIPConfigurationsGetResponse{}, err + return LoadBalancerFrontendIPConfigurationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -137,7 +145,7 @@ func (client *LoadBalancerFrontendIPConfigurationsClient) listCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -147,7 +155,7 @@ func (client *LoadBalancerFrontendIPConfigurationsClient) listCreateRequest(ctx func (client *LoadBalancerFrontendIPConfigurationsClient) listHandleResponse(resp *http.Response) (LoadBalancerFrontendIPConfigurationsListResponse, error) { result := LoadBalancerFrontendIPConfigurationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancerFrontendIPConfigurationListResult); err != nil { - return LoadBalancerFrontendIPConfigurationsListResponse{}, err + return LoadBalancerFrontendIPConfigurationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancerloadbalancingrules_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancerloadbalancingrules_client.go index 53acfd59e849..e5cf7a34bf48 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancerloadbalancingrules_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancerloadbalancingrules_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LoadBalancerLoadBalancingRulesClient contains the methods for the LoadBalancerLoadBalancingRules group. @@ -30,8 +31,15 @@ type LoadBalancerLoadBalancingRulesClient struct { } // NewLoadBalancerLoadBalancingRulesClient creates a new instance of LoadBalancerLoadBalancingRulesClient with the specified values. -func NewLoadBalancerLoadBalancingRulesClient(con *arm.Connection, subscriptionID string) *LoadBalancerLoadBalancingRulesClient { - return &LoadBalancerLoadBalancingRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLoadBalancerLoadBalancingRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LoadBalancerLoadBalancingRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LoadBalancerLoadBalancingRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the specified load balancer load balancing rule. @@ -75,7 +83,7 @@ func (client *LoadBalancerLoadBalancingRulesClient) getCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -85,7 +93,7 @@ func (client *LoadBalancerLoadBalancingRulesClient) getCreateRequest(ctx context func (client *LoadBalancerLoadBalancingRulesClient) getHandleResponse(resp *http.Response) (LoadBalancerLoadBalancingRulesGetResponse, error) { result := LoadBalancerLoadBalancingRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancingRule); err != nil { - return LoadBalancerLoadBalancingRulesGetResponse{}, err + return LoadBalancerLoadBalancingRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -137,7 +145,7 @@ func (client *LoadBalancerLoadBalancingRulesClient) listCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -147,7 +155,7 @@ func (client *LoadBalancerLoadBalancingRulesClient) listCreateRequest(ctx contex func (client *LoadBalancerLoadBalancingRulesClient) listHandleResponse(resp *http.Response) (LoadBalancerLoadBalancingRulesListResponse, error) { result := LoadBalancerLoadBalancingRulesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancerLoadBalancingRuleListResult); err != nil { - return LoadBalancerLoadBalancingRulesListResponse{}, err + return LoadBalancerLoadBalancingRulesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancernetworkinterfaces_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancernetworkinterfaces_client.go index 5fc0208c6500..6e4bb22933b2 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancernetworkinterfaces_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancernetworkinterfaces_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LoadBalancerNetworkInterfacesClient contains the methods for the LoadBalancerNetworkInterfaces group. @@ -30,8 +31,15 @@ type LoadBalancerNetworkInterfacesClient struct { } // NewLoadBalancerNetworkInterfacesClient creates a new instance of LoadBalancerNetworkInterfacesClient with the specified values. -func NewLoadBalancerNetworkInterfacesClient(con *arm.Connection, subscriptionID string) *LoadBalancerNetworkInterfacesClient { - return &LoadBalancerNetworkInterfacesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLoadBalancerNetworkInterfacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LoadBalancerNetworkInterfacesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LoadBalancerNetworkInterfacesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets associated load balancer network interfaces. @@ -68,7 +76,7 @@ func (client *LoadBalancerNetworkInterfacesClient) listCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -78,7 +86,7 @@ func (client *LoadBalancerNetworkInterfacesClient) listCreateRequest(ctx context func (client *LoadBalancerNetworkInterfacesClient) listHandleResponse(resp *http.Response) (LoadBalancerNetworkInterfacesListResponse, error) { result := LoadBalancerNetworkInterfacesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterfaceListResult); err != nil { - return LoadBalancerNetworkInterfacesListResponse{}, err + return LoadBalancerNetworkInterfacesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalanceroutboundrules_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalanceroutboundrules_client.go index 793d83130f50..3ef4f4f7251a 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalanceroutboundrules_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalanceroutboundrules_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LoadBalancerOutboundRulesClient contains the methods for the LoadBalancerOutboundRules group. @@ -30,8 +31,15 @@ type LoadBalancerOutboundRulesClient struct { } // NewLoadBalancerOutboundRulesClient creates a new instance of LoadBalancerOutboundRulesClient with the specified values. -func NewLoadBalancerOutboundRulesClient(con *arm.Connection, subscriptionID string) *LoadBalancerOutboundRulesClient { - return &LoadBalancerOutboundRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLoadBalancerOutboundRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LoadBalancerOutboundRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LoadBalancerOutboundRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the specified load balancer outbound rule. @@ -75,7 +83,7 @@ func (client *LoadBalancerOutboundRulesClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -85,7 +93,7 @@ func (client *LoadBalancerOutboundRulesClient) getCreateRequest(ctx context.Cont func (client *LoadBalancerOutboundRulesClient) getHandleResponse(resp *http.Response) (LoadBalancerOutboundRulesGetResponse, error) { result := LoadBalancerOutboundRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OutboundRule); err != nil { - return LoadBalancerOutboundRulesGetResponse{}, err + return LoadBalancerOutboundRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -137,7 +145,7 @@ func (client *LoadBalancerOutboundRulesClient) listCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -147,7 +155,7 @@ func (client *LoadBalancerOutboundRulesClient) listCreateRequest(ctx context.Con func (client *LoadBalancerOutboundRulesClient) listHandleResponse(resp *http.Response) (LoadBalancerOutboundRulesListResponse, error) { result := LoadBalancerOutboundRulesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancerOutboundRuleListResult); err != nil { - return LoadBalancerOutboundRulesListResponse{}, err + return LoadBalancerOutboundRulesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancerprobes_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancerprobes_client.go index 9732f0f38dc4..aea98bb471f3 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancerprobes_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancerprobes_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LoadBalancerProbesClient contains the methods for the LoadBalancerProbes group. @@ -30,8 +31,15 @@ type LoadBalancerProbesClient struct { } // NewLoadBalancerProbesClient creates a new instance of LoadBalancerProbesClient with the specified values. -func NewLoadBalancerProbesClient(con *arm.Connection, subscriptionID string) *LoadBalancerProbesClient { - return &LoadBalancerProbesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLoadBalancerProbesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LoadBalancerProbesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LoadBalancerProbesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets load balancer probe. @@ -75,7 +83,7 @@ func (client *LoadBalancerProbesClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -85,7 +93,7 @@ func (client *LoadBalancerProbesClient) getCreateRequest(ctx context.Context, re func (client *LoadBalancerProbesClient) getHandleResponse(resp *http.Response) (LoadBalancerProbesGetResponse, error) { result := LoadBalancerProbesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Probe); err != nil { - return LoadBalancerProbesGetResponse{}, err + return LoadBalancerProbesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -137,7 +145,7 @@ func (client *LoadBalancerProbesClient) listCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -147,7 +155,7 @@ func (client *LoadBalancerProbesClient) listCreateRequest(ctx context.Context, r func (client *LoadBalancerProbesClient) listHandleResponse(resp *http.Response) (LoadBalancerProbesListResponse, error) { result := LoadBalancerProbesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancerProbeListResult); err != nil { - return LoadBalancerProbesListResponse{}, err + return LoadBalancerProbesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancers_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancers_client.go index 8e0c7bc793c4..5cb52dd8cc2f 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancers_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_loadbalancers_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LoadBalancersClient contains the methods for the LoadBalancers group. @@ -31,8 +31,15 @@ type LoadBalancersClient struct { } // NewLoadBalancersClient creates a new instance of LoadBalancersClient with the specified values. -func NewLoadBalancersClient(con *arm.Connection, subscriptionID string) *LoadBalancersClient { - return &LoadBalancersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLoadBalancersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LoadBalancersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LoadBalancersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a load balancer. @@ -92,7 +99,7 @@ func (client *LoadBalancersClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *LoadBalancersClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *LoadBalancersClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -237,7 +244,7 @@ func (client *LoadBalancersClient) getCreateRequest(ctx context.Context, resourc func (client *LoadBalancersClient) getHandleResponse(resp *http.Response) (LoadBalancersGetResponse, error) { result := LoadBalancersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancer); err != nil { - return LoadBalancersGetResponse{}, err + return LoadBalancersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -285,7 +292,7 @@ func (client *LoadBalancersClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -295,7 +302,7 @@ func (client *LoadBalancersClient) listCreateRequest(ctx context.Context, resour func (client *LoadBalancersClient) listHandleResponse(resp *http.Response) (LoadBalancersListResponse, error) { result := LoadBalancersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancerListResult); err != nil { - return LoadBalancersListResponse{}, err + return LoadBalancersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -339,7 +346,7 @@ func (client *LoadBalancersClient) listAllCreateRequest(ctx context.Context, opt return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -349,7 +356,7 @@ func (client *LoadBalancersClient) listAllCreateRequest(ctx context.Context, opt func (client *LoadBalancersClient) listAllHandleResponse(resp *http.Response) (LoadBalancersListAllResponse, error) { result := LoadBalancersListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancerListResult); err != nil { - return LoadBalancersListAllResponse{}, err + return LoadBalancersListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -367,6 +374,86 @@ func (client *LoadBalancersClient) listAllHandleError(resp *http.Response) error return runtime.NewResponseError(&errType, resp) } +// BeginListInboundNatRulePortMappings - List of inbound NAT rule port mappings. +// If the operation fails it returns the *CloudError error type. +func (client *LoadBalancersClient) BeginListInboundNatRulePortMappings(ctx context.Context, groupName string, loadBalancerName string, backendPoolName string, parameters QueryInboundNatRulePortMappingRequest, options *LoadBalancersBeginListInboundNatRulePortMappingsOptions) (LoadBalancersListInboundNatRulePortMappingsPollerResponse, error) { + resp, err := client.listInboundNatRulePortMappings(ctx, groupName, loadBalancerName, backendPoolName, parameters, options) + if err != nil { + return LoadBalancersListInboundNatRulePortMappingsPollerResponse{}, err + } + result := LoadBalancersListInboundNatRulePortMappingsPollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("LoadBalancersClient.ListInboundNatRulePortMappings", "location", resp, client.pl, client.listInboundNatRulePortMappingsHandleError) + if err != nil { + return LoadBalancersListInboundNatRulePortMappingsPollerResponse{}, err + } + result.Poller = &LoadBalancersListInboundNatRulePortMappingsPoller{ + pt: pt, + } + return result, nil +} + +// ListInboundNatRulePortMappings - List of inbound NAT rule port mappings. +// If the operation fails it returns the *CloudError error type. +func (client *LoadBalancersClient) listInboundNatRulePortMappings(ctx context.Context, groupName string, loadBalancerName string, backendPoolName string, parameters QueryInboundNatRulePortMappingRequest, options *LoadBalancersBeginListInboundNatRulePortMappingsOptions) (*http.Response, error) { + req, err := client.listInboundNatRulePortMappingsCreateRequest(ctx, groupName, loadBalancerName, backendPoolName, parameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted) { + return nil, client.listInboundNatRulePortMappingsHandleError(resp) + } + return resp, nil +} + +// listInboundNatRulePortMappingsCreateRequest creates the ListInboundNatRulePortMappings request. +func (client *LoadBalancersClient) listInboundNatRulePortMappingsCreateRequest(ctx context.Context, groupName string, loadBalancerName string, backendPoolName string, parameters QueryInboundNatRulePortMappingRequest, options *LoadBalancersBeginListInboundNatRulePortMappingsOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{groupName}/providers/Microsoft.Network/loadBalancers/{loadBalancerName}/backendAddressPools/{backendPoolName}/queryInboundNatRulePortMapping" + if groupName == "" { + return nil, errors.New("parameter groupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{groupName}", url.PathEscape(groupName)) + if loadBalancerName == "" { + return nil, errors.New("parameter loadBalancerName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{loadBalancerName}", url.PathEscape(loadBalancerName)) + if backendPoolName == "" { + return nil, errors.New("parameter backendPoolName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{backendPoolName}", url.PathEscape(backendPoolName)) + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, parameters) +} + +// listInboundNatRulePortMappingsHandleError handles the ListInboundNatRulePortMappings error response. +func (client *LoadBalancersClient) listInboundNatRulePortMappingsHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + // BeginSwapPublicIPAddresses - Swaps VIPs between two load balancers. // If the operation fails it returns the *CloudError error type. func (client *LoadBalancersClient) BeginSwapPublicIPAddresses(ctx context.Context, location string, parameters LoadBalancerVipSwapRequest, options *LoadBalancersBeginSwapPublicIPAddressesOptions) (LoadBalancersSwapPublicIPAddressesPollerResponse, error) { @@ -420,7 +507,7 @@ func (client *LoadBalancersClient) swapPublicIPAddressesCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -476,7 +563,7 @@ func (client *LoadBalancersClient) updateTagsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -486,7 +573,7 @@ func (client *LoadBalancersClient) updateTagsCreateRequest(ctx context.Context, func (client *LoadBalancersClient) updateTagsHandleResponse(resp *http.Response) (LoadBalancersUpdateTagsResponse, error) { result := LoadBalancersUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LoadBalancer); err != nil { - return LoadBalancersUpdateTagsResponse{}, err + return LoadBalancersUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_localnetworkgateways_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_localnetworkgateways_client.go index 281d27704469..55eda7d6a231 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_localnetworkgateways_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_localnetworkgateways_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LocalNetworkGatewaysClient contains the methods for the LocalNetworkGateways group. @@ -31,8 +31,15 @@ type LocalNetworkGatewaysClient struct { } // NewLocalNetworkGatewaysClient creates a new instance of LocalNetworkGatewaysClient with the specified values. -func NewLocalNetworkGatewaysClient(con *arm.Connection, subscriptionID string) *LocalNetworkGatewaysClient { - return &LocalNetworkGatewaysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLocalNetworkGatewaysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LocalNetworkGatewaysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LocalNetworkGatewaysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a local network gateway in the specified resource group. @@ -92,7 +99,7 @@ func (client *LocalNetworkGatewaysClient) createOrUpdateCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *LocalNetworkGatewaysClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *LocalNetworkGatewaysClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +241,7 @@ func (client *LocalNetworkGatewaysClient) getCreateRequest(ctx context.Context, func (client *LocalNetworkGatewaysClient) getHandleResponse(resp *http.Response) (LocalNetworkGatewaysGetResponse, error) { result := LocalNetworkGatewaysGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LocalNetworkGateway); err != nil { - return LocalNetworkGatewaysGetResponse{}, err + return LocalNetworkGatewaysGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -282,7 +289,7 @@ func (client *LocalNetworkGatewaysClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -292,7 +299,7 @@ func (client *LocalNetworkGatewaysClient) listCreateRequest(ctx context.Context, func (client *LocalNetworkGatewaysClient) listHandleResponse(resp *http.Response) (LocalNetworkGatewaysListResponse, error) { result := LocalNetworkGatewaysListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LocalNetworkGatewayListResult); err != nil { - return LocalNetworkGatewaysListResponse{}, err + return LocalNetworkGatewaysListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -347,7 +354,7 @@ func (client *LocalNetworkGatewaysClient) updateTagsCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -357,7 +364,7 @@ func (client *LocalNetworkGatewaysClient) updateTagsCreateRequest(ctx context.Co func (client *LocalNetworkGatewaysClient) updateTagsHandleResponse(resp *http.Response) (LocalNetworkGatewaysUpdateTagsResponse, error) { result := LocalNetworkGatewaysUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LocalNetworkGateway); err != nil { - return LocalNetworkGatewaysUpdateTagsResponse{}, err + return LocalNetworkGatewaysUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_models.go b/sdk/resourcemanager/network/armnetwork/zz_generated_models.go index 674e014bc2ec..f997183f4f48 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_models.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_models.go @@ -10,10 +10,9 @@ package armnetwork import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // AADAuthenticationParameters - AAD Vpn authentication type related parameters. @@ -3201,7 +3200,7 @@ type AzureReachabilityReportLatencyInfo struct { func (a AzureReachabilityReportLatencyInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "score", a.Score) - populate(objectMap, "timeStamp", (*timeRFC3339)(a.TimeStamp)) + populateTimeRFC3339(objectMap, "timeStamp", a.TimeStamp) return json.Marshal(objectMap) } @@ -3218,9 +3217,7 @@ func (a *AzureReachabilityReportLatencyInfo) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.Score) delete(rawMsg, key) case "timeStamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.TimeStamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.TimeStamp) delete(rawMsg, key) } if err != nil { @@ -3264,10 +3261,10 @@ type AzureReachabilityReportParameters struct { func (a AzureReachabilityReportParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "azureLocations", a.AzureLocations) - populate(objectMap, "endTime", (*timeRFC3339)(a.EndTime)) + populateTimeRFC3339(objectMap, "endTime", a.EndTime) populate(objectMap, "providerLocation", a.ProviderLocation) populate(objectMap, "providers", a.Providers) - populate(objectMap, "startTime", (*timeRFC3339)(a.StartTime)) + populateTimeRFC3339(objectMap, "startTime", a.StartTime) return json.Marshal(objectMap) } @@ -3284,9 +3281,7 @@ func (a *AzureReachabilityReportParameters) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.AzureLocations) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.EndTime) delete(rawMsg, key) case "providerLocation": err = unpopulate(val, &a.ProviderLocation) @@ -3295,9 +3290,7 @@ func (a *AzureReachabilityReportParameters) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.Providers) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.StartTime) delete(rawMsg, key) } if err != nil { @@ -3381,6 +3374,19 @@ func (b BGPCommunity) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// BackendAddressInboundNatRulePortMappings - The response for a QueryInboundNatRulePortMapping API. +type BackendAddressInboundNatRulePortMappings struct { + // Collection of inbound NAT rule port mappings. + InboundNatRulePortMappings []*InboundNatRulePortMapping `json:"inboundNatRulePortMappings,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type BackendAddressInboundNatRulePortMappings. +func (b BackendAddressInboundNatRulePortMappings) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "inboundNatRulePortMappings", b.InboundNatRulePortMappings) + return json.Marshal(objectMap) +} + // BackendAddressPool - Pool of backend IP addresses. type BackendAddressPool struct { SubResource @@ -3422,6 +3428,9 @@ type BackendAddressPoolPropertiesFormat struct { // READ-ONLY; An array of references to IP addresses defined in network interfaces. BackendIPConfigurations []*NetworkInterfaceIPConfiguration `json:"backendIPConfigurations,omitempty" azure:"ro"` + // READ-ONLY; An array of references to inbound NAT rules that use this backend address pool. + InboundNatRules []*SubResource `json:"inboundNatRules,omitempty" azure:"ro"` + // READ-ONLY; An array of references to load balancing rules that use this backend address pool. LoadBalancingRules []*SubResource `json:"loadBalancingRules,omitempty" azure:"ro"` @@ -3439,6 +3448,7 @@ type BackendAddressPoolPropertiesFormat struct { func (b BackendAddressPoolPropertiesFormat) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "backendIPConfigurations", b.BackendIPConfigurations) + populate(objectMap, "inboundNatRules", b.InboundNatRules) populate(objectMap, "loadBalancerBackendAddresses", b.LoadBalancerBackendAddresses) populate(objectMap, "loadBalancingRules", b.LoadBalancingRules) populate(objectMap, "location", b.Location) @@ -4303,7 +4313,7 @@ func (c ConnectionMonitorResultProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "connectionMonitorType", c.ConnectionMonitorType) populate(objectMap, "monitoringStatus", c.MonitoringStatus) populate(objectMap, "provisioningState", c.ProvisioningState) - populate(objectMap, "startTime", (*timeRFC3339)(c.StartTime)) + populateTimeRFC3339(objectMap, "startTime", c.StartTime) return json.Marshal(objectMap) } @@ -4326,9 +4336,7 @@ func (c *ConnectionMonitorResultProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.ProvisioningState) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.StartTime) delete(rawMsg, key) } if err != nil { @@ -4533,14 +4541,14 @@ func (c ConnectionStateSnapshot) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "avgLatencyInMs", c.AvgLatencyInMs) populate(objectMap, "connectionState", c.ConnectionState) - populate(objectMap, "endTime", (*timeRFC3339)(c.EndTime)) + populateTimeRFC3339(objectMap, "endTime", c.EndTime) populate(objectMap, "evaluationState", c.EvaluationState) populate(objectMap, "hops", c.Hops) populate(objectMap, "maxLatencyInMs", c.MaxLatencyInMs) populate(objectMap, "minLatencyInMs", c.MinLatencyInMs) populate(objectMap, "probesFailed", c.ProbesFailed) populate(objectMap, "probesSent", c.ProbesSent) - populate(objectMap, "startTime", (*timeRFC3339)(c.StartTime)) + populateTimeRFC3339(objectMap, "startTime", c.StartTime) return json.Marshal(objectMap) } @@ -4560,9 +4568,7 @@ func (c *ConnectionStateSnapshot) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.ConnectionState) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.EndTime) delete(rawMsg, key) case "evaluationState": err = unpopulate(val, &c.EvaluationState) @@ -4583,9 +4589,7 @@ func (c *ConnectionStateSnapshot) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.ProbesSent) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.StartTime) delete(rawMsg, key) } if err != nil { @@ -4940,13 +4944,13 @@ type CustomIPPrefixPropertiesFormat struct { CommissionedState *CommissionedState `json:"commissionedState,omitempty"` // The Parent CustomIpPrefix for IPv6 /64 CustomIpPrefix. - CustomIPPrefixParent *CustomIPPrefix `json:"customIpPrefixParent,omitempty"` + CustomIPPrefixParent *SubResource `json:"customIpPrefixParent,omitempty"` // Signed message for WAN validation. SignedMessage *string `json:"signedMessage,omitempty"` // READ-ONLY; The list of all Children for IPv6 /48 CustomIpPrefix. - ChildCustomIPPrefixes []*CustomIPPrefix `json:"childCustomIpPrefixes,omitempty" azure:"ro"` + ChildCustomIPPrefixes []*SubResource `json:"childCustomIpPrefixes,omitempty" azure:"ro"` // READ-ONLY; The reason why resource is in failed state. FailedReason *string `json:"failedReason,omitempty" azure:"ro"` @@ -5709,6 +5713,50 @@ func (e EvaluatedNetworkSecurityGroup) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// ExclusionManagedRule - Defines a managed rule to use for exclusion. +type ExclusionManagedRule struct { + // REQUIRED; Identifier for the managed rule. + RuleID *string `json:"ruleId,omitempty"` +} + +// ExclusionManagedRuleGroup - Defines a managed rule group to use for exclusion. +type ExclusionManagedRuleGroup struct { + // REQUIRED; The managed rule group for exclusion. + RuleGroupName *string `json:"ruleGroupName,omitempty"` + + // List of rules that will be excluded. If none specified, all rules in the group will be excluded. + Rules []*ExclusionManagedRule `json:"rules,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ExclusionManagedRuleGroup. +func (e ExclusionManagedRuleGroup) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ruleGroupName", e.RuleGroupName) + populate(objectMap, "rules", e.Rules) + return json.Marshal(objectMap) +} + +// ExclusionManagedRuleSet - Defines a managed rule set for Exclusions. +type ExclusionManagedRuleSet struct { + // REQUIRED; Defines the rule set type to use. + RuleSetType *string `json:"ruleSetType,omitempty"` + + // REQUIRED; Defines the version of the rule set to use. + RuleSetVersion *string `json:"ruleSetVersion,omitempty"` + + // Defines the rule groups to apply to the rule set. + RuleGroups []*ExclusionManagedRuleGroup `json:"ruleGroups,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ExclusionManagedRuleSet. +func (e ExclusionManagedRuleSet) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ruleGroups", e.RuleGroups) + populate(objectMap, "ruleSetType", e.RuleSetType) + populate(objectMap, "ruleSetVersion", e.RuleSetVersion) + return json.Marshal(objectMap) +} + // ExplicitProxySettings - Explicit Proxy Settings in Firewall Policy. type ExplicitProxySettings struct { // When set to true, explicit proxy mode is enabled. @@ -7187,6 +7235,23 @@ type ExtendedLocation struct { Type *ExtendedLocationTypes `json:"type,omitempty"` } +// FilterItems - Will contain the filter name and values to operate on +type FilterItems struct { + // The name of the field we would like to filter + Field *string `json:"field,omitempty"` + + // List of values to filter the current field by + Values []*string `json:"values,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type FilterItems. +func (f FilterItems) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "field", f.Field) + populate(objectMap, "values", f.Values) + return json.Marshal(objectMap) +} + // FirewallPoliciesBeginCreateOrUpdateOptions contains the optional parameters for the FirewallPolicies.BeginCreateOrUpdate method. type FirewallPoliciesBeginCreateOrUpdateOptions struct { // placeholder for future optional parameters @@ -7296,6 +7361,36 @@ type FirewallPolicyFilterRuleCollectionAction struct { Type *FirewallPolicyFilterRuleCollectionActionType `json:"type,omitempty"` } +// FirewallPolicyIdpsSignaturesFilterValuesListOptions contains the optional parameters for the FirewallPolicyIdpsSignaturesFilterValues.List method. +type FirewallPolicyIdpsSignaturesFilterValuesListOptions struct { + // placeholder for future optional parameters +} + +// FirewallPolicyIdpsSignaturesListOptions contains the optional parameters for the FirewallPolicyIdpsSignatures.List method. +type FirewallPolicyIdpsSignaturesListOptions struct { + // placeholder for future optional parameters +} + +// FirewallPolicyIdpsSignaturesOverridesGetOptions contains the optional parameters for the FirewallPolicyIdpsSignaturesOverrides.Get method. +type FirewallPolicyIdpsSignaturesOverridesGetOptions struct { + // placeholder for future optional parameters +} + +// FirewallPolicyIdpsSignaturesOverridesListOptions contains the optional parameters for the FirewallPolicyIdpsSignaturesOverrides.List method. +type FirewallPolicyIdpsSignaturesOverridesListOptions struct { + // placeholder for future optional parameters +} + +// FirewallPolicyIdpsSignaturesOverridesPatchOptions contains the optional parameters for the FirewallPolicyIdpsSignaturesOverrides.Patch method. +type FirewallPolicyIdpsSignaturesOverridesPatchOptions struct { + // placeholder for future optional parameters +} + +// FirewallPolicyIdpsSignaturesOverridesPutOptions contains the optional parameters for the FirewallPolicyIdpsSignaturesOverrides.Put method. +type FirewallPolicyIdpsSignaturesOverridesPutOptions struct { + // placeholder for future optional parameters +} + // FirewallPolicyInsights - Firewall Policy Insights. type FirewallPolicyInsights struct { // A flag to indicate if the insights are enabled on the policy. @@ -8454,6 +8549,35 @@ type HubVirtualNetworkConnectionsListOptions struct { // placeholder for future optional parameters } +// IDPSQueryObject - Will describe the query to run against the IDPS signatures DB +type IDPSQueryObject struct { + // Contain all filters names and values + Filters []*FilterItems `json:"filters,omitempty"` + + // Column to sort response by + OrderBy *OrderBy `json:"orderBy,omitempty"` + + // The number of the results to return in each page + ResultsPerPage *int32 `json:"resultsPerPage,omitempty"` + + // Search term in all columns + Search *string `json:"search,omitempty"` + + // The number of records matching the filter to skip + Skip *int32 `json:"skip,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type IDPSQueryObject. +func (i IDPSQueryObject) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filters", i.Filters) + populate(objectMap, "orderBy", i.OrderBy) + populate(objectMap, "resultsPerPage", i.ResultsPerPage) + populate(objectMap, "search", i.Search) + populate(objectMap, "skip", i.Skip) + return json.Marshal(objectMap) +} + // IPAddressAvailabilityResult - Response for CheckIPAddressAvailability API service call. type IPAddressAvailabilityResult struct { // Private IP address availability. @@ -8909,7 +9033,7 @@ type InboundNatRule struct { // The name of the resource that is unique within the set of inbound NAT rules used by the load balancer. This name can be used to access the resource. Name *string `json:"name,omitempty"` - // Properties of load balancer inbound nat rule. + // Properties of load balancer inbound NAT rule. Properties *InboundNatRulePropertiesFormat `json:"properties,omitempty"` // READ-ONLY; A unique read-only string that changes whenever the resource is updated. @@ -8932,7 +9056,7 @@ func (i InboundNatRule) MarshalJSON() ([]byte, error) { // InboundNatRuleListResult - Response for ListInboundNatRule API service call. type InboundNatRuleListResult struct { - // A list of inbound nat rules in a load balancer. + // A list of inbound NAT rules in a load balancer. Value []*InboundNatRule `json:"value,omitempty"` // READ-ONLY; The URL to get the next set of results. @@ -8947,6 +9071,21 @@ func (i InboundNatRuleListResult) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// InboundNatRulePortMapping - Individual port mappings for inbound NAT rule created for backend pool. +type InboundNatRulePortMapping struct { + // READ-ONLY; Backend port. + BackendPort *int32 `json:"backendPort,omitempty" azure:"ro"` + + // READ-ONLY; Frontend port. + FrontendPort *int32 `json:"frontendPort,omitempty" azure:"ro"` + + // READ-ONLY; Name of inbound NAT rule. + InboundNatRuleName *string `json:"inboundNatRuleName,omitempty" azure:"ro"` + + // READ-ONLY; The reference to the transport protocol used by the inbound NAT rule. + Protocol *TransportProtocol `json:"protocol,omitempty" azure:"ro"` +} + // InboundNatRulePropertiesFormat - Properties of the inbound NAT rule. type InboundNatRulePropertiesFormat struct { // A reference to backendAddressPool resource. @@ -9129,6 +9268,23 @@ func (l ListP2SVPNGatewaysResult) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// ListRoutingIntentResult - List of the routing intent result and a URL nextLink to get the next set of results. +type ListRoutingIntentResult struct { + // URL to get the next set of operation list results if there are any. + NextLink *string `json:"nextLink,omitempty"` + + // List of RoutingIntent resource. + Value []*RoutingIntent `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type ListRoutingIntentResult. +func (l ListRoutingIntentResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", l.NextLink) + populate(objectMap, "value", l.Value) + return json.Marshal(objectMap) +} + // ListVPNConnectionsResult - Result of the request to list all vpn connections to a virtual wan vpn gateway. It contains a list of Vpn Connections and // a URL nextLink to get the next set of results. type ListVPNConnectionsResult struct { @@ -9443,10 +9599,25 @@ type LoadBalancerBackendAddressPropertiesFormat struct { // Reference to an existing virtual network. VirtualNetwork *SubResource `json:"virtualNetwork,omitempty"` + // READ-ONLY; Collection of inbound NAT rule port mappings. + InboundNatRulesPortMapping []*NatRulePortMapping `json:"inboundNatRulesPortMapping,omitempty" azure:"ro"` + // READ-ONLY; Reference to IP address defined in network interfaces. NetworkInterfaceIPConfiguration *SubResource `json:"networkInterfaceIPConfiguration,omitempty" azure:"ro"` } +// MarshalJSON implements the json.Marshaller interface for type LoadBalancerBackendAddressPropertiesFormat. +func (l LoadBalancerBackendAddressPropertiesFormat) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "ipAddress", l.IPAddress) + populate(objectMap, "inboundNatRulesPortMapping", l.InboundNatRulesPortMapping) + populate(objectMap, "loadBalancerFrontendIPConfiguration", l.LoadBalancerFrontendIPConfiguration) + populate(objectMap, "networkInterfaceIPConfiguration", l.NetworkInterfaceIPConfiguration) + populate(objectMap, "subnet", l.Subnet) + populate(objectMap, "virtualNetwork", l.VirtualNetwork) + return json.Marshal(objectMap) +} + // LoadBalancerFrontendIPConfigurationListResult - Response for ListFrontendIPConfiguration API service call. type LoadBalancerFrontendIPConfigurationListResult struct { // A list of frontend IP configurations in a load balancer. @@ -9587,7 +9758,7 @@ type LoadBalancerPropertiesFormat struct { // Defines an external port range for inbound NAT to a single backend port on NICs associated with a load balancer. Inbound NAT rules are created automatically // for each NIC associated with the Load - // Balancer using an external port from this range. Defining an Inbound NAT pool on your Load Balancer is mutually exclusive with defining inbound Nat rules. + // Balancer using an external port from this range. Defining an Inbound NAT pool on your Load Balancer is mutually exclusive with defining inbound NAT rules. // Inbound NAT pools are referenced from virtual // machine scale sets. NICs that are associated with individual virtual machines cannot reference an inbound NAT pool. They have to reference individual // inbound NAT rules. @@ -9677,6 +9848,11 @@ type LoadBalancersBeginDeleteOptions struct { // placeholder for future optional parameters } +// LoadBalancersBeginListInboundNatRulePortMappingsOptions contains the optional parameters for the LoadBalancers.BeginListInboundNatRulePortMappings method. +type LoadBalancersBeginListInboundNatRulePortMappingsOptions struct { + // placeholder for future optional parameters +} + // LoadBalancersBeginSwapPublicIPAddressesOptions contains the optional parameters for the LoadBalancers.BeginSwapPublicIPAddresses method. type LoadBalancersBeginSwapPublicIPAddressesOptions struct { // placeholder for future optional parameters @@ -10295,6 +10471,18 @@ func (n *NatRule) UnmarshalJSON(data []byte) error { return nil } +// NatRulePortMapping - Individual port mappings for inbound NAT rule created for backend pool. +type NatRulePortMapping struct { + // Backend port. + BackendPort *int32 `json:"backendPort,omitempty"` + + // Frontend port. + FrontendPort *int32 `json:"frontendPort,omitempty"` + + // Name of inbound NAT rule. + InboundNatRuleName *string `json:"inboundNatRuleName,omitempty"` +} + // NatRulesBeginCreateOrUpdateOptions contains the optional parameters for the NatRules.BeginCreateOrUpdate method. type NatRulesBeginCreateOrUpdateOptions struct { // placeholder for future optional parameters @@ -10710,6 +10898,9 @@ type NetworkInterfacePropertiesFormat struct { // READ-ONLY; The reference to a virtual machine. VirtualMachine *SubResource `json:"virtualMachine,omitempty" azure:"ro"` + + // READ-ONLY; Whether the virtual machine this nic is attached to supports encryption. + VnetEncryptionSupported *bool `json:"vnetEncryptionSupported,omitempty" azure:"ro"` } // MarshalJSON implements the json.Marshaller interface for type NetworkInterfacePropertiesFormat. @@ -10732,6 +10923,7 @@ func (n NetworkInterfacePropertiesFormat) MarshalJSON() ([]byte, error) { populate(objectMap, "resourceGuid", n.ResourceGUID) populate(objectMap, "tapConfigurations", n.TapConfigurations) populate(objectMap, "virtualMachine", n.VirtualMachine) + populate(objectMap, "vnetEncryptionSupported", n.VnetEncryptionSupported) populate(objectMap, "workloadType", n.WorkloadType) return json.Marshal(objectMap) } @@ -11729,6 +11921,15 @@ type OperationsListOptions struct { // placeholder for future optional parameters } +// OrderBy - Describes a column to sort +type OrderBy struct { + // Describes the actual column name to sort by + Field *string `json:"field,omitempty"` + + // Describes if results should be in ascending/descending order + Order *OrderByOrder `json:"order,omitempty"` +} + // OutboundRule - Outbound rule of the load balancer. type OutboundRule struct { SubResource @@ -11804,6 +12005,19 @@ type OwaspCrsExclusionEntry struct { // REQUIRED; When matchVariable is a collection, operate on the selector to specify which elements in the collection this exclusion applies to. SelectorMatchOperator *OwaspCrsExclusionEntrySelectorMatchOperator `json:"selectorMatchOperator,omitempty"` + + // The managed rule sets that are associated with the exclusion. + ExclusionManagedRuleSets []*ExclusionManagedRuleSet `json:"exclusionManagedRuleSets,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type OwaspCrsExclusionEntry. +func (o OwaspCrsExclusionEntry) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "exclusionManagedRuleSets", o.ExclusionManagedRuleSets) + populate(objectMap, "matchVariable", o.MatchVariable) + populate(objectMap, "selector", o.Selector) + populate(objectMap, "selectorMatchOperator", o.SelectorMatchOperator) + return json.Marshal(objectMap) } // P2SConnectionConfiguration Resource. @@ -12108,7 +12322,7 @@ type PacketCaptureQueryStatusResult struct { // MarshalJSON implements the json.Marshaller interface for type PacketCaptureQueryStatusResult. func (p PacketCaptureQueryStatusResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "captureStartTime", (*timeRFC3339)(p.CaptureStartTime)) + populateTimeRFC3339(objectMap, "captureStartTime", p.CaptureStartTime) populate(objectMap, "id", p.ID) populate(objectMap, "name", p.Name) populate(objectMap, "packetCaptureError", p.PacketCaptureError) @@ -12127,9 +12341,7 @@ func (p *PacketCaptureQueryStatusResult) UnmarshalJSON(data []byte) error { var err error switch key { case "captureStartTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - p.CaptureStartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &p.CaptureStartTime) delete(rawMsg, key) case "id": err = unpopulate(val, &p.ID) @@ -13543,6 +13755,32 @@ type QosPortRange struct { Start *int32 `json:"start,omitempty"` } +// QueryInboundNatRulePortMappingRequest - The request for a QueryInboundNatRulePortMapping API. Either IpConfiguration or IpAddress should be set +type QueryInboundNatRulePortMappingRequest struct { + // IP address set in load balancer backend address. + IPAddress *string `json:"ipAddress,omitempty"` + + // NetworkInterfaceIPConfiguration set in load balancer backend address. + IPConfiguration *SubResource `json:"ipConfiguration,omitempty"` +} + +// QueryResults - Query result +type QueryResults struct { + // Number of total records matching the query. + MatchingRecordsCount *int64 `json:"matchingRecordsCount,omitempty"` + + // Array containing the results of the query + Signatures []*SingleQueryResult `json:"signatures,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type QueryResults. +func (q QueryResults) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "matchingRecordsCount", q.MatchingRecordsCount) + populate(objectMap, "signatures", q.Signatures) + return json.Marshal(objectMap) +} + // QueryTroubleshootingParameters - Parameters that define the resource to query the troubleshooting result. type QueryTroubleshootingParameters struct { // REQUIRED; The target resource ID to query the troubleshooting result. @@ -14091,6 +14329,91 @@ type RoutingConfiguration struct { VnetRoutes *VnetRoute `json:"vnetRoutes,omitempty"` } +// RoutingIntent - The routing intent child resource of a Virtual hub. +type RoutingIntent struct { + SubResource + // The name of the resource that is unique within a resource group. This name can be used to access the resource. + Name *string `json:"name,omitempty"` + + // Properties of the RoutingIntent resource. + Properties *RoutingIntentProperties `json:"properties,omitempty"` + + // READ-ONLY; A unique read-only string that changes whenever the resource is updated. + Etag *string `json:"etag,omitempty" azure:"ro"` + + // READ-ONLY; Resource type. + Type *string `json:"type,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type RoutingIntent. +func (r RoutingIntent) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + r.SubResource.marshalInternal(objectMap) + populate(objectMap, "etag", r.Etag) + populate(objectMap, "name", r.Name) + populate(objectMap, "properties", r.Properties) + populate(objectMap, "type", r.Type) + return json.Marshal(objectMap) +} + +// RoutingIntentBeginCreateOrUpdateOptions contains the optional parameters for the RoutingIntent.BeginCreateOrUpdate method. +type RoutingIntentBeginCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// RoutingIntentBeginDeleteOptions contains the optional parameters for the RoutingIntent.BeginDelete method. +type RoutingIntentBeginDeleteOptions struct { + // placeholder for future optional parameters +} + +// RoutingIntentGetOptions contains the optional parameters for the RoutingIntent.Get method. +type RoutingIntentGetOptions struct { + // placeholder for future optional parameters +} + +// RoutingIntentListOptions contains the optional parameters for the RoutingIntent.List method. +type RoutingIntentListOptions struct { + // placeholder for future optional parameters +} + +// RoutingIntentProperties - The properties of a RoutingIntent resource. +type RoutingIntentProperties struct { + // List of routing policies. + RoutingPolicies []*RoutingPolicy `json:"routingPolicies,omitempty"` + + // READ-ONLY; The provisioning state of the RoutingIntent resource. + ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type RoutingIntentProperties. +func (r RoutingIntentProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "provisioningState", r.ProvisioningState) + populate(objectMap, "routingPolicies", r.RoutingPolicies) + return json.Marshal(objectMap) +} + +// RoutingPolicy - The routing policy object used in a RoutingIntent resource. +type RoutingPolicy struct { + // REQUIRED; List of all destinations which this routing policy is applicable to (for example: Internet, PrivateTraffic). + Destinations []*string `json:"destinations,omitempty"` + + // REQUIRED; The unique name for the routing policy. + Name *string `json:"name,omitempty"` + + // REQUIRED; The next hop resource id on which this routing policy is applicable to. + NextHop *string `json:"nextHop,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type RoutingPolicy. +func (r RoutingPolicy) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "destinations", r.Destinations) + populate(objectMap, "name", r.Name) + populate(objectMap, "nextHop", r.NextHop) + return json.Marshal(objectMap) +} + // SKU - The sku of this Bastion Host. type SKU struct { // The name of this Bastion Host. @@ -14813,6 +15136,128 @@ func (s SessionIDs) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// SignatureOverridesFilterValuesQuery - Describes the filter values possibles for a given column +type SignatureOverridesFilterValuesQuery struct { + // Describes the name of the column which values will be returned + FilterName *string `json:"filterName,omitempty"` +} + +// SignatureOverridesFilterValuesResponse - Describes the list of all possible values for a specific filter value +type SignatureOverridesFilterValuesResponse struct { + // Describes the possible values + FilterValues []*string `json:"filterValues,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SignatureOverridesFilterValuesResponse. +func (s SignatureOverridesFilterValuesResponse) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "filterValues", s.FilterValues) + return json.Marshal(objectMap) +} + +// SignaturesOverrides - Contains all specific policy signatures overrides for the IDPS +type SignaturesOverrides struct { + // Will contain the resource id of the signature override resource + ID *string `json:"id,omitempty"` + + // Contains the name of the resource (default) + Name *string `json:"name,omitempty"` + + // Will contain the properties of the resource (the actual signature overrides) + Properties *SignaturesOverridesProperties `json:"properties,omitempty"` + + // Will contain the type of the resource: Microsoft.Network/firewallPolicies/intrusionDetectionSignaturesOverrides + Type *string `json:"type,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SignaturesOverrides. +func (s SignaturesOverrides) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "id", s.ID) + populate(objectMap, "name", s.Name) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "type", s.Type) + return json.Marshal(objectMap) +} + +// SignaturesOverridesList - Describes an object containing an array with a single item +type SignaturesOverridesList struct { + // Describes a list consisting exactly one item describing the policy's signature override status + Value []*SignaturesOverrides `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SignaturesOverridesList. +func (s SignaturesOverridesList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// SignaturesOverridesProperties - Will contain the properties of the resource (the actual signature overrides) +type SignaturesOverridesProperties struct { + // Dictionary of + Signatures map[string]*string `json:"signatures,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SignaturesOverridesProperties. +func (s SignaturesOverridesProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "signatures", s.Signatures) + return json.Marshal(objectMap) +} + +type SingleQueryResult struct { + // Describes what is the signature enforces + Description *string `json:"description,omitempty"` + + // Describes the list of destination ports related to this signature + DestinationPorts []*string `json:"destinationPorts,omitempty"` + + // Describes in which direction signature is being enforced: 0 - Inbound, 1 - OutBound, 2 - Bidirectional + Direction *SingleQueryResultDirection `json:"direction,omitempty"` + + // Describes the groups the signature belongs to + Group *string `json:"group,omitempty"` + + // Describes if this override is inherited from base policy or not + InheritedFromParentPolicy *bool `json:"inheritedFromParentPolicy,omitempty"` + + // Describes the last updated time of the signature (provided from 3rd party vendor) + LastUpdated *string `json:"lastUpdated,omitempty"` + + // The current mode enforced, 0 - Disabled, 1 - Alert, 2 -Deny + Mode *SingleQueryResultMode `json:"mode,omitempty"` + + // Describes the protocol the signatures is being enforced in + Protocol *string `json:"protocol,omitempty"` + + // Describes the severity of signature: 1 - Low, 2 - Medium, 3 - High + Severity *SingleQueryResultSeverity `json:"severity,omitempty"` + + // The ID of the signature + SignatureID *int32 `json:"signatureId,omitempty"` + + // Describes the list of source ports related to this signature + SourcePorts []*string `json:"sourcePorts,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SingleQueryResult. +func (s SingleQueryResult) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "description", s.Description) + populate(objectMap, "destinationPorts", s.DestinationPorts) + populate(objectMap, "direction", s.Direction) + populate(objectMap, "group", s.Group) + populate(objectMap, "inheritedFromParentPolicy", s.InheritedFromParentPolicy) + populate(objectMap, "lastUpdated", s.LastUpdated) + populate(objectMap, "mode", s.Mode) + populate(objectMap, "protocol", s.Protocol) + populate(objectMap, "severity", s.Severity) + populate(objectMap, "signatureId", s.SignatureID) + populate(objectMap, "sourcePorts", s.SourcePorts) + return json.Marshal(objectMap) +} + // StaticRoute - List of all Static Routes. type StaticRoute struct { // List of all address prefixes. @@ -15059,9 +15504,9 @@ type Topology struct { // MarshalJSON implements the json.Marshaller interface for type Topology. func (t Topology) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdDateTime", (*timeRFC3339)(t.CreatedDateTime)) + populateTimeRFC3339(objectMap, "createdDateTime", t.CreatedDateTime) populate(objectMap, "id", t.ID) - populate(objectMap, "lastModified", (*timeRFC3339)(t.LastModified)) + populateTimeRFC3339(objectMap, "lastModified", t.LastModified) populate(objectMap, "resources", t.Resources) return json.Marshal(objectMap) } @@ -15076,17 +15521,13 @@ func (t *Topology) UnmarshalJSON(data []byte) error { var err error switch key { case "createdDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.CreatedDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.CreatedDateTime) delete(rawMsg, key) case "id": err = unpopulate(val, &t.ID) delete(rawMsg, key) case "lastModified": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.LastModified = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.LastModified) delete(rawMsg, key) case "resources": err = unpopulate(val, &t.Resources) @@ -15270,9 +15711,9 @@ type TroubleshootingResult struct { func (t TroubleshootingResult) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "code", t.Code) - populate(objectMap, "endTime", (*timeRFC3339)(t.EndTime)) + populateTimeRFC3339(objectMap, "endTime", t.EndTime) populate(objectMap, "results", t.Results) - populate(objectMap, "startTime", (*timeRFC3339)(t.StartTime)) + populateTimeRFC3339(objectMap, "startTime", t.StartTime) return json.Marshal(objectMap) } @@ -15289,17 +15730,13 @@ func (t *TroubleshootingResult) UnmarshalJSON(data []byte) error { err = unpopulate(val, &t.Code) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.EndTime) delete(rawMsg, key) case "results": err = unpopulate(val, &t.Results) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.StartTime) delete(rawMsg, key) } if err != nil { @@ -16066,6 +16503,9 @@ type VPNLinkProviderProperties struct { type VPNNatRuleMapping struct { // Address space for Vpn NatRule mapping. AddressSpace *string `json:"addressSpace,omitempty"` + + // Port range for Vpn NatRule mapping. + PortRange *string `json:"portRange,omitempty"` } // VPNPacketCaptureStartParameters - Start packet capture parameters on virtual network gateway. @@ -17062,6 +17502,15 @@ type VirtualNetworkConnectionGatewayReference struct { ID *string `json:"id,omitempty"` } +// VirtualNetworkEncryption - Indicates if encryption is enabled on virtual network and if VM without encryption is allowed in encrypted VNet. +type VirtualNetworkEncryption struct { + // REQUIRED; Indicates if encryption is enabled on the virtual network. + Enabled *bool `json:"enabled,omitempty"` + + // If the encrypted VNet allows VM that does not support encryption + Enforcement *VirtualNetworkEncryptionEnforcement `json:"enforcement,omitempty"` +} + // VirtualNetworkGateway - A common class for general resource information. type VirtualNetworkGateway struct { Resource @@ -17577,6 +18026,9 @@ type VirtualNetworkGatewayPropertiesFormat struct { // VpnClient. CustomRoutes *AddressSpace `json:"customRoutes,omitempty"` + // disableIPSecReplayProtection flag. + DisableIPSecReplayProtection *bool `json:"disableIPSecReplayProtection,omitempty"` + // Whether BGP is enabled for this virtual network gateway or not. EnableBgp *bool `json:"enableBgp,omitempty"` @@ -17633,6 +18085,7 @@ func (v VirtualNetworkGatewayPropertiesFormat) MarshalJSON() ([]byte, error) { populate(objectMap, "activeActive", v.Active) populate(objectMap, "bgpSettings", v.BgpSettings) populate(objectMap, "customRoutes", v.CustomRoutes) + populate(objectMap, "disableIPSecReplayProtection", v.DisableIPSecReplayProtection) populate(objectMap, "enableBgp", v.EnableBgp) populate(objectMap, "enableBgpRouteTranslationForNat", v.EnableBgpRouteTranslationForNat) populate(objectMap, "enableDnsForwarding", v.EnableDNSForwarding) @@ -17905,6 +18358,9 @@ type VirtualNetworkPeeringPropertiesFormat struct { // READ-ONLY; The provisioning state of the virtual network peering resource. ProvisioningState *ProvisioningState `json:"provisioningState,omitempty" azure:"ro"` + // READ-ONLY; The reference to the remote virtual network's encryption + RemoteVirtualNetworkEncryption *VirtualNetworkEncryption `json:"remoteVirtualNetworkEncryption,omitempty" azure:"ro"` + // READ-ONLY; The resourceGuid property of the Virtual Network peering resource. ResourceGUID *string `json:"resourceGuid,omitempty" azure:"ro"` } @@ -17951,6 +18407,9 @@ type VirtualNetworkPropertiesFormat struct { // Indicates if VM protection is enabled for all the subnets in the virtual network. EnableVMProtection *bool `json:"enableVmProtection,omitempty"` + // Indicates if encryption is enabled on virtual network and if VM without encryption is allowed in encrypted VNet. + Encryption *VirtualNetworkEncryption `json:"encryption,omitempty"` + // The FlowTimeout value (in minutes) for the Virtual Network FlowTimeoutInMinutes *int32 `json:"flowTimeoutInMinutes,omitempty"` @@ -17979,6 +18438,7 @@ func (v VirtualNetworkPropertiesFormat) MarshalJSON() ([]byte, error) { populate(objectMap, "dhcpOptions", v.DhcpOptions) populate(objectMap, "enableDdosProtection", v.EnableDdosProtection) populate(objectMap, "enableVmProtection", v.EnableVMProtection) + populate(objectMap, "encryption", v.Encryption) populate(objectMap, "flowTimeoutInMinutes", v.FlowTimeoutInMinutes) populate(objectMap, "ipAllocations", v.IPAllocations) populate(objectMap, "provisioningState", v.ProvisioningState) diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_natgateways_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_natgateways_client.go index 9332fa73683a..b6fa2bcd2fa3 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_natgateways_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_natgateways_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NatGatewaysClient contains the methods for the NatGateways group. @@ -31,8 +31,15 @@ type NatGatewaysClient struct { } // NewNatGatewaysClient creates a new instance of NatGatewaysClient with the specified values. -func NewNatGatewaysClient(con *arm.Connection, subscriptionID string) *NatGatewaysClient { - return &NatGatewaysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNatGatewaysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NatGatewaysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NatGatewaysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a nat gateway. @@ -92,7 +99,7 @@ func (client *NatGatewaysClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *NatGatewaysClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *NatGatewaysClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -237,7 +244,7 @@ func (client *NatGatewaysClient) getCreateRequest(ctx context.Context, resourceG func (client *NatGatewaysClient) getHandleResponse(resp *http.Response) (NatGatewaysGetResponse, error) { result := NatGatewaysGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NatGateway); err != nil { - return NatGatewaysGetResponse{}, err + return NatGatewaysGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -285,7 +292,7 @@ func (client *NatGatewaysClient) listCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -295,7 +302,7 @@ func (client *NatGatewaysClient) listCreateRequest(ctx context.Context, resource func (client *NatGatewaysClient) listHandleResponse(resp *http.Response) (NatGatewaysListResponse, error) { result := NatGatewaysListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NatGatewayListResult); err != nil { - return NatGatewaysListResponse{}, err + return NatGatewaysListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -339,7 +346,7 @@ func (client *NatGatewaysClient) listAllCreateRequest(ctx context.Context, optio return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -349,7 +356,7 @@ func (client *NatGatewaysClient) listAllCreateRequest(ctx context.Context, optio func (client *NatGatewaysClient) listAllHandleResponse(resp *http.Response) (NatGatewaysListAllResponse, error) { result := NatGatewaysListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NatGatewayListResult); err != nil { - return NatGatewaysListAllResponse{}, err + return NatGatewaysListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -404,7 +411,7 @@ func (client *NatGatewaysClient) updateTagsCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -414,7 +421,7 @@ func (client *NatGatewaysClient) updateTagsCreateRequest(ctx context.Context, re func (client *NatGatewaysClient) updateTagsHandleResponse(resp *http.Response) (NatGatewaysUpdateTagsResponse, error) { result := NatGatewaysUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NatGateway); err != nil { - return NatGatewaysUpdateTagsResponse{}, err + return NatGatewaysUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_natrules_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_natrules_client.go index 36b915e081e4..db07daee7141 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_natrules_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_natrules_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NatRulesClient contains the methods for the NatRules group. @@ -31,8 +31,15 @@ type NatRulesClient struct { } // NewNatRulesClient creates a new instance of NatRulesClient with the specified values. -func NewNatRulesClient(con *arm.Connection, subscriptionID string) *NatRulesClient { - return &NatRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNatRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NatRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NatRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a nat rule to a scalable vpn gateway if it doesn't exist else updates the existing nat rules. @@ -96,7 +103,7 @@ func (client *NatRulesClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, natRuleParameters) @@ -176,7 +183,7 @@ func (client *NatRulesClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *NatRulesClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *NatRulesClient) getCreateRequest(ctx context.Context, resourceGrou func (client *NatRulesClient) getHandleResponse(resp *http.Response) (NatRulesGetResponse, error) { result := NatRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VPNGatewayNatRule); err != nil { - return NatRulesGetResponse{}, err + return NatRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *NatRulesClient) listByVPNGatewayCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *NatRulesClient) listByVPNGatewayCreateRequest(ctx context.Context, func (client *NatRulesClient) listByVPNGatewayHandleResponse(resp *http.Response) (NatRulesListByVPNGatewayResponse, error) { result := NatRulesListByVPNGatewayResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNGatewayNatRulesResult); err != nil { - return NatRulesListByVPNGatewayResponse{}, err + return NatRulesListByVPNGatewayResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_networkinterfaceipconfigurations_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_networkinterfaceipconfigurations_client.go index ce017c8ad4ca..8b2b337cc02c 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_networkinterfaceipconfigurations_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_networkinterfaceipconfigurations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NetworkInterfaceIPConfigurationsClient contains the methods for the NetworkInterfaceIPConfigurations group. @@ -30,8 +31,15 @@ type NetworkInterfaceIPConfigurationsClient struct { } // NewNetworkInterfaceIPConfigurationsClient creates a new instance of NetworkInterfaceIPConfigurationsClient with the specified values. -func NewNetworkInterfaceIPConfigurationsClient(con *arm.Connection, subscriptionID string) *NetworkInterfaceIPConfigurationsClient { - return &NetworkInterfaceIPConfigurationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNetworkInterfaceIPConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NetworkInterfaceIPConfigurationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NetworkInterfaceIPConfigurationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the specified network interface ip configuration. @@ -75,7 +83,7 @@ func (client *NetworkInterfaceIPConfigurationsClient) getCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -85,7 +93,7 @@ func (client *NetworkInterfaceIPConfigurationsClient) getCreateRequest(ctx conte func (client *NetworkInterfaceIPConfigurationsClient) getHandleResponse(resp *http.Response) (NetworkInterfaceIPConfigurationsGetResponse, error) { result := NetworkInterfaceIPConfigurationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterfaceIPConfiguration); err != nil { - return NetworkInterfaceIPConfigurationsGetResponse{}, err + return NetworkInterfaceIPConfigurationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -137,7 +145,7 @@ func (client *NetworkInterfaceIPConfigurationsClient) listCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -147,7 +155,7 @@ func (client *NetworkInterfaceIPConfigurationsClient) listCreateRequest(ctx cont func (client *NetworkInterfaceIPConfigurationsClient) listHandleResponse(resp *http.Response) (NetworkInterfaceIPConfigurationsListResponse, error) { result := NetworkInterfaceIPConfigurationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterfaceIPConfigurationListResult); err != nil { - return NetworkInterfaceIPConfigurationsListResponse{}, err + return NetworkInterfaceIPConfigurationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_networkinterfaceloadbalancers_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_networkinterfaceloadbalancers_client.go index 8513acbbfcc6..f4e9718371ba 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_networkinterfaceloadbalancers_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_networkinterfaceloadbalancers_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NetworkInterfaceLoadBalancersClient contains the methods for the NetworkInterfaceLoadBalancers group. @@ -30,8 +31,15 @@ type NetworkInterfaceLoadBalancersClient struct { } // NewNetworkInterfaceLoadBalancersClient creates a new instance of NetworkInterfaceLoadBalancersClient with the specified values. -func NewNetworkInterfaceLoadBalancersClient(con *arm.Connection, subscriptionID string) *NetworkInterfaceLoadBalancersClient { - return &NetworkInterfaceLoadBalancersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNetworkInterfaceLoadBalancersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NetworkInterfaceLoadBalancersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NetworkInterfaceLoadBalancersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - List all load balancers in a network interface. @@ -68,7 +76,7 @@ func (client *NetworkInterfaceLoadBalancersClient) listCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -78,7 +86,7 @@ func (client *NetworkInterfaceLoadBalancersClient) listCreateRequest(ctx context func (client *NetworkInterfaceLoadBalancersClient) listHandleResponse(resp *http.Response) (NetworkInterfaceLoadBalancersListResponse, error) { result := NetworkInterfaceLoadBalancersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterfaceLoadBalancerListResult); err != nil { - return NetworkInterfaceLoadBalancersListResponse{}, err + return NetworkInterfaceLoadBalancersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_networkinterfaces_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_networkinterfaces_client.go index 7e9cd0fd2131..ca99375203ca 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_networkinterfaces_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_networkinterfaces_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NetworkInterfacesClient contains the methods for the NetworkInterfaces group. @@ -31,8 +31,15 @@ type NetworkInterfacesClient struct { } // NewNetworkInterfacesClient creates a new instance of NetworkInterfacesClient with the specified values. -func NewNetworkInterfacesClient(con *arm.Connection, subscriptionID string) *NetworkInterfacesClient { - return &NetworkInterfacesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNetworkInterfacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NetworkInterfacesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NetworkInterfacesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a network interface. @@ -92,7 +99,7 @@ func (client *NetworkInterfacesClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *NetworkInterfacesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *NetworkInterfacesClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -237,7 +244,7 @@ func (client *NetworkInterfacesClient) getCreateRequest(ctx context.Context, res func (client *NetworkInterfacesClient) getHandleResponse(resp *http.Response) (NetworkInterfacesGetResponse, error) { result := NetworkInterfacesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterface); err != nil { - return NetworkInterfacesGetResponse{}, err + return NetworkInterfacesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -300,7 +307,7 @@ func (client *NetworkInterfacesClient) getCloudServiceNetworkInterfaceCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -313,7 +320,7 @@ func (client *NetworkInterfacesClient) getCloudServiceNetworkInterfaceCreateRequ func (client *NetworkInterfacesClient) getCloudServiceNetworkInterfaceHandleResponse(resp *http.Response) (NetworkInterfacesGetCloudServiceNetworkInterfaceResponse, error) { result := NetworkInterfacesGetCloudServiceNetworkInterfaceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterface); err != nil { - return NetworkInterfacesGetCloudServiceNetworkInterfaceResponse{}, err + return NetworkInterfacesGetCloudServiceNetworkInterfaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -388,7 +395,7 @@ func (client *NetworkInterfacesClient) getEffectiveRouteTableCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -469,7 +476,7 @@ func (client *NetworkInterfacesClient) getVirtualMachineScaleSetIPConfigurationC func (client *NetworkInterfacesClient) getVirtualMachineScaleSetIPConfigurationHandleResponse(resp *http.Response) (NetworkInterfacesGetVirtualMachineScaleSetIPConfigurationResponse, error) { result := NetworkInterfacesGetVirtualMachineScaleSetIPConfigurationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterfaceIPConfiguration); err != nil { - return NetworkInterfacesGetVirtualMachineScaleSetIPConfigurationResponse{}, err + return NetworkInterfacesGetVirtualMachineScaleSetIPConfigurationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -545,7 +552,7 @@ func (client *NetworkInterfacesClient) getVirtualMachineScaleSetNetworkInterface func (client *NetworkInterfacesClient) getVirtualMachineScaleSetNetworkInterfaceHandleResponse(resp *http.Response) (NetworkInterfacesGetVirtualMachineScaleSetNetworkInterfaceResponse, error) { result := NetworkInterfacesGetVirtualMachineScaleSetNetworkInterfaceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterface); err != nil { - return NetworkInterfacesGetVirtualMachineScaleSetNetworkInterfaceResponse{}, err + return NetworkInterfacesGetVirtualMachineScaleSetNetworkInterfaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -593,7 +600,7 @@ func (client *NetworkInterfacesClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -603,7 +610,7 @@ func (client *NetworkInterfacesClient) listCreateRequest(ctx context.Context, re func (client *NetworkInterfacesClient) listHandleResponse(resp *http.Response) (NetworkInterfacesListResponse, error) { result := NetworkInterfacesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterfaceListResult); err != nil { - return NetworkInterfacesListResponse{}, err + return NetworkInterfacesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -647,7 +654,7 @@ func (client *NetworkInterfacesClient) listAllCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -657,7 +664,7 @@ func (client *NetworkInterfacesClient) listAllCreateRequest(ctx context.Context, func (client *NetworkInterfacesClient) listAllHandleResponse(resp *http.Response) (NetworkInterfacesListAllResponse, error) { result := NetworkInterfacesListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterfaceListResult); err != nil { - return NetworkInterfacesListAllResponse{}, err + return NetworkInterfacesListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -709,7 +716,7 @@ func (client *NetworkInterfacesClient) listCloudServiceNetworkInterfacesCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -719,7 +726,7 @@ func (client *NetworkInterfacesClient) listCloudServiceNetworkInterfacesCreateRe func (client *NetworkInterfacesClient) listCloudServiceNetworkInterfacesHandleResponse(resp *http.Response) (NetworkInterfacesListCloudServiceNetworkInterfacesResponse, error) { result := NetworkInterfacesListCloudServiceNetworkInterfacesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterfaceListResult); err != nil { - return NetworkInterfacesListCloudServiceNetworkInterfacesResponse{}, err + return NetworkInterfacesListCloudServiceNetworkInterfacesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -775,7 +782,7 @@ func (client *NetworkInterfacesClient) listCloudServiceRoleInstanceNetworkInterf return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -785,7 +792,7 @@ func (client *NetworkInterfacesClient) listCloudServiceRoleInstanceNetworkInterf func (client *NetworkInterfacesClient) listCloudServiceRoleInstanceNetworkInterfacesHandleResponse(resp *http.Response) (NetworkInterfacesListCloudServiceRoleInstanceNetworkInterfacesResponse, error) { result := NetworkInterfacesListCloudServiceRoleInstanceNetworkInterfacesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterfaceListResult); err != nil { - return NetworkInterfacesListCloudServiceRoleInstanceNetworkInterfacesResponse{}, err + return NetworkInterfacesListCloudServiceRoleInstanceNetworkInterfacesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -860,7 +867,7 @@ func (client *NetworkInterfacesClient) listEffectiveNetworkSecurityGroupsCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -934,7 +941,7 @@ func (client *NetworkInterfacesClient) listVirtualMachineScaleSetIPConfiguration func (client *NetworkInterfacesClient) listVirtualMachineScaleSetIPConfigurationsHandleResponse(resp *http.Response) (NetworkInterfacesListVirtualMachineScaleSetIPConfigurationsResponse, error) { result := NetworkInterfacesListVirtualMachineScaleSetIPConfigurationsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterfaceIPConfigurationListResult); err != nil { - return NetworkInterfacesListVirtualMachineScaleSetIPConfigurationsResponse{}, err + return NetworkInterfacesListVirtualMachineScaleSetIPConfigurationsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -996,7 +1003,7 @@ func (client *NetworkInterfacesClient) listVirtualMachineScaleSetNetworkInterfac func (client *NetworkInterfacesClient) listVirtualMachineScaleSetNetworkInterfacesHandleResponse(resp *http.Response) (NetworkInterfacesListVirtualMachineScaleSetNetworkInterfacesResponse, error) { result := NetworkInterfacesListVirtualMachineScaleSetNetworkInterfacesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterfaceListResult); err != nil { - return NetworkInterfacesListVirtualMachineScaleSetNetworkInterfacesResponse{}, err + return NetworkInterfacesListVirtualMachineScaleSetNetworkInterfacesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1062,7 +1069,7 @@ func (client *NetworkInterfacesClient) listVirtualMachineScaleSetVMNetworkInterf func (client *NetworkInterfacesClient) listVirtualMachineScaleSetVMNetworkInterfacesHandleResponse(resp *http.Response) (NetworkInterfacesListVirtualMachineScaleSetVMNetworkInterfacesResponse, error) { result := NetworkInterfacesListVirtualMachineScaleSetVMNetworkInterfacesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterfaceListResult); err != nil { - return NetworkInterfacesListVirtualMachineScaleSetVMNetworkInterfacesResponse{}, err + return NetworkInterfacesListVirtualMachineScaleSetVMNetworkInterfacesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1117,7 +1124,7 @@ func (client *NetworkInterfacesClient) updateTagsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -1127,7 +1134,7 @@ func (client *NetworkInterfacesClient) updateTagsCreateRequest(ctx context.Conte func (client *NetworkInterfacesClient) updateTagsHandleResponse(resp *http.Response) (NetworkInterfacesUpdateTagsResponse, error) { result := NetworkInterfacesUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterface); err != nil { - return NetworkInterfacesUpdateTagsResponse{}, err + return NetworkInterfacesUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_networkinterfacetapconfigurations_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_networkinterfacetapconfigurations_client.go index cda3da0c136f..ced4bc6f3b0e 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_networkinterfacetapconfigurations_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_networkinterfacetapconfigurations_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NetworkInterfaceTapConfigurationsClient contains the methods for the NetworkInterfaceTapConfigurations group. @@ -31,8 +31,15 @@ type NetworkInterfaceTapConfigurationsClient struct { } // NewNetworkInterfaceTapConfigurationsClient creates a new instance of NetworkInterfaceTapConfigurationsClient with the specified values. -func NewNetworkInterfaceTapConfigurationsClient(con *arm.Connection, subscriptionID string) *NetworkInterfaceTapConfigurationsClient { - return &NetworkInterfaceTapConfigurationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNetworkInterfaceTapConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NetworkInterfaceTapConfigurationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NetworkInterfaceTapConfigurationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a Tap configuration in the specified NetworkInterface. @@ -96,7 +103,7 @@ func (client *NetworkInterfaceTapConfigurationsClient) createOrUpdateCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, tapConfigurationParameters) @@ -176,7 +183,7 @@ func (client *NetworkInterfaceTapConfigurationsClient) deleteCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *NetworkInterfaceTapConfigurationsClient) getCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *NetworkInterfaceTapConfigurationsClient) getCreateRequest(ctx cont func (client *NetworkInterfaceTapConfigurationsClient) getHandleResponse(resp *http.Response) (NetworkInterfaceTapConfigurationsGetResponse, error) { result := NetworkInterfaceTapConfigurationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterfaceTapConfiguration); err != nil { - return NetworkInterfaceTapConfigurationsGetResponse{}, err + return NetworkInterfaceTapConfigurationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *NetworkInterfaceTapConfigurationsClient) listCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *NetworkInterfaceTapConfigurationsClient) listCreateRequest(ctx con func (client *NetworkInterfaceTapConfigurationsClient) listHandleResponse(resp *http.Response) (NetworkInterfaceTapConfigurationsListResponse, error) { result := NetworkInterfaceTapConfigurationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkInterfaceTapConfigurationListResult); err != nil { - return NetworkInterfaceTapConfigurationsListResponse{}, err + return NetworkInterfaceTapConfigurationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_networkmanagementclient_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_networkmanagementclient_client.go index 5e94117613bd..12fb78ea1643 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_networkmanagementclient_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_networkmanagementclient_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NetworkManagementClient contains the methods for the NetworkManagementClient group. @@ -31,8 +31,15 @@ type NetworkManagementClient struct { } // NewNetworkManagementClient creates a new instance of NetworkManagementClient with the specified values. -func NewNetworkManagementClient(con *arm.Connection, subscriptionID string) *NetworkManagementClient { - return &NetworkManagementClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNetworkManagementClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NetworkManagementClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NetworkManagementClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckDNSNameAvailability - Checks whether a domain name in the cloudapp.azure.com zone is available for use. @@ -69,7 +76,7 @@ func (client *NetworkManagementClient) checkDNSNameAvailabilityCreateRequest(ctx } reqQP := req.Raw().URL.Query() reqQP.Set("domainNameLabel", domainNameLabel) - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -79,7 +86,7 @@ func (client *NetworkManagementClient) checkDNSNameAvailabilityCreateRequest(ctx func (client *NetworkManagementClient) checkDNSNameAvailabilityHandleResponse(resp *http.Response) (NetworkManagementClientCheckDNSNameAvailabilityResponse, error) { result := NetworkManagementClientCheckDNSNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DNSNameAvailabilityResult); err != nil { - return NetworkManagementClientCheckDNSNameAvailabilityResponse{}, err + return NetworkManagementClientCheckDNSNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -154,7 +161,7 @@ func (client *NetworkManagementClient) deleteBastionShareableLinkCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, bslRequest) @@ -207,7 +214,7 @@ func (client *NetworkManagementClient) disconnectActiveSessionsCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, sessionIDs) @@ -217,7 +224,7 @@ func (client *NetworkManagementClient) disconnectActiveSessionsCreateRequest(ctx func (client *NetworkManagementClient) disconnectActiveSessionsHandleResponse(resp *http.Response) (NetworkManagementClientDisconnectActiveSessionsResponse, error) { result := NetworkManagementClientDisconnectActiveSessionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BastionSessionDeleteResult); err != nil { - return NetworkManagementClientDisconnectActiveSessionsResponse{}, err + return NetworkManagementClientDisconnectActiveSessionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -294,7 +301,7 @@ func (client *NetworkManagementClient) generatevirtualwanvpnserverconfigurationv return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, vpnClientParams) @@ -371,7 +378,7 @@ func (client *NetworkManagementClient) getActiveSessionsCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -381,7 +388,7 @@ func (client *NetworkManagementClient) getActiveSessionsCreateRequest(ctx contex func (client *NetworkManagementClient) getActiveSessionsHandleResponse(resp *http.Response) (NetworkManagementClientGetActiveSessionsResponse, error) { result := NetworkManagementClientGetActiveSessionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BastionActiveSessionListResult); err != nil { - return NetworkManagementClientGetActiveSessionsResponse{}, err + return NetworkManagementClientGetActiveSessionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -433,7 +440,7 @@ func (client *NetworkManagementClient) getBastionShareableLinkCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, bslRequest) @@ -443,7 +450,7 @@ func (client *NetworkManagementClient) getBastionShareableLinkCreateRequest(ctx func (client *NetworkManagementClient) getBastionShareableLinkHandleResponse(resp *http.Response) (NetworkManagementClientGetBastionShareableLinkResponse, error) { result := NetworkManagementClientGetBastionShareableLinkResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BastionShareableLinkListResult); err != nil { - return NetworkManagementClientGetBastionShareableLinkResponse{}, err + return NetworkManagementClientGetBastionShareableLinkResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -519,7 +526,7 @@ func (client *NetworkManagementClient) putBastionShareableLinkCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, bslRequest) @@ -529,7 +536,7 @@ func (client *NetworkManagementClient) putBastionShareableLinkCreateRequest(ctx func (client *NetworkManagementClient) putBastionShareableLinkHandleResponse(resp *http.Response) (NetworkManagementClientPutBastionShareableLinkResponse, error) { result := NetworkManagementClientPutBastionShareableLinkResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BastionShareableLinkListResult); err != nil { - return NetworkManagementClientPutBastionShareableLinkResponse{}, err + return NetworkManagementClientPutBastionShareableLinkResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -584,7 +591,7 @@ func (client *NetworkManagementClient) supportedSecurityProvidersCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -594,7 +601,7 @@ func (client *NetworkManagementClient) supportedSecurityProvidersCreateRequest(c func (client *NetworkManagementClient) supportedSecurityProvidersHandleResponse(resp *http.Response) (NetworkManagementClientSupportedSecurityProvidersResponse, error) { result := NetworkManagementClientSupportedSecurityProvidersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualWanSecurityProviders); err != nil { - return NetworkManagementClientSupportedSecurityProvidersResponse{}, err + return NetworkManagementClientSupportedSecurityProvidersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_networkprofiles_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_networkprofiles_client.go index 78f90b48dfd4..1acfdc9b35c0 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_networkprofiles_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_networkprofiles_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NetworkProfilesClient contains the methods for the NetworkProfiles group. @@ -31,8 +31,15 @@ type NetworkProfilesClient struct { } // NewNetworkProfilesClient creates a new instance of NetworkProfilesClient with the specified values. -func NewNetworkProfilesClient(con *arm.Connection, subscriptionID string) *NetworkProfilesClient { - return &NetworkProfilesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNetworkProfilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NetworkProfilesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NetworkProfilesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a network profile. @@ -72,7 +79,7 @@ func (client *NetworkProfilesClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -82,7 +89,7 @@ func (client *NetworkProfilesClient) createOrUpdateCreateRequest(ctx context.Con func (client *NetworkProfilesClient) createOrUpdateHandleResponse(resp *http.Response) (NetworkProfilesCreateOrUpdateResponse, error) { result := NetworkProfilesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkProfile); err != nil { - return NetworkProfilesCreateOrUpdateResponse{}, err + return NetworkProfilesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -157,7 +164,7 @@ func (client *NetworkProfilesClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -213,7 +220,7 @@ func (client *NetworkProfilesClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -226,7 +233,7 @@ func (client *NetworkProfilesClient) getCreateRequest(ctx context.Context, resou func (client *NetworkProfilesClient) getHandleResponse(resp *http.Response) (NetworkProfilesGetResponse, error) { result := NetworkProfilesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkProfile); err != nil { - return NetworkProfilesGetResponse{}, err + return NetworkProfilesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -274,7 +281,7 @@ func (client *NetworkProfilesClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -284,7 +291,7 @@ func (client *NetworkProfilesClient) listCreateRequest(ctx context.Context, reso func (client *NetworkProfilesClient) listHandleResponse(resp *http.Response) (NetworkProfilesListResponse, error) { result := NetworkProfilesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkProfileListResult); err != nil { - return NetworkProfilesListResponse{}, err + return NetworkProfilesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -328,7 +335,7 @@ func (client *NetworkProfilesClient) listAllCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -338,7 +345,7 @@ func (client *NetworkProfilesClient) listAllCreateRequest(ctx context.Context, o func (client *NetworkProfilesClient) listAllHandleResponse(resp *http.Response) (NetworkProfilesListAllResponse, error) { result := NetworkProfilesListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkProfileListResult); err != nil { - return NetworkProfilesListAllResponse{}, err + return NetworkProfilesListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -393,7 +400,7 @@ func (client *NetworkProfilesClient) updateTagsCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -403,7 +410,7 @@ func (client *NetworkProfilesClient) updateTagsCreateRequest(ctx context.Context func (client *NetworkProfilesClient) updateTagsHandleResponse(resp *http.Response) (NetworkProfilesUpdateTagsResponse, error) { result := NetworkProfilesUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkProfile); err != nil { - return NetworkProfilesUpdateTagsResponse{}, err + return NetworkProfilesUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_networksecuritygroups_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_networksecuritygroups_client.go index f86e5093c573..de2c25f56d0e 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_networksecuritygroups_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_networksecuritygroups_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NetworkSecurityGroupsClient contains the methods for the NetworkSecurityGroups group. @@ -31,8 +31,15 @@ type NetworkSecurityGroupsClient struct { } // NewNetworkSecurityGroupsClient creates a new instance of NetworkSecurityGroupsClient with the specified values. -func NewNetworkSecurityGroupsClient(con *arm.Connection, subscriptionID string) *NetworkSecurityGroupsClient { - return &NetworkSecurityGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNetworkSecurityGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NetworkSecurityGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NetworkSecurityGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a network security group in the specified resource group. @@ -92,7 +99,7 @@ func (client *NetworkSecurityGroupsClient) createOrUpdateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *NetworkSecurityGroupsClient) deleteCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *NetworkSecurityGroupsClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -237,7 +244,7 @@ func (client *NetworkSecurityGroupsClient) getCreateRequest(ctx context.Context, func (client *NetworkSecurityGroupsClient) getHandleResponse(resp *http.Response) (NetworkSecurityGroupsGetResponse, error) { result := NetworkSecurityGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityGroup); err != nil { - return NetworkSecurityGroupsGetResponse{}, err + return NetworkSecurityGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -285,7 +292,7 @@ func (client *NetworkSecurityGroupsClient) listCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -295,7 +302,7 @@ func (client *NetworkSecurityGroupsClient) listCreateRequest(ctx context.Context func (client *NetworkSecurityGroupsClient) listHandleResponse(resp *http.Response) (NetworkSecurityGroupsListResponse, error) { result := NetworkSecurityGroupsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityGroupListResult); err != nil { - return NetworkSecurityGroupsListResponse{}, err + return NetworkSecurityGroupsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -339,7 +346,7 @@ func (client *NetworkSecurityGroupsClient) listAllCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -349,7 +356,7 @@ func (client *NetworkSecurityGroupsClient) listAllCreateRequest(ctx context.Cont func (client *NetworkSecurityGroupsClient) listAllHandleResponse(resp *http.Response) (NetworkSecurityGroupsListAllResponse, error) { result := NetworkSecurityGroupsListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityGroupListResult); err != nil { - return NetworkSecurityGroupsListAllResponse{}, err + return NetworkSecurityGroupsListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -404,7 +411,7 @@ func (client *NetworkSecurityGroupsClient) updateTagsCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -414,7 +421,7 @@ func (client *NetworkSecurityGroupsClient) updateTagsCreateRequest(ctx context.C func (client *NetworkSecurityGroupsClient) updateTagsHandleResponse(resp *http.Response) (NetworkSecurityGroupsUpdateTagsResponse, error) { result := NetworkSecurityGroupsUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkSecurityGroup); err != nil { - return NetworkSecurityGroupsUpdateTagsResponse{}, err + return NetworkSecurityGroupsUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_networkvirtualappliances_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_networkvirtualappliances_client.go index a862cc3b2baf..4bc11b547f00 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_networkvirtualappliances_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_networkvirtualappliances_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NetworkVirtualAppliancesClient contains the methods for the NetworkVirtualAppliances group. @@ -31,8 +31,15 @@ type NetworkVirtualAppliancesClient struct { } // NewNetworkVirtualAppliancesClient creates a new instance of NetworkVirtualAppliancesClient with the specified values. -func NewNetworkVirtualAppliancesClient(con *arm.Connection, subscriptionID string) *NetworkVirtualAppliancesClient { - return &NetworkVirtualAppliancesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNetworkVirtualAppliancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NetworkVirtualAppliancesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NetworkVirtualAppliancesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates the specified Network Virtual Appliance. @@ -92,7 +99,7 @@ func (client *NetworkVirtualAppliancesClient) createOrUpdateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *NetworkVirtualAppliancesClient) deleteCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *NetworkVirtualAppliancesClient) getCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -237,7 +244,7 @@ func (client *NetworkVirtualAppliancesClient) getCreateRequest(ctx context.Conte func (client *NetworkVirtualAppliancesClient) getHandleResponse(resp *http.Response) (NetworkVirtualAppliancesGetResponse, error) { result := NetworkVirtualAppliancesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkVirtualAppliance); err != nil { - return NetworkVirtualAppliancesGetResponse{}, err + return NetworkVirtualAppliancesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -281,7 +288,7 @@ func (client *NetworkVirtualAppliancesClient) listCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -291,7 +298,7 @@ func (client *NetworkVirtualAppliancesClient) listCreateRequest(ctx context.Cont func (client *NetworkVirtualAppliancesClient) listHandleResponse(resp *http.Response) (NetworkVirtualAppliancesListResponse, error) { result := NetworkVirtualAppliancesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkVirtualApplianceListResult); err != nil { - return NetworkVirtualAppliancesListResponse{}, err + return NetworkVirtualAppliancesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -339,7 +346,7 @@ func (client *NetworkVirtualAppliancesClient) listByResourceGroupCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -349,7 +356,7 @@ func (client *NetworkVirtualAppliancesClient) listByResourceGroupCreateRequest(c func (client *NetworkVirtualAppliancesClient) listByResourceGroupHandleResponse(resp *http.Response) (NetworkVirtualAppliancesListByResourceGroupResponse, error) { result := NetworkVirtualAppliancesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkVirtualApplianceListResult); err != nil { - return NetworkVirtualAppliancesListByResourceGroupResponse{}, err + return NetworkVirtualAppliancesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -404,7 +411,7 @@ func (client *NetworkVirtualAppliancesClient) updateTagsCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -414,7 +421,7 @@ func (client *NetworkVirtualAppliancesClient) updateTagsCreateRequest(ctx contex func (client *NetworkVirtualAppliancesClient) updateTagsHandleResponse(resp *http.Response) (NetworkVirtualAppliancesUpdateTagsResponse, error) { result := NetworkVirtualAppliancesUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkVirtualAppliance); err != nil { - return NetworkVirtualAppliancesUpdateTagsResponse{}, err + return NetworkVirtualAppliancesUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_networkwatchers_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_networkwatchers_client.go index 34bbad797c2f..10733bbf5fd3 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_networkwatchers_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_networkwatchers_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NetworkWatchersClient contains the methods for the NetworkWatchers group. @@ -31,8 +31,15 @@ type NetworkWatchersClient struct { } // NewNetworkWatchersClient creates a new instance of NetworkWatchersClient with the specified values. -func NewNetworkWatchersClient(con *arm.Connection, subscriptionID string) *NetworkWatchersClient { - return &NetworkWatchersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNetworkWatchersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NetworkWatchersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NetworkWatchersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCheckConnectivity - Verifies the possibility of establishing a direct TCP connection from a virtual machine to a given endpoint including another @@ -94,7 +101,7 @@ func (client *NetworkWatchersClient) checkConnectivityCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -150,7 +157,7 @@ func (client *NetworkWatchersClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -160,7 +167,7 @@ func (client *NetworkWatchersClient) createOrUpdateCreateRequest(ctx context.Con func (client *NetworkWatchersClient) createOrUpdateHandleResponse(resp *http.Response) (NetworkWatchersCreateOrUpdateResponse, error) { result := NetworkWatchersCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkWatcher); err != nil { - return NetworkWatchersCreateOrUpdateResponse{}, err + return NetworkWatchersCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -235,7 +242,7 @@ func (client *NetworkWatchersClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -291,7 +298,7 @@ func (client *NetworkWatchersClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -301,7 +308,7 @@ func (client *NetworkWatchersClient) getCreateRequest(ctx context.Context, resou func (client *NetworkWatchersClient) getHandleResponse(resp *http.Response) (NetworkWatchersGetResponse, error) { result := NetworkWatchersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkWatcher); err != nil { - return NetworkWatchersGetResponse{}, err + return NetworkWatchersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -378,7 +385,7 @@ func (client *NetworkWatchersClient) getAzureReachabilityReportCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -454,7 +461,7 @@ func (client *NetworkWatchersClient) getFlowLogStatusCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -538,7 +545,7 @@ func (client *NetworkWatchersClient) getNetworkConfigurationDiagnosticCreateRequ return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -614,7 +621,7 @@ func (client *NetworkWatchersClient) getNextHopCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -670,7 +677,7 @@ func (client *NetworkWatchersClient) getTopologyCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -680,7 +687,7 @@ func (client *NetworkWatchersClient) getTopologyCreateRequest(ctx context.Contex func (client *NetworkWatchersClient) getTopologyHandleResponse(resp *http.Response) (NetworkWatchersGetTopologyResponse, error) { result := NetworkWatchersGetTopologyResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Topology); err != nil { - return NetworkWatchersGetTopologyResponse{}, err + return NetworkWatchersGetTopologyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -755,7 +762,7 @@ func (client *NetworkWatchersClient) getTroubleshootingCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -831,7 +838,7 @@ func (client *NetworkWatchersClient) getTroubleshootingResultCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -907,7 +914,7 @@ func (client *NetworkWatchersClient) getVMSecurityRulesCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -959,7 +966,7 @@ func (client *NetworkWatchersClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -969,7 +976,7 @@ func (client *NetworkWatchersClient) listCreateRequest(ctx context.Context, reso func (client *NetworkWatchersClient) listHandleResponse(resp *http.Response) (NetworkWatchersListResponse, error) { result := NetworkWatchersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkWatcherListResult); err != nil { - return NetworkWatchersListResponse{}, err + return NetworkWatchersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1016,7 +1023,7 @@ func (client *NetworkWatchersClient) listAllCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1026,7 +1033,7 @@ func (client *NetworkWatchersClient) listAllCreateRequest(ctx context.Context, o func (client *NetworkWatchersClient) listAllHandleResponse(resp *http.Response) (NetworkWatchersListAllResponse, error) { result := NetworkWatchersListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkWatcherListResult); err != nil { - return NetworkWatchersListAllResponse{}, err + return NetworkWatchersListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1103,7 +1110,7 @@ func (client *NetworkWatchersClient) listAvailableProvidersCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -1179,7 +1186,7 @@ func (client *NetworkWatchersClient) setFlowLogConfigurationCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -1235,7 +1242,7 @@ func (client *NetworkWatchersClient) updateTagsCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -1245,7 +1252,7 @@ func (client *NetworkWatchersClient) updateTagsCreateRequest(ctx context.Context func (client *NetworkWatchersClient) updateTagsHandleResponse(resp *http.Response) (NetworkWatchersUpdateTagsResponse, error) { result := NetworkWatchersUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkWatcher); err != nil { - return NetworkWatchersUpdateTagsResponse{}, err + return NetworkWatchersUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1320,7 +1327,7 @@ func (client *NetworkWatchersClient) verifyIPFlowCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_operations_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_operations_client.go index 8a445cfe7701..bf5c56c23b95 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_operations_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armnetwork import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available Network Rest API operations. @@ -52,7 +60,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_p2svpngateways_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_p2svpngateways_client.go index 15922a35fab7..51a9790d1311 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_p2svpngateways_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_p2svpngateways_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // P2SVPNGatewaysClient contains the methods for the P2SVPNGateways group. @@ -31,8 +31,15 @@ type P2SVPNGatewaysClient struct { } // NewP2SVPNGatewaysClient creates a new instance of P2SVPNGatewaysClient with the specified values. -func NewP2SVPNGatewaysClient(con *arm.Connection, subscriptionID string) *P2SVPNGatewaysClient { - return &P2SVPNGatewaysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewP2SVPNGatewaysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *P2SVPNGatewaysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &P2SVPNGatewaysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a virtual wan p2s vpn gateway if it doesn't exist else updates the existing gateway. @@ -92,7 +99,7 @@ func (client *P2SVPNGatewaysClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, p2SVPNGatewayParameters) @@ -168,7 +175,7 @@ func (client *P2SVPNGatewaysClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -244,7 +251,7 @@ func (client *P2SVPNGatewaysClient) disconnectP2SVPNConnectionsCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, request) @@ -320,7 +327,7 @@ func (client *P2SVPNGatewaysClient) generateVPNProfileCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -376,7 +383,7 @@ func (client *P2SVPNGatewaysClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -386,7 +393,7 @@ func (client *P2SVPNGatewaysClient) getCreateRequest(ctx context.Context, resour func (client *P2SVPNGatewaysClient) getHandleResponse(resp *http.Response) (P2SVPNGatewaysGetResponse, error) { result := P2SVPNGatewaysGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.P2SVPNGateway); err != nil { - return P2SVPNGatewaysGetResponse{}, err + return P2SVPNGatewaysGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -461,7 +468,7 @@ func (client *P2SVPNGatewaysClient) getP2SVPNConnectionHealthCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -539,7 +546,7 @@ func (client *P2SVPNGatewaysClient) getP2SVPNConnectionHealthDetailedCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, request) @@ -584,7 +591,7 @@ func (client *P2SVPNGatewaysClient) listCreateRequest(ctx context.Context, optio return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -594,7 +601,7 @@ func (client *P2SVPNGatewaysClient) listCreateRequest(ctx context.Context, optio func (client *P2SVPNGatewaysClient) listHandleResponse(resp *http.Response) (P2SVPNGatewaysListResponse, error) { result := P2SVPNGatewaysListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListP2SVPNGatewaysResult); err != nil { - return P2SVPNGatewaysListResponse{}, err + return P2SVPNGatewaysListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -642,7 +649,7 @@ func (client *P2SVPNGatewaysClient) listByResourceGroupCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -652,7 +659,7 @@ func (client *P2SVPNGatewaysClient) listByResourceGroupCreateRequest(ctx context func (client *P2SVPNGatewaysClient) listByResourceGroupHandleResponse(resp *http.Response) (P2SVPNGatewaysListByResourceGroupResponse, error) { result := P2SVPNGatewaysListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListP2SVPNGatewaysResult); err != nil { - return P2SVPNGatewaysListByResourceGroupResponse{}, err + return P2SVPNGatewaysListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -727,7 +734,7 @@ func (client *P2SVPNGatewaysClient) resetCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -803,7 +810,7 @@ func (client *P2SVPNGatewaysClient) updateTagsCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, p2SVPNGatewayParameters) diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_packetcaptures_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_packetcaptures_client.go index 72aaebb61f9e..96050ff21784 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_packetcaptures_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_packetcaptures_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PacketCapturesClient contains the methods for the PacketCaptures group. @@ -31,8 +31,15 @@ type PacketCapturesClient struct { } // NewPacketCapturesClient creates a new instance of PacketCapturesClient with the specified values. -func NewPacketCapturesClient(con *arm.Connection, subscriptionID string) *PacketCapturesClient { - return &PacketCapturesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPacketCapturesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PacketCapturesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PacketCapturesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Create and start a packet capture on the specified VM. @@ -96,7 +103,7 @@ func (client *PacketCapturesClient) createCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -176,7 +183,7 @@ func (client *PacketCapturesClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *PacketCapturesClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *PacketCapturesClient) getCreateRequest(ctx context.Context, resour func (client *PacketCapturesClient) getHandleResponse(resp *http.Response) (PacketCapturesGetResponse, error) { result := PacketCapturesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PacketCaptureResult); err != nil { - return PacketCapturesGetResponse{}, err + return PacketCapturesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -325,7 +332,7 @@ func (client *PacketCapturesClient) getStatusCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -381,7 +388,7 @@ func (client *PacketCapturesClient) listCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -391,7 +398,7 @@ func (client *PacketCapturesClient) listCreateRequest(ctx context.Context, resou func (client *PacketCapturesClient) listHandleResponse(resp *http.Response) (PacketCapturesListResponse, error) { result := PacketCapturesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PacketCaptureListResult); err != nil { - return PacketCapturesListResponse{}, err + return PacketCapturesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -470,7 +477,7 @@ func (client *PacketCapturesClient) stopCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_pagers.go b/sdk/resourcemanager/network/armnetwork/zz_generated_pagers.go index b6cd37d138c4..33f6042afd36 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_pagers.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armnetwork import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // ApplicationGatewayPrivateEndpointConnectionsListPager provides operations for iterating over paged responses. @@ -5899,6 +5898,60 @@ func (p *RoutesListPager) PageResponse() RoutesListResponse { return p.current } +// RoutingIntentListPager provides operations for iterating over paged responses. +type RoutingIntentListPager struct { + client *RoutingIntentClient + current RoutingIntentListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, RoutingIntentListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *RoutingIntentListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *RoutingIntentListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.ListRoutingIntentResult.NextLink == nil || len(*p.current.ListRoutingIntentResult.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current RoutingIntentListResponse page. +func (p *RoutingIntentListPager) PageResponse() RoutingIntentListResponse { + return p.current +} + // SecurityPartnerProvidersListByResourceGroupPager provides operations for iterating over paged responses. type SecurityPartnerProvidersListByResourceGroupPager struct { client *SecurityPartnerProvidersClient diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_peerexpressroutecircuitconnections_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_peerexpressroutecircuitconnections_client.go index 083c6c28b4cb..e13313e64f1c 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_peerexpressroutecircuitconnections_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_peerexpressroutecircuitconnections_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PeerExpressRouteCircuitConnectionsClient contains the methods for the PeerExpressRouteCircuitConnections group. @@ -30,8 +31,15 @@ type PeerExpressRouteCircuitConnectionsClient struct { } // NewPeerExpressRouteCircuitConnectionsClient creates a new instance of PeerExpressRouteCircuitConnectionsClient with the specified values. -func NewPeerExpressRouteCircuitConnectionsClient(con *arm.Connection, subscriptionID string) *PeerExpressRouteCircuitConnectionsClient { - return &PeerExpressRouteCircuitConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPeerExpressRouteCircuitConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PeerExpressRouteCircuitConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PeerExpressRouteCircuitConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the specified Peer Express Route Circuit Connection from the specified express route circuit. @@ -79,7 +87,7 @@ func (client *PeerExpressRouteCircuitConnectionsClient) getCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -89,7 +97,7 @@ func (client *PeerExpressRouteCircuitConnectionsClient) getCreateRequest(ctx con func (client *PeerExpressRouteCircuitConnectionsClient) getHandleResponse(resp *http.Response) (PeerExpressRouteCircuitConnectionsGetResponse, error) { result := PeerExpressRouteCircuitConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PeerExpressRouteCircuitConnection); err != nil { - return PeerExpressRouteCircuitConnectionsGetResponse{}, err + return PeerExpressRouteCircuitConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -145,7 +153,7 @@ func (client *PeerExpressRouteCircuitConnectionsClient) listCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -155,7 +163,7 @@ func (client *PeerExpressRouteCircuitConnectionsClient) listCreateRequest(ctx co func (client *PeerExpressRouteCircuitConnectionsClient) listHandleResponse(resp *http.Response) (PeerExpressRouteCircuitConnectionsListResponse, error) { result := PeerExpressRouteCircuitConnectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PeerExpressRouteCircuitConnectionListResult); err != nil { - return PeerExpressRouteCircuitConnectionsListResponse{}, err + return PeerExpressRouteCircuitConnectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_pollers.go b/sdk/resourcemanager/network/armnetwork/zz_generated_pollers.go index 6d3e5ca1f70f..f0f9c1116a2b 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_pollers.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armnetwork import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // ApplicationGatewayPrivateEndpointConnectionsDeletePoller provides polling facilities until the operation reaches a terminal state. @@ -3197,6 +3196,49 @@ func (p *LoadBalancersDeletePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } +// LoadBalancersListInboundNatRulePortMappingsPoller provides polling facilities until the operation reaches a terminal state. +type LoadBalancersListInboundNatRulePortMappingsPoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *LoadBalancersListInboundNatRulePortMappingsPoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *LoadBalancersListInboundNatRulePortMappingsPoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final LoadBalancersListInboundNatRulePortMappingsResponse will be returned. +func (p *LoadBalancersListInboundNatRulePortMappingsPoller) FinalResponse(ctx context.Context) (LoadBalancersListInboundNatRulePortMappingsResponse, error) { + respType := LoadBalancersListInboundNatRulePortMappingsResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.BackendAddressInboundNatRulePortMappings) + if err != nil { + return LoadBalancersListInboundNatRulePortMappingsResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *LoadBalancersListInboundNatRulePortMappingsPoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + // LoadBalancersSwapPublicIPAddressesPoller provides polling facilities until the operation reaches a terminal state. type LoadBalancersSwapPublicIPAddressesPoller struct { pt *azcore.Poller @@ -6076,6 +6118,92 @@ func (p *RoutesDeletePoller) ResumeToken() (string, error) { return p.pt.ResumeToken() } +// RoutingIntentCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. +type RoutingIntentCreateOrUpdatePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *RoutingIntentCreateOrUpdatePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *RoutingIntentCreateOrUpdatePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final RoutingIntentCreateOrUpdateResponse will be returned. +func (p *RoutingIntentCreateOrUpdatePoller) FinalResponse(ctx context.Context) (RoutingIntentCreateOrUpdateResponse, error) { + respType := RoutingIntentCreateOrUpdateResponse{} + resp, err := p.pt.FinalResponse(ctx, &respType.RoutingIntent) + if err != nil { + return RoutingIntentCreateOrUpdateResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *RoutingIntentCreateOrUpdatePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + +// RoutingIntentDeletePoller provides polling facilities until the operation reaches a terminal state. +type RoutingIntentDeletePoller struct { + pt *azcore.Poller +} + +// Done returns true if the LRO has reached a terminal state. +func (p *RoutingIntentDeletePoller) Done() bool { + return p.pt.Done() +} + +// Poll fetches the latest state of the LRO. It returns an HTTP response or error. +// If the LRO has completed successfully, the poller's state is updated and the HTTP +// response is returned. +// If the LRO has completed with failure or was cancelled, the poller's state is +// updated and the error is returned. +// If the LRO has not reached a terminal state, the poller's state is updated and +// the latest HTTP response is returned. +// If Poll fails, the poller's state is unmodified and the error is returned. +// Calling Poll on an LRO that has reached a terminal state will return the final +// HTTP response or error. +func (p *RoutingIntentDeletePoller) Poll(ctx context.Context) (*http.Response, error) { + return p.pt.Poll(ctx) +} + +// FinalResponse performs a final GET to the service and returns the final response +// for the polling operation. If there is an error performing the final GET then an error is returned. +// If the final GET succeeded then the final RoutingIntentDeleteResponse will be returned. +func (p *RoutingIntentDeletePoller) FinalResponse(ctx context.Context) (RoutingIntentDeleteResponse, error) { + respType := RoutingIntentDeleteResponse{} + resp, err := p.pt.FinalResponse(ctx, nil) + if err != nil { + return RoutingIntentDeleteResponse{}, err + } + respType.RawResponse = resp + return respType, nil +} + +// ResumeToken returns a value representing the poller that can be used to resume +// the LRO at a later time. ResumeTokens are unique per service operation. +func (p *RoutingIntentDeletePoller) ResumeToken() (string, error) { + return p.pt.ResumeToken() +} + // SecurityPartnerProvidersCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. type SecurityPartnerProvidersCreateOrUpdatePoller struct { pt *azcore.Poller diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/network/armnetwork/zz_generated_polymorphic_helpers.go index 8d22f19545d1..718e2f739d1d 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_polymorphic_helpers.go @@ -51,6 +51,25 @@ func unmarshalFirewallPolicyRuleClassificationArray(rawMsg json.RawMessage) ([]F return fArray, nil } +func unmarshalFirewallPolicyRuleClassificationMap(rawMsg json.RawMessage) (map[string]FirewallPolicyRuleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]FirewallPolicyRuleClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalFirewallPolicyRuleClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalFirewallPolicyRuleCollectionClassification(rawMsg json.RawMessage) (FirewallPolicyRuleCollectionClassification, error) { if rawMsg == nil { return nil, nil @@ -89,3 +108,22 @@ func unmarshalFirewallPolicyRuleCollectionClassificationArray(rawMsg json.RawMes } return fArray, nil } + +func unmarshalFirewallPolicyRuleCollectionClassificationMap(rawMsg json.RawMessage) (map[string]FirewallPolicyRuleCollectionClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]FirewallPolicyRuleCollectionClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalFirewallPolicyRuleCollectionClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_privatednszonegroups_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_privatednszonegroups_client.go index 7ea5e2876b0d..d8f393641ceb 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_privatednszonegroups_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_privatednszonegroups_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateDNSZoneGroupsClient contains the methods for the PrivateDNSZoneGroups group. @@ -31,8 +31,15 @@ type PrivateDNSZoneGroupsClient struct { } // NewPrivateDNSZoneGroupsClient creates a new instance of PrivateDNSZoneGroupsClient with the specified values. -func NewPrivateDNSZoneGroupsClient(con *arm.Connection, subscriptionID string) *PrivateDNSZoneGroupsClient { - return &PrivateDNSZoneGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateDNSZoneGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateDNSZoneGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateDNSZoneGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a private dns zone group in the specified private endpoint. @@ -96,7 +103,7 @@ func (client *PrivateDNSZoneGroupsClient) createOrUpdateCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -176,7 +183,7 @@ func (client *PrivateDNSZoneGroupsClient) deleteCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *PrivateDNSZoneGroupsClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *PrivateDNSZoneGroupsClient) getCreateRequest(ctx context.Context, func (client *PrivateDNSZoneGroupsClient) getHandleResponse(resp *http.Response) (PrivateDNSZoneGroupsGetResponse, error) { result := PrivateDNSZoneGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateDNSZoneGroup); err != nil { - return PrivateDNSZoneGroupsGetResponse{}, err + return PrivateDNSZoneGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *PrivateDNSZoneGroupsClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *PrivateDNSZoneGroupsClient) listCreateRequest(ctx context.Context, func (client *PrivateDNSZoneGroupsClient) listHandleResponse(resp *http.Response) (PrivateDNSZoneGroupsListResponse, error) { result := PrivateDNSZoneGroupsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateDNSZoneGroupListResult); err != nil { - return PrivateDNSZoneGroupsListResponse{}, err + return PrivateDNSZoneGroupsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_privateendpoints_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_privateendpoints_client.go index 6e11dfbd6f54..e2a8c5ab0694 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_privateendpoints_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_privateendpoints_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateEndpointsClient contains the methods for the PrivateEndpoints group. @@ -31,8 +31,15 @@ type PrivateEndpointsClient struct { } // NewPrivateEndpointsClient creates a new instance of PrivateEndpointsClient with the specified values. -func NewPrivateEndpointsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointsClient { - return &PrivateEndpointsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates an private endpoint in the specified resource group. @@ -92,7 +99,7 @@ func (client *PrivateEndpointsClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *PrivateEndpointsClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *PrivateEndpointsClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -237,7 +244,7 @@ func (client *PrivateEndpointsClient) getCreateRequest(ctx context.Context, reso func (client *PrivateEndpointsClient) getHandleResponse(resp *http.Response) (PrivateEndpointsGetResponse, error) { result := PrivateEndpointsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpoint); err != nil { - return PrivateEndpointsGetResponse{}, err + return PrivateEndpointsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -285,7 +292,7 @@ func (client *PrivateEndpointsClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -295,7 +302,7 @@ func (client *PrivateEndpointsClient) listCreateRequest(ctx context.Context, res func (client *PrivateEndpointsClient) listHandleResponse(resp *http.Response) (PrivateEndpointsListResponse, error) { result := PrivateEndpointsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointListResult); err != nil { - return PrivateEndpointsListResponse{}, err + return PrivateEndpointsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -339,7 +346,7 @@ func (client *PrivateEndpointsClient) listBySubscriptionCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -349,7 +356,7 @@ func (client *PrivateEndpointsClient) listBySubscriptionCreateRequest(ctx contex func (client *PrivateEndpointsClient) listBySubscriptionHandleResponse(resp *http.Response) (PrivateEndpointsListBySubscriptionResponse, error) { result := PrivateEndpointsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointListResult); err != nil { - return PrivateEndpointsListBySubscriptionResponse{}, err + return PrivateEndpointsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_privatelinkservices_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_privatelinkservices_client.go index 89b2e9d84cc5..e2c42c3e2c81 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_privatelinkservices_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_privatelinkservices_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkServicesClient contains the methods for the PrivateLinkServices group. @@ -31,8 +31,15 @@ type PrivateLinkServicesClient struct { } // NewPrivateLinkServicesClient creates a new instance of PrivateLinkServicesClient with the specified values. -func NewPrivateLinkServicesClient(con *arm.Connection, subscriptionID string) *PrivateLinkServicesClient { - return &PrivateLinkServicesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkServicesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkServicesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCheckPrivateLinkServiceVisibility - Checks whether the subscription is visible to private link service. @@ -88,7 +95,7 @@ func (client *PrivateLinkServicesClient) checkPrivateLinkServiceVisibilityCreate return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -165,7 +172,7 @@ func (client *PrivateLinkServicesClient) checkPrivateLinkServiceVisibilityByReso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -241,7 +248,7 @@ func (client *PrivateLinkServicesClient) createOrUpdateCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -317,7 +324,7 @@ func (client *PrivateLinkServicesClient) deleteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -397,7 +404,7 @@ func (client *PrivateLinkServicesClient) deletePrivateEndpointConnectionCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -453,7 +460,7 @@ func (client *PrivateLinkServicesClient) getCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -466,7 +473,7 @@ func (client *PrivateLinkServicesClient) getCreateRequest(ctx context.Context, r func (client *PrivateLinkServicesClient) getHandleResponse(resp *http.Response) (PrivateLinkServicesGetResponse, error) { result := PrivateLinkServicesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkService); err != nil { - return PrivateLinkServicesGetResponse{}, err + return PrivateLinkServicesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -525,7 +532,7 @@ func (client *PrivateLinkServicesClient) getPrivateEndpointConnectionCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -538,7 +545,7 @@ func (client *PrivateLinkServicesClient) getPrivateEndpointConnectionCreateReque func (client *PrivateLinkServicesClient) getPrivateEndpointConnectionHandleResponse(resp *http.Response) (PrivateLinkServicesGetPrivateEndpointConnectionResponse, error) { result := PrivateLinkServicesGetPrivateEndpointConnectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateLinkServicesGetPrivateEndpointConnectionResponse{}, err + return PrivateLinkServicesGetPrivateEndpointConnectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -586,7 +593,7 @@ func (client *PrivateLinkServicesClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -596,7 +603,7 @@ func (client *PrivateLinkServicesClient) listCreateRequest(ctx context.Context, func (client *PrivateLinkServicesClient) listHandleResponse(resp *http.Response) (PrivateLinkServicesListResponse, error) { result := PrivateLinkServicesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServiceListResult); err != nil { - return PrivateLinkServicesListResponse{}, err + return PrivateLinkServicesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -645,7 +652,7 @@ func (client *PrivateLinkServicesClient) listAutoApprovedPrivateLinkServicesCrea return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -655,7 +662,7 @@ func (client *PrivateLinkServicesClient) listAutoApprovedPrivateLinkServicesCrea func (client *PrivateLinkServicesClient) listAutoApprovedPrivateLinkServicesHandleResponse(resp *http.Response) (PrivateLinkServicesListAutoApprovedPrivateLinkServicesResponse, error) { result := PrivateLinkServicesListAutoApprovedPrivateLinkServicesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AutoApprovedPrivateLinkServicesResult); err != nil { - return PrivateLinkServicesListAutoApprovedPrivateLinkServicesResponse{}, err + return PrivateLinkServicesListAutoApprovedPrivateLinkServicesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -708,7 +715,7 @@ func (client *PrivateLinkServicesClient) listAutoApprovedPrivateLinkServicesByRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -718,7 +725,7 @@ func (client *PrivateLinkServicesClient) listAutoApprovedPrivateLinkServicesByRe func (client *PrivateLinkServicesClient) listAutoApprovedPrivateLinkServicesByResourceGroupHandleResponse(resp *http.Response) (PrivateLinkServicesListAutoApprovedPrivateLinkServicesByResourceGroupResponse, error) { result := PrivateLinkServicesListAutoApprovedPrivateLinkServicesByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AutoApprovedPrivateLinkServicesResult); err != nil { - return PrivateLinkServicesListAutoApprovedPrivateLinkServicesByResourceGroupResponse{}, err + return PrivateLinkServicesListAutoApprovedPrivateLinkServicesByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -762,7 +769,7 @@ func (client *PrivateLinkServicesClient) listBySubscriptionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -772,7 +779,7 @@ func (client *PrivateLinkServicesClient) listBySubscriptionCreateRequest(ctx con func (client *PrivateLinkServicesClient) listBySubscriptionHandleResponse(resp *http.Response) (PrivateLinkServicesListBySubscriptionResponse, error) { result := PrivateLinkServicesListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkServiceListResult); err != nil { - return PrivateLinkServicesListBySubscriptionResponse{}, err + return PrivateLinkServicesListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -824,7 +831,7 @@ func (client *PrivateLinkServicesClient) listPrivateEndpointConnectionsCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -834,7 +841,7 @@ func (client *PrivateLinkServicesClient) listPrivateEndpointConnectionsCreateReq func (client *PrivateLinkServicesClient) listPrivateEndpointConnectionsHandleResponse(resp *http.Response) (PrivateLinkServicesListPrivateEndpointConnectionsResponse, error) { result := PrivateLinkServicesListPrivateEndpointConnectionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateLinkServicesListPrivateEndpointConnectionsResponse{}, err + return PrivateLinkServicesListPrivateEndpointConnectionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -893,7 +900,7 @@ func (client *PrivateLinkServicesClient) updatePrivateEndpointConnectionCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -903,7 +910,7 @@ func (client *PrivateLinkServicesClient) updatePrivateEndpointConnectionCreateRe func (client *PrivateLinkServicesClient) updatePrivateEndpointConnectionHandleResponse(resp *http.Response) (PrivateLinkServicesUpdatePrivateEndpointConnectionResponse, error) { result := PrivateLinkServicesUpdatePrivateEndpointConnectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateLinkServicesUpdatePrivateEndpointConnectionResponse{}, err + return PrivateLinkServicesUpdatePrivateEndpointConnectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_publicipaddresses_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_publicipaddresses_client.go index 536468ad8829..e3d2d70b2845 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_publicipaddresses_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_publicipaddresses_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PublicIPAddressesClient contains the methods for the PublicIPAddresses group. @@ -31,8 +31,15 @@ type PublicIPAddressesClient struct { } // NewPublicIPAddressesClient creates a new instance of PublicIPAddressesClient with the specified values. -func NewPublicIPAddressesClient(con *arm.Connection, subscriptionID string) *PublicIPAddressesClient { - return &PublicIPAddressesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPublicIPAddressesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PublicIPAddressesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PublicIPAddressesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a static or dynamic public IP address. @@ -92,7 +99,7 @@ func (client *PublicIPAddressesClient) createOrUpdateCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *PublicIPAddressesClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *PublicIPAddressesClient) getCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -237,7 +244,7 @@ func (client *PublicIPAddressesClient) getCreateRequest(ctx context.Context, res func (client *PublicIPAddressesClient) getHandleResponse(resp *http.Response) (PublicIPAddressesGetResponse, error) { result := PublicIPAddressesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddress); err != nil { - return PublicIPAddressesGetResponse{}, err + return PublicIPAddressesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -308,7 +315,7 @@ func (client *PublicIPAddressesClient) getCloudServicePublicIPAddressCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -321,7 +328,7 @@ func (client *PublicIPAddressesClient) getCloudServicePublicIPAddressCreateReque func (client *PublicIPAddressesClient) getCloudServicePublicIPAddressHandleResponse(resp *http.Response) (PublicIPAddressesGetCloudServicePublicIPAddressResponse, error) { result := PublicIPAddressesGetCloudServicePublicIPAddressResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddress); err != nil { - return PublicIPAddressesGetCloudServicePublicIPAddressResponse{}, err + return PublicIPAddressesGetCloudServicePublicIPAddressResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -405,7 +412,7 @@ func (client *PublicIPAddressesClient) getVirtualMachineScaleSetPublicIPAddressC func (client *PublicIPAddressesClient) getVirtualMachineScaleSetPublicIPAddressHandleResponse(resp *http.Response) (PublicIPAddressesGetVirtualMachineScaleSetPublicIPAddressResponse, error) { result := PublicIPAddressesGetVirtualMachineScaleSetPublicIPAddressResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddress); err != nil { - return PublicIPAddressesGetVirtualMachineScaleSetPublicIPAddressResponse{}, err + return PublicIPAddressesGetVirtualMachineScaleSetPublicIPAddressResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -453,7 +460,7 @@ func (client *PublicIPAddressesClient) listCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -463,7 +470,7 @@ func (client *PublicIPAddressesClient) listCreateRequest(ctx context.Context, re func (client *PublicIPAddressesClient) listHandleResponse(resp *http.Response) (PublicIPAddressesListResponse, error) { result := PublicIPAddressesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddressListResult); err != nil { - return PublicIPAddressesListResponse{}, err + return PublicIPAddressesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -507,7 +514,7 @@ func (client *PublicIPAddressesClient) listAllCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -517,7 +524,7 @@ func (client *PublicIPAddressesClient) listAllCreateRequest(ctx context.Context, func (client *PublicIPAddressesClient) listAllHandleResponse(resp *http.Response) (PublicIPAddressesListAllResponse, error) { result := PublicIPAddressesListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddressListResult); err != nil { - return PublicIPAddressesListAllResponse{}, err + return PublicIPAddressesListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -569,7 +576,7 @@ func (client *PublicIPAddressesClient) listCloudServicePublicIPAddressesCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -579,7 +586,7 @@ func (client *PublicIPAddressesClient) listCloudServicePublicIPAddressesCreateRe func (client *PublicIPAddressesClient) listCloudServicePublicIPAddressesHandleResponse(resp *http.Response) (PublicIPAddressesListCloudServicePublicIPAddressesResponse, error) { result := PublicIPAddressesListCloudServicePublicIPAddressesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddressListResult); err != nil { - return PublicIPAddressesListCloudServicePublicIPAddressesResponse{}, err + return PublicIPAddressesListCloudServicePublicIPAddressesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -643,7 +650,7 @@ func (client *PublicIPAddressesClient) listCloudServiceRoleInstancePublicIPAddre return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -653,7 +660,7 @@ func (client *PublicIPAddressesClient) listCloudServiceRoleInstancePublicIPAddre func (client *PublicIPAddressesClient) listCloudServiceRoleInstancePublicIPAddressesHandleResponse(resp *http.Response) (PublicIPAddressesListCloudServiceRoleInstancePublicIPAddressesResponse, error) { result := PublicIPAddressesListCloudServiceRoleInstancePublicIPAddressesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddressListResult); err != nil { - return PublicIPAddressesListCloudServiceRoleInstancePublicIPAddressesResponse{}, err + return PublicIPAddressesListCloudServiceRoleInstancePublicIPAddressesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -715,7 +722,7 @@ func (client *PublicIPAddressesClient) listVirtualMachineScaleSetPublicIPAddress func (client *PublicIPAddressesClient) listVirtualMachineScaleSetPublicIPAddressesHandleResponse(resp *http.Response) (PublicIPAddressesListVirtualMachineScaleSetPublicIPAddressesResponse, error) { result := PublicIPAddressesListVirtualMachineScaleSetPublicIPAddressesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddressListResult); err != nil { - return PublicIPAddressesListVirtualMachineScaleSetPublicIPAddressesResponse{}, err + return PublicIPAddressesListVirtualMachineScaleSetPublicIPAddressesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -790,7 +797,7 @@ func (client *PublicIPAddressesClient) listVirtualMachineScaleSetVMPublicIPAddre func (client *PublicIPAddressesClient) listVirtualMachineScaleSetVMPublicIPAddressesHandleResponse(resp *http.Response) (PublicIPAddressesListVirtualMachineScaleSetVMPublicIPAddressesResponse, error) { result := PublicIPAddressesListVirtualMachineScaleSetVMPublicIPAddressesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddressListResult); err != nil { - return PublicIPAddressesListVirtualMachineScaleSetVMPublicIPAddressesResponse{}, err + return PublicIPAddressesListVirtualMachineScaleSetVMPublicIPAddressesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -845,7 +852,7 @@ func (client *PublicIPAddressesClient) updateTagsCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -855,7 +862,7 @@ func (client *PublicIPAddressesClient) updateTagsCreateRequest(ctx context.Conte func (client *PublicIPAddressesClient) updateTagsHandleResponse(resp *http.Response) (PublicIPAddressesUpdateTagsResponse, error) { result := PublicIPAddressesUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPAddress); err != nil { - return PublicIPAddressesUpdateTagsResponse{}, err + return PublicIPAddressesUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_publicipprefixes_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_publicipprefixes_client.go index 18254bc97f89..21886fc7eac5 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_publicipprefixes_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_publicipprefixes_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PublicIPPrefixesClient contains the methods for the PublicIPPrefixes group. @@ -31,8 +31,15 @@ type PublicIPPrefixesClient struct { } // NewPublicIPPrefixesClient creates a new instance of PublicIPPrefixesClient with the specified values. -func NewPublicIPPrefixesClient(con *arm.Connection, subscriptionID string) *PublicIPPrefixesClient { - return &PublicIPPrefixesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPublicIPPrefixesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PublicIPPrefixesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PublicIPPrefixesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a static or dynamic public IP prefix. @@ -92,7 +99,7 @@ func (client *PublicIPPrefixesClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *PublicIPPrefixesClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *PublicIPPrefixesClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -237,7 +244,7 @@ func (client *PublicIPPrefixesClient) getCreateRequest(ctx context.Context, reso func (client *PublicIPPrefixesClient) getHandleResponse(resp *http.Response) (PublicIPPrefixesGetResponse, error) { result := PublicIPPrefixesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPPrefix); err != nil { - return PublicIPPrefixesGetResponse{}, err + return PublicIPPrefixesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -285,7 +292,7 @@ func (client *PublicIPPrefixesClient) listCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -295,7 +302,7 @@ func (client *PublicIPPrefixesClient) listCreateRequest(ctx context.Context, res func (client *PublicIPPrefixesClient) listHandleResponse(resp *http.Response) (PublicIPPrefixesListResponse, error) { result := PublicIPPrefixesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPPrefixListResult); err != nil { - return PublicIPPrefixesListResponse{}, err + return PublicIPPrefixesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -339,7 +346,7 @@ func (client *PublicIPPrefixesClient) listAllCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -349,7 +356,7 @@ func (client *PublicIPPrefixesClient) listAllCreateRequest(ctx context.Context, func (client *PublicIPPrefixesClient) listAllHandleResponse(resp *http.Response) (PublicIPPrefixesListAllResponse, error) { result := PublicIPPrefixesListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPPrefixListResult); err != nil { - return PublicIPPrefixesListAllResponse{}, err + return PublicIPPrefixesListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -404,7 +411,7 @@ func (client *PublicIPPrefixesClient) updateTagsCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -414,7 +421,7 @@ func (client *PublicIPPrefixesClient) updateTagsCreateRequest(ctx context.Contex func (client *PublicIPPrefixesClient) updateTagsHandleResponse(resp *http.Response) (PublicIPPrefixesUpdateTagsResponse, error) { result := PublicIPPrefixesUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicIPPrefix); err != nil { - return PublicIPPrefixesUpdateTagsResponse{}, err + return PublicIPPrefixesUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_resourcenavigationlinks_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_resourcenavigationlinks_client.go index b3c5dec5953d..29ebf8a166d4 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_resourcenavigationlinks_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_resourcenavigationlinks_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ResourceNavigationLinksClient contains the methods for the ResourceNavigationLinks group. @@ -30,8 +31,15 @@ type ResourceNavigationLinksClient struct { } // NewResourceNavigationLinksClient creates a new instance of ResourceNavigationLinksClient with the specified values. -func NewResourceNavigationLinksClient(con *arm.Connection, subscriptionID string) *ResourceNavigationLinksClient { - return &ResourceNavigationLinksClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewResourceNavigationLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ResourceNavigationLinksClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ResourceNavigationLinksClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets a list of resource navigation links for a subnet. @@ -75,7 +83,7 @@ func (client *ResourceNavigationLinksClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -85,7 +93,7 @@ func (client *ResourceNavigationLinksClient) listCreateRequest(ctx context.Conte func (client *ResourceNavigationLinksClient) listHandleResponse(resp *http.Response) (ResourceNavigationLinksListResponse, error) { result := ResourceNavigationLinksListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceNavigationLinksListResult); err != nil { - return ResourceNavigationLinksListResponse{}, err + return ResourceNavigationLinksListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_response_types.go b/sdk/resourcemanager/network/armnetwork/zz_generated_response_types.go index 406d9ccaeec1..45d57327ed01 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_response_types.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armnetwork import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // ApplicationGatewayPrivateEndpointConnectionsDeletePollerResponse contains the response from method ApplicationGatewayPrivateEndpointConnections.Delete. @@ -26,6 +25,8 @@ type ApplicationGatewayPrivateEndpointConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ApplicationGatewayPrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ApplicationGatewayPrivateEndpointConnectionsDeleteResponse, error) { respType := ApplicationGatewayPrivateEndpointConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -94,6 +95,8 @@ type ApplicationGatewayPrivateEndpointConnectionsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ApplicationGatewayPrivateEndpointConnectionsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ApplicationGatewayPrivateEndpointConnectionsUpdateResponse, error) { respType := ApplicationGatewayPrivateEndpointConnectionsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ApplicationGatewayPrivateEndpointConnection) @@ -156,6 +159,8 @@ type ApplicationGatewaysBackendHealthOnDemandPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ApplicationGatewaysBackendHealthOnDemandPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ApplicationGatewaysBackendHealthOnDemandResponse, error) { respType := ApplicationGatewaysBackendHealthOnDemandResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ApplicationGatewayBackendHealthOnDemand) @@ -206,6 +211,8 @@ type ApplicationGatewaysBackendHealthPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ApplicationGatewaysBackendHealthPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ApplicationGatewaysBackendHealthResponse, error) { respType := ApplicationGatewaysBackendHealthResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ApplicationGatewayBackendHealth) @@ -256,6 +263,8 @@ type ApplicationGatewaysCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ApplicationGatewaysCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ApplicationGatewaysCreateOrUpdateResponse, error) { respType := ApplicationGatewaysCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ApplicationGateway) @@ -306,6 +315,8 @@ type ApplicationGatewaysDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ApplicationGatewaysDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ApplicationGatewaysDeleteResponse, error) { respType := ApplicationGatewaysDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -473,6 +484,8 @@ type ApplicationGatewaysStartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ApplicationGatewaysStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ApplicationGatewaysStartResponse, error) { respType := ApplicationGatewaysStartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -517,6 +530,8 @@ type ApplicationGatewaysStopPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ApplicationGatewaysStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ApplicationGatewaysStopResponse, error) { respType := ApplicationGatewaysStopResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -573,6 +588,8 @@ type ApplicationSecurityGroupsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ApplicationSecurityGroupsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ApplicationSecurityGroupsCreateOrUpdateResponse, error) { respType := ApplicationSecurityGroupsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ApplicationSecurityGroup) @@ -623,6 +640,8 @@ type ApplicationSecurityGroupsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ApplicationSecurityGroupsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ApplicationSecurityGroupsDeleteResponse, error) { respType := ApplicationSecurityGroupsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -811,6 +830,8 @@ type AzureFirewallsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AzureFirewallsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AzureFirewallsCreateOrUpdateResponse, error) { respType := AzureFirewallsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AzureFirewall) @@ -861,6 +882,8 @@ type AzureFirewallsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AzureFirewallsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AzureFirewallsDeleteResponse, error) { respType := AzureFirewallsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -941,6 +964,8 @@ type AzureFirewallsUpdateTagsPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AzureFirewallsUpdateTagsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AzureFirewallsUpdateTagsResponse, error) { respType := AzureFirewallsUpdateTagsResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AzureFirewall) @@ -991,6 +1016,8 @@ type BastionHostsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l BastionHostsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BastionHostsCreateOrUpdateResponse, error) { respType := BastionHostsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.BastionHost) @@ -1041,6 +1068,8 @@ type BastionHostsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l BastionHostsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BastionHostsDeleteResponse, error) { respType := BastionHostsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1121,6 +1150,8 @@ type BastionHostsUpdateTagsPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l BastionHostsUpdateTagsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BastionHostsUpdateTagsResponse, error) { respType := BastionHostsUpdateTagsResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.BastionHost) @@ -1183,6 +1214,8 @@ type ConnectionMonitorsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ConnectionMonitorsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ConnectionMonitorsCreateOrUpdateResponse, error) { respType := ConnectionMonitorsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ConnectionMonitorResult) @@ -1233,6 +1266,8 @@ type ConnectionMonitorsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ConnectionMonitorsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ConnectionMonitorsDeleteResponse, error) { respType := ConnectionMonitorsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1301,6 +1336,8 @@ type ConnectionMonitorsQueryPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ConnectionMonitorsQueryPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ConnectionMonitorsQueryResponse, error) { respType := ConnectionMonitorsQueryResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ConnectionMonitorQueryResult) @@ -1351,6 +1388,8 @@ type ConnectionMonitorsStartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ConnectionMonitorsStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ConnectionMonitorsStartResponse, error) { respType := ConnectionMonitorsStartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1395,6 +1434,8 @@ type ConnectionMonitorsStopPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ConnectionMonitorsStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ConnectionMonitorsStopResponse, error) { respType := ConnectionMonitorsStopResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1451,6 +1492,8 @@ type CustomIPPrefixesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CustomIPPrefixesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CustomIPPrefixesCreateOrUpdateResponse, error) { respType := CustomIPPrefixesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.CustomIPPrefix) @@ -1501,6 +1544,8 @@ type CustomIPPrefixesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l CustomIPPrefixesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (CustomIPPrefixesDeleteResponse, error) { respType := CustomIPPrefixesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1593,6 +1638,8 @@ type DdosCustomPoliciesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DdosCustomPoliciesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DdosCustomPoliciesCreateOrUpdateResponse, error) { respType := DdosCustomPoliciesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DdosCustomPolicy) @@ -1643,6 +1690,8 @@ type DdosCustomPoliciesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DdosCustomPoliciesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DdosCustomPoliciesDeleteResponse, error) { respType := DdosCustomPoliciesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1711,6 +1760,8 @@ type DdosProtectionPlansCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DdosProtectionPlansCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DdosProtectionPlansCreateOrUpdateResponse, error) { respType := DdosProtectionPlansCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DdosProtectionPlan) @@ -1761,6 +1812,8 @@ type DdosProtectionPlansDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DdosProtectionPlansDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DdosProtectionPlansDeleteResponse, error) { respType := DdosProtectionPlansDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1877,6 +1930,8 @@ type DscpConfigurationCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DscpConfigurationCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DscpConfigurationCreateOrUpdateResponse, error) { respType := DscpConfigurationCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DscpConfiguration) @@ -1927,6 +1982,8 @@ type DscpConfigurationDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DscpConfigurationDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DscpConfigurationDeleteResponse, error) { respType := DscpConfigurationDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2007,6 +2064,8 @@ type ExpressRouteCircuitAuthorizationsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteCircuitAuthorizationsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteCircuitAuthorizationsCreateOrUpdateResponse, error) { respType := ExpressRouteCircuitAuthorizationsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ExpressRouteCircuitAuthorization) @@ -2057,6 +2116,8 @@ type ExpressRouteCircuitAuthorizationsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteCircuitAuthorizationsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteCircuitAuthorizationsDeleteResponse, error) { respType := ExpressRouteCircuitAuthorizationsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2125,6 +2186,8 @@ type ExpressRouteCircuitConnectionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteCircuitConnectionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteCircuitConnectionsCreateOrUpdateResponse, error) { respType := ExpressRouteCircuitConnectionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ExpressRouteCircuitConnection) @@ -2175,6 +2238,8 @@ type ExpressRouteCircuitConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteCircuitConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteCircuitConnectionsDeleteResponse, error) { respType := ExpressRouteCircuitConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2243,6 +2308,8 @@ type ExpressRouteCircuitPeeringsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteCircuitPeeringsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteCircuitPeeringsCreateOrUpdateResponse, error) { respType := ExpressRouteCircuitPeeringsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ExpressRouteCircuitPeering) @@ -2293,6 +2360,8 @@ type ExpressRouteCircuitPeeringsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteCircuitPeeringsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteCircuitPeeringsDeleteResponse, error) { respType := ExpressRouteCircuitPeeringsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2361,6 +2430,8 @@ type ExpressRouteCircuitsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteCircuitsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteCircuitsCreateOrUpdateResponse, error) { respType := ExpressRouteCircuitsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ExpressRouteCircuit) @@ -2411,6 +2482,8 @@ type ExpressRouteCircuitsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteCircuitsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteCircuitsDeleteResponse, error) { respType := ExpressRouteCircuitsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2503,6 +2576,8 @@ type ExpressRouteCircuitsListArpTablePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteCircuitsListArpTablePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteCircuitsListArpTableResponse, error) { respType := ExpressRouteCircuitsListArpTableResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ExpressRouteCircuitsArpTableListResult) @@ -2565,6 +2640,8 @@ type ExpressRouteCircuitsListRoutesTablePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteCircuitsListRoutesTablePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteCircuitsListRoutesTableResponse, error) { respType := ExpressRouteCircuitsListRoutesTableResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ExpressRouteCircuitsRoutesTableListResult) @@ -2615,6 +2692,8 @@ type ExpressRouteCircuitsListRoutesTableSummaryPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteCircuitsListRoutesTableSummaryPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteCircuitsListRoutesTableSummaryResponse, error) { respType := ExpressRouteCircuitsListRoutesTableSummaryResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ExpressRouteCircuitsRoutesTableSummaryListResult) @@ -2677,6 +2756,8 @@ type ExpressRouteConnectionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteConnectionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteConnectionsCreateOrUpdateResponse, error) { respType := ExpressRouteConnectionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ExpressRouteConnection) @@ -2727,6 +2808,8 @@ type ExpressRouteConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteConnectionsDeleteResponse, error) { respType := ExpressRouteConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2795,6 +2878,8 @@ type ExpressRouteCrossConnectionPeeringsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteCrossConnectionPeeringsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteCrossConnectionPeeringsCreateOrUpdateResponse, error) { respType := ExpressRouteCrossConnectionPeeringsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ExpressRouteCrossConnectionPeering) @@ -2845,6 +2930,8 @@ type ExpressRouteCrossConnectionPeeringsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteCrossConnectionPeeringsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteCrossConnectionPeeringsDeleteResponse, error) { respType := ExpressRouteCrossConnectionPeeringsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2913,6 +3000,8 @@ type ExpressRouteCrossConnectionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteCrossConnectionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteCrossConnectionsCreateOrUpdateResponse, error) { respType := ExpressRouteCrossConnectionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ExpressRouteCrossConnection) @@ -2975,6 +3064,8 @@ type ExpressRouteCrossConnectionsListArpTablePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteCrossConnectionsListArpTablePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteCrossConnectionsListArpTableResponse, error) { respType := ExpressRouteCrossConnectionsListArpTableResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ExpressRouteCircuitsArpTableListResult) @@ -3049,6 +3140,8 @@ type ExpressRouteCrossConnectionsListRoutesTablePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteCrossConnectionsListRoutesTablePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteCrossConnectionsListRoutesTableResponse, error) { respType := ExpressRouteCrossConnectionsListRoutesTableResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ExpressRouteCircuitsRoutesTableListResult) @@ -3099,6 +3192,8 @@ type ExpressRouteCrossConnectionsListRoutesTableSummaryPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteCrossConnectionsListRoutesTableSummaryPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteCrossConnectionsListRoutesTableSummaryResponse, error) { respType := ExpressRouteCrossConnectionsListRoutesTableSummaryResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ExpressRouteCrossConnectionsRoutesTableSummaryListResult) @@ -3161,6 +3256,8 @@ type ExpressRouteGatewaysCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteGatewaysCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteGatewaysCreateOrUpdateResponse, error) { respType := ExpressRouteGatewaysCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ExpressRouteGateway) @@ -3211,6 +3308,8 @@ type ExpressRouteGatewaysDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteGatewaysDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteGatewaysDeleteResponse, error) { respType := ExpressRouteGatewaysDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3291,6 +3390,8 @@ type ExpressRouteGatewaysUpdateTagsPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRouteGatewaysUpdateTagsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRouteGatewaysUpdateTagsResponse, error) { respType := ExpressRouteGatewaysUpdateTagsResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ExpressRouteGateway) @@ -3365,6 +3466,8 @@ type ExpressRoutePortsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRoutePortsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRoutePortsCreateOrUpdateResponse, error) { respType := ExpressRoutePortsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ExpressRoutePort) @@ -3415,6 +3518,8 @@ type ExpressRoutePortsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExpressRoutePortsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExpressRoutePortsDeleteResponse, error) { respType := ExpressRoutePortsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3555,6 +3660,8 @@ type FirewallPoliciesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FirewallPoliciesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FirewallPoliciesCreateOrUpdateResponse, error) { respType := FirewallPoliciesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.FirewallPolicy) @@ -3605,6 +3712,8 @@ type FirewallPoliciesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FirewallPoliciesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FirewallPoliciesDeleteResponse, error) { respType := FirewallPoliciesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3675,6 +3784,78 @@ type FirewallPoliciesListResult struct { FirewallPolicyListResult } +// FirewallPolicyIdpsSignaturesFilterValuesListResponse contains the response from method FirewallPolicyIdpsSignaturesFilterValues.List. +type FirewallPolicyIdpsSignaturesFilterValuesListResponse struct { + FirewallPolicyIdpsSignaturesFilterValuesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// FirewallPolicyIdpsSignaturesFilterValuesListResult contains the result from method FirewallPolicyIdpsSignaturesFilterValues.List. +type FirewallPolicyIdpsSignaturesFilterValuesListResult struct { + SignatureOverridesFilterValuesResponse +} + +// FirewallPolicyIdpsSignaturesListResponse contains the response from method FirewallPolicyIdpsSignatures.List. +type FirewallPolicyIdpsSignaturesListResponse struct { + FirewallPolicyIdpsSignaturesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// FirewallPolicyIdpsSignaturesListResult contains the result from method FirewallPolicyIdpsSignatures.List. +type FirewallPolicyIdpsSignaturesListResult struct { + QueryResults +} + +// FirewallPolicyIdpsSignaturesOverridesGetResponse contains the response from method FirewallPolicyIdpsSignaturesOverrides.Get. +type FirewallPolicyIdpsSignaturesOverridesGetResponse struct { + FirewallPolicyIdpsSignaturesOverridesGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// FirewallPolicyIdpsSignaturesOverridesGetResult contains the result from method FirewallPolicyIdpsSignaturesOverrides.Get. +type FirewallPolicyIdpsSignaturesOverridesGetResult struct { + SignaturesOverrides +} + +// FirewallPolicyIdpsSignaturesOverridesListResponse contains the response from method FirewallPolicyIdpsSignaturesOverrides.List. +type FirewallPolicyIdpsSignaturesOverridesListResponse struct { + FirewallPolicyIdpsSignaturesOverridesListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// FirewallPolicyIdpsSignaturesOverridesListResult contains the result from method FirewallPolicyIdpsSignaturesOverrides.List. +type FirewallPolicyIdpsSignaturesOverridesListResult struct { + SignaturesOverridesList +} + +// FirewallPolicyIdpsSignaturesOverridesPatchResponse contains the response from method FirewallPolicyIdpsSignaturesOverrides.Patch. +type FirewallPolicyIdpsSignaturesOverridesPatchResponse struct { + FirewallPolicyIdpsSignaturesOverridesPatchResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// FirewallPolicyIdpsSignaturesOverridesPatchResult contains the result from method FirewallPolicyIdpsSignaturesOverrides.Patch. +type FirewallPolicyIdpsSignaturesOverridesPatchResult struct { + SignaturesOverrides +} + +// FirewallPolicyIdpsSignaturesOverridesPutResponse contains the response from method FirewallPolicyIdpsSignaturesOverrides.Put. +type FirewallPolicyIdpsSignaturesOverridesPutResponse struct { + FirewallPolicyIdpsSignaturesOverridesPutResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// FirewallPolicyIdpsSignaturesOverridesPutResult contains the result from method FirewallPolicyIdpsSignaturesOverrides.Put. +type FirewallPolicyIdpsSignaturesOverridesPutResult struct { + SignaturesOverrides +} + // FirewallPolicyRuleCollectionGroupsCreateOrUpdatePollerResponse contains the response from method FirewallPolicyRuleCollectionGroups.CreateOrUpdate. type FirewallPolicyRuleCollectionGroupsCreateOrUpdatePollerResponse struct { // Poller contains an initialized poller. @@ -3685,6 +3866,8 @@ type FirewallPolicyRuleCollectionGroupsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FirewallPolicyRuleCollectionGroupsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FirewallPolicyRuleCollectionGroupsCreateOrUpdateResponse, error) { respType := FirewallPolicyRuleCollectionGroupsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.FirewallPolicyRuleCollectionGroup) @@ -3735,6 +3918,8 @@ type FirewallPolicyRuleCollectionGroupsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FirewallPolicyRuleCollectionGroupsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FirewallPolicyRuleCollectionGroupsDeleteResponse, error) { respType := FirewallPolicyRuleCollectionGroupsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3803,6 +3988,8 @@ type FlowLogsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FlowLogsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FlowLogsCreateOrUpdateResponse, error) { respType := FlowLogsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.FlowLog) @@ -3853,6 +4040,8 @@ type FlowLogsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FlowLogsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FlowLogsDeleteResponse, error) { respType := FlowLogsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3933,6 +4122,8 @@ type HubRouteTablesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l HubRouteTablesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (HubRouteTablesCreateOrUpdateResponse, error) { respType := HubRouteTablesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.HubRouteTable) @@ -3983,6 +4174,8 @@ type HubRouteTablesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l HubRouteTablesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (HubRouteTablesDeleteResponse, error) { respType := HubRouteTablesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4051,6 +4244,8 @@ type HubVirtualNetworkConnectionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l HubVirtualNetworkConnectionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (HubVirtualNetworkConnectionsCreateOrUpdateResponse, error) { respType := HubVirtualNetworkConnectionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.HubVirtualNetworkConnection) @@ -4101,6 +4296,8 @@ type HubVirtualNetworkConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l HubVirtualNetworkConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (HubVirtualNetworkConnectionsDeleteResponse, error) { respType := HubVirtualNetworkConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4169,6 +4366,8 @@ type IPAllocationsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l IPAllocationsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (IPAllocationsCreateOrUpdateResponse, error) { respType := IPAllocationsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.IPAllocation) @@ -4219,6 +4418,8 @@ type IPAllocationsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l IPAllocationsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (IPAllocationsDeleteResponse, error) { respType := IPAllocationsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4311,6 +4512,8 @@ type IPGroupsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l IPGroupsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (IPGroupsCreateOrUpdateResponse, error) { respType := IPGroupsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.IPGroup) @@ -4361,6 +4564,8 @@ type IPGroupsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l IPGroupsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (IPGroupsDeleteResponse, error) { respType := IPGroupsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4453,6 +4658,8 @@ type InboundNatRulesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l InboundNatRulesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (InboundNatRulesCreateOrUpdateResponse, error) { respType := InboundNatRulesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.InboundNatRule) @@ -4503,6 +4710,8 @@ type InboundNatRulesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l InboundNatRulesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (InboundNatRulesDeleteResponse, error) { respType := InboundNatRulesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4571,6 +4780,8 @@ type InboundSecurityRuleCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l InboundSecurityRuleCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (InboundSecurityRuleCreateOrUpdateResponse, error) { respType := InboundSecurityRuleCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.InboundSecurityRule) @@ -4621,6 +4832,8 @@ type LoadBalancerBackendAddressPoolsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LoadBalancerBackendAddressPoolsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LoadBalancerBackendAddressPoolsCreateOrUpdateResponse, error) { respType := LoadBalancerBackendAddressPoolsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.BackendAddressPool) @@ -4671,6 +4884,8 @@ type LoadBalancerBackendAddressPoolsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LoadBalancerBackendAddressPoolsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LoadBalancerBackendAddressPoolsDeleteResponse, error) { respType := LoadBalancerBackendAddressPoolsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4847,6 +5062,8 @@ type LoadBalancersCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LoadBalancersCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LoadBalancersCreateOrUpdateResponse, error) { respType := LoadBalancersCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LoadBalancer) @@ -4897,6 +5114,8 @@ type LoadBalancersDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LoadBalancersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LoadBalancersDeleteResponse, error) { respType := LoadBalancersDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4955,6 +5174,58 @@ type LoadBalancersListAllResult struct { LoadBalancerListResult } +// LoadBalancersListInboundNatRulePortMappingsPollerResponse contains the response from method LoadBalancers.ListInboundNatRulePortMappings. +type LoadBalancersListInboundNatRulePortMappingsPollerResponse struct { + // Poller contains an initialized poller. + Poller *LoadBalancersListInboundNatRulePortMappingsPoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l LoadBalancersListInboundNatRulePortMappingsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LoadBalancersListInboundNatRulePortMappingsResponse, error) { + respType := LoadBalancersListInboundNatRulePortMappingsResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.BackendAddressInboundNatRulePortMappings) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a LoadBalancersListInboundNatRulePortMappingsPollerResponse from the provided client and resume token. +func (l *LoadBalancersListInboundNatRulePortMappingsPollerResponse) Resume(ctx context.Context, client *LoadBalancersClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("LoadBalancersClient.ListInboundNatRulePortMappings", token, client.pl, client.listInboundNatRulePortMappingsHandleError) + if err != nil { + return err + } + poller := &LoadBalancersListInboundNatRulePortMappingsPoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// LoadBalancersListInboundNatRulePortMappingsResponse contains the response from method LoadBalancers.ListInboundNatRulePortMappings. +type LoadBalancersListInboundNatRulePortMappingsResponse struct { + LoadBalancersListInboundNatRulePortMappingsResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// LoadBalancersListInboundNatRulePortMappingsResult contains the result from method LoadBalancers.ListInboundNatRulePortMappings. +type LoadBalancersListInboundNatRulePortMappingsResult struct { + BackendAddressInboundNatRulePortMappings +} + // LoadBalancersListResponse contains the response from method LoadBalancers.List. type LoadBalancersListResponse struct { LoadBalancersListResult @@ -4977,6 +5248,8 @@ type LoadBalancersSwapPublicIPAddressesPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LoadBalancersSwapPublicIPAddressesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LoadBalancersSwapPublicIPAddressesResponse, error) { respType := LoadBalancersSwapPublicIPAddressesResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5033,6 +5306,8 @@ type LocalNetworkGatewaysCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LocalNetworkGatewaysCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LocalNetworkGatewaysCreateOrUpdateResponse, error) { respType := LocalNetworkGatewaysCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LocalNetworkGateway) @@ -5083,6 +5358,8 @@ type LocalNetworkGatewaysDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LocalNetworkGatewaysDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LocalNetworkGatewaysDeleteResponse, error) { respType := LocalNetworkGatewaysDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5163,6 +5440,8 @@ type NatGatewaysCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NatGatewaysCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NatGatewaysCreateOrUpdateResponse, error) { respType := NatGatewaysCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.NatGateway) @@ -5213,6 +5492,8 @@ type NatGatewaysDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NatGatewaysDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NatGatewaysDeleteResponse, error) { respType := NatGatewaysDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5305,6 +5586,8 @@ type NatRulesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NatRulesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NatRulesCreateOrUpdateResponse, error) { respType := NatRulesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VPNGatewayNatRule) @@ -5355,6 +5638,8 @@ type NatRulesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NatRulesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NatRulesDeleteResponse, error) { respType := NatRulesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5459,6 +5744,8 @@ type NetworkInterfaceTapConfigurationsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkInterfaceTapConfigurationsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkInterfaceTapConfigurationsCreateOrUpdateResponse, error) { respType := NetworkInterfaceTapConfigurationsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.NetworkInterfaceTapConfiguration) @@ -5509,6 +5796,8 @@ type NetworkInterfaceTapConfigurationsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkInterfaceTapConfigurationsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkInterfaceTapConfigurationsDeleteResponse, error) { respType := NetworkInterfaceTapConfigurationsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5577,6 +5866,8 @@ type NetworkInterfacesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkInterfacesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkInterfacesCreateOrUpdateResponse, error) { respType := NetworkInterfacesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.NetworkInterface) @@ -5627,6 +5918,8 @@ type NetworkInterfacesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkInterfacesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkInterfacesDeleteResponse, error) { respType := NetworkInterfacesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5683,6 +5976,8 @@ type NetworkInterfacesGetEffectiveRouteTablePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkInterfacesGetEffectiveRouteTablePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkInterfacesGetEffectiveRouteTableResponse, error) { respType := NetworkInterfacesGetEffectiveRouteTableResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.EffectiveRouteListResult) @@ -5805,6 +6100,8 @@ type NetworkInterfacesListEffectiveNetworkSecurityGroupsPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkInterfacesListEffectiveNetworkSecurityGroupsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkInterfacesListEffectiveNetworkSecurityGroupsResponse, error) { respType := NetworkInterfacesListEffectiveNetworkSecurityGroupsResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.EffectiveNetworkSecurityGroupListResult) @@ -5927,6 +6224,8 @@ type NetworkManagementClientDeleteBastionShareableLinkPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkManagementClientDeleteBastionShareableLinkPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkManagementClientDeleteBastionShareableLinkResponse, error) { respType := NetworkManagementClientDeleteBastionShareableLinkResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5983,6 +6282,8 @@ type NetworkManagementClientGeneratevirtualwanvpnserverconfigurationvpnprofilePo } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkManagementClientGeneratevirtualwanvpnserverconfigurationvpnprofilePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkManagementClientGeneratevirtualwanvpnserverconfigurationvpnprofileResponse, error) { respType := NetworkManagementClientGeneratevirtualwanvpnserverconfigurationvpnprofileResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VPNProfileResponse) @@ -6033,6 +6334,8 @@ type NetworkManagementClientGetActiveSessionsPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkManagementClientGetActiveSessionsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (*NetworkManagementClientGetActiveSessionsPager, error) { respType := &NetworkManagementClientGetActiveSessionsPager{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.current.BastionActiveSessionListResult) @@ -6097,6 +6400,8 @@ type NetworkManagementClientPutBastionShareableLinkPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkManagementClientPutBastionShareableLinkPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (*NetworkManagementClientPutBastionShareableLinkPager, error) { respType := &NetworkManagementClientPutBastionShareableLinkPager{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.current.BastionShareableLinkListResult) @@ -6173,6 +6478,8 @@ type NetworkProfilesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkProfilesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkProfilesDeleteResponse, error) { respType := NetworkProfilesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6265,6 +6572,8 @@ type NetworkSecurityGroupsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkSecurityGroupsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkSecurityGroupsCreateOrUpdateResponse, error) { respType := NetworkSecurityGroupsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.NetworkSecurityGroup) @@ -6315,6 +6624,8 @@ type NetworkSecurityGroupsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkSecurityGroupsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkSecurityGroupsDeleteResponse, error) { respType := NetworkSecurityGroupsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6407,6 +6718,8 @@ type NetworkVirtualAppliancesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkVirtualAppliancesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkVirtualAppliancesCreateOrUpdateResponse, error) { respType := NetworkVirtualAppliancesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.NetworkVirtualAppliance) @@ -6457,6 +6770,8 @@ type NetworkVirtualAppliancesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkVirtualAppliancesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkVirtualAppliancesDeleteResponse, error) { respType := NetworkVirtualAppliancesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6549,6 +6864,8 @@ type NetworkWatchersCheckConnectivityPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkWatchersCheckConnectivityPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkWatchersCheckConnectivityResponse, error) { respType := NetworkWatchersCheckConnectivityResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ConnectivityInformation) @@ -6611,6 +6928,8 @@ type NetworkWatchersDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkWatchersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkWatchersDeleteResponse, error) { respType := NetworkWatchersDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6655,6 +6974,8 @@ type NetworkWatchersGetAzureReachabilityReportPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkWatchersGetAzureReachabilityReportPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkWatchersGetAzureReachabilityReportResponse, error) { respType := NetworkWatchersGetAzureReachabilityReportResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AzureReachabilityReport) @@ -6705,6 +7026,8 @@ type NetworkWatchersGetFlowLogStatusPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkWatchersGetFlowLogStatusPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkWatchersGetFlowLogStatusResponse, error) { respType := NetworkWatchersGetFlowLogStatusResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.FlowLogInformation) @@ -6755,6 +7078,8 @@ type NetworkWatchersGetNetworkConfigurationDiagnosticPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkWatchersGetNetworkConfigurationDiagnosticPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkWatchersGetNetworkConfigurationDiagnosticResponse, error) { respType := NetworkWatchersGetNetworkConfigurationDiagnosticResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.NetworkConfigurationDiagnosticResponse) @@ -6805,6 +7130,8 @@ type NetworkWatchersGetNextHopPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkWatchersGetNextHopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkWatchersGetNextHopResponse, error) { respType := NetworkWatchersGetNextHopResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.NextHopResult) @@ -6879,6 +7206,8 @@ type NetworkWatchersGetTroubleshootingPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkWatchersGetTroubleshootingPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkWatchersGetTroubleshootingResponse, error) { respType := NetworkWatchersGetTroubleshootingResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.TroubleshootingResult) @@ -6929,6 +7258,8 @@ type NetworkWatchersGetTroubleshootingResultPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkWatchersGetTroubleshootingResultPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkWatchersGetTroubleshootingResultResponse, error) { respType := NetworkWatchersGetTroubleshootingResultResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.TroubleshootingResult) @@ -6979,6 +7310,8 @@ type NetworkWatchersGetVMSecurityRulesPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkWatchersGetVMSecurityRulesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkWatchersGetVMSecurityRulesResponse, error) { respType := NetworkWatchersGetVMSecurityRulesResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SecurityGroupViewResult) @@ -7041,6 +7374,8 @@ type NetworkWatchersListAvailableProvidersPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkWatchersListAvailableProvidersPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkWatchersListAvailableProvidersResponse, error) { respType := NetworkWatchersListAvailableProvidersResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AvailableProvidersList) @@ -7103,6 +7438,8 @@ type NetworkWatchersSetFlowLogConfigurationPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkWatchersSetFlowLogConfigurationPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkWatchersSetFlowLogConfigurationResponse, error) { respType := NetworkWatchersSetFlowLogConfigurationResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.FlowLogInformation) @@ -7165,6 +7502,8 @@ type NetworkWatchersVerifyIPFlowPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NetworkWatchersVerifyIPFlowPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NetworkWatchersVerifyIPFlowResponse, error) { respType := NetworkWatchersVerifyIPFlowResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VerificationIPFlowResult) @@ -7227,6 +7566,8 @@ type P2SVPNGatewaysCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l P2SVPNGatewaysCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (P2SVPNGatewaysCreateOrUpdateResponse, error) { respType := P2SVPNGatewaysCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.P2SVPNGateway) @@ -7277,6 +7618,8 @@ type P2SVPNGatewaysDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l P2SVPNGatewaysDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (P2SVPNGatewaysDeleteResponse, error) { respType := P2SVPNGatewaysDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7321,6 +7664,8 @@ type P2SVPNGatewaysDisconnectP2SVPNConnectionsPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l P2SVPNGatewaysDisconnectP2SVPNConnectionsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (P2SVPNGatewaysDisconnectP2SVPNConnectionsResponse, error) { respType := P2SVPNGatewaysDisconnectP2SVPNConnectionsResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7365,6 +7710,8 @@ type P2SVPNGatewaysGenerateVPNProfilePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l P2SVPNGatewaysGenerateVPNProfilePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (P2SVPNGatewaysGenerateVPNProfileResponse, error) { respType := P2SVPNGatewaysGenerateVPNProfileResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VPNProfileResponse) @@ -7415,6 +7762,8 @@ type P2SVPNGatewaysGetP2SVPNConnectionHealthDetailedPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l P2SVPNGatewaysGetP2SVPNConnectionHealthDetailedPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (P2SVPNGatewaysGetP2SVPNConnectionHealthDetailedResponse, error) { respType := P2SVPNGatewaysGetP2SVPNConnectionHealthDetailedResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.P2SVPNConnectionHealth) @@ -7465,6 +7814,8 @@ type P2SVPNGatewaysGetP2SVPNConnectionHealthPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l P2SVPNGatewaysGetP2SVPNConnectionHealthPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (P2SVPNGatewaysGetP2SVPNConnectionHealthResponse, error) { respType := P2SVPNGatewaysGetP2SVPNConnectionHealthResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.P2SVPNGateway) @@ -7551,6 +7902,8 @@ type P2SVPNGatewaysResetPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l P2SVPNGatewaysResetPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (P2SVPNGatewaysResetResponse, error) { respType := P2SVPNGatewaysResetResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.P2SVPNGateway) @@ -7601,6 +7954,8 @@ type P2SVPNGatewaysUpdateTagsPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l P2SVPNGatewaysUpdateTagsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (P2SVPNGatewaysUpdateTagsResponse, error) { respType := P2SVPNGatewaysUpdateTagsResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.P2SVPNGateway) @@ -7651,6 +8006,8 @@ type PacketCapturesCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PacketCapturesCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PacketCapturesCreateResponse, error) { respType := PacketCapturesCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PacketCaptureResult) @@ -7701,6 +8058,8 @@ type PacketCapturesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PacketCapturesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PacketCapturesDeleteResponse, error) { respType := PacketCapturesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7757,6 +8116,8 @@ type PacketCapturesGetStatusPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PacketCapturesGetStatusPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PacketCapturesGetStatusResponse, error) { respType := PacketCapturesGetStatusResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PacketCaptureQueryStatusResult) @@ -7819,6 +8180,8 @@ type PacketCapturesStopPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PacketCapturesStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PacketCapturesStopResponse, error) { respType := PacketCapturesStopResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7887,6 +8250,8 @@ type PrivateDNSZoneGroupsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateDNSZoneGroupsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateDNSZoneGroupsCreateOrUpdateResponse, error) { respType := PrivateDNSZoneGroupsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateDNSZoneGroup) @@ -7937,6 +8302,8 @@ type PrivateDNSZoneGroupsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateDNSZoneGroupsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateDNSZoneGroupsDeleteResponse, error) { respType := PrivateDNSZoneGroupsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -8005,6 +8372,8 @@ type PrivateEndpointsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointsCreateOrUpdateResponse, error) { respType := PrivateEndpointsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpoint) @@ -8055,6 +8424,8 @@ type PrivateEndpointsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointsDeleteResponse, error) { respType := PrivateEndpointsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -8135,6 +8506,8 @@ type PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupPollerRe } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupResponse, error) { respType := PrivateLinkServicesCheckPrivateLinkServiceVisibilityByResourceGroupResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateLinkServiceVisibility) @@ -8185,6 +8558,8 @@ type PrivateLinkServicesCheckPrivateLinkServiceVisibilityPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateLinkServicesCheckPrivateLinkServiceVisibilityPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesCheckPrivateLinkServiceVisibilityResponse, error) { respType := PrivateLinkServicesCheckPrivateLinkServiceVisibilityResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateLinkServiceVisibility) @@ -8235,6 +8610,8 @@ type PrivateLinkServicesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateLinkServicesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesCreateOrUpdateResponse, error) { respType := PrivateLinkServicesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateLinkService) @@ -8285,6 +8662,8 @@ type PrivateLinkServicesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateLinkServicesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesDeleteResponse, error) { respType := PrivateLinkServicesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -8323,6 +8702,8 @@ type PrivateLinkServicesDeletePrivateEndpointConnectionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateLinkServicesDeletePrivateEndpointConnectionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateLinkServicesDeletePrivateEndpointConnectionResponse, error) { respType := PrivateLinkServicesDeletePrivateEndpointConnectionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -8469,6 +8850,8 @@ type PublicIPAddressesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PublicIPAddressesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PublicIPAddressesCreateOrUpdateResponse, error) { respType := PublicIPAddressesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PublicIPAddress) @@ -8519,6 +8902,8 @@ type PublicIPAddressesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PublicIPAddressesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PublicIPAddressesDeleteResponse, error) { respType := PublicIPAddressesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -8683,6 +9068,8 @@ type PublicIPPrefixesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PublicIPPrefixesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PublicIPPrefixesCreateOrUpdateResponse, error) { respType := PublicIPPrefixesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PublicIPPrefix) @@ -8733,6 +9120,8 @@ type PublicIPPrefixesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PublicIPPrefixesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PublicIPPrefixesDeleteResponse, error) { respType := PublicIPPrefixesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -8837,6 +9226,8 @@ type RouteFilterRulesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RouteFilterRulesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RouteFilterRulesCreateOrUpdateResponse, error) { respType := RouteFilterRulesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RouteFilterRule) @@ -8887,6 +9278,8 @@ type RouteFilterRulesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RouteFilterRulesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RouteFilterRulesDeleteResponse, error) { respType := RouteFilterRulesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -8955,6 +9348,8 @@ type RouteFiltersCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RouteFiltersCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RouteFiltersCreateOrUpdateResponse, error) { respType := RouteFiltersCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RouteFilter) @@ -9005,6 +9400,8 @@ type RouteFiltersDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RouteFiltersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RouteFiltersDeleteResponse, error) { respType := RouteFiltersDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -9097,6 +9494,8 @@ type RouteTablesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RouteTablesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RouteTablesCreateOrUpdateResponse, error) { respType := RouteTablesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RouteTable) @@ -9147,6 +9546,8 @@ type RouteTablesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RouteTablesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RouteTablesDeleteResponse, error) { respType := RouteTablesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -9239,6 +9640,8 @@ type RoutesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RoutesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RoutesCreateOrUpdateResponse, error) { respType := RoutesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Route) @@ -9289,6 +9692,8 @@ type RoutesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RoutesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RoutesDeleteResponse, error) { respType := RoutesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -9347,6 +9752,128 @@ type RoutesListResult struct { RouteListResult } +// RoutingIntentCreateOrUpdatePollerResponse contains the response from method RoutingIntent.CreateOrUpdate. +type RoutingIntentCreateOrUpdatePollerResponse struct { + // Poller contains an initialized poller. + Poller *RoutingIntentCreateOrUpdatePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l RoutingIntentCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RoutingIntentCreateOrUpdateResponse, error) { + respType := RoutingIntentCreateOrUpdateResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RoutingIntent) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a RoutingIntentCreateOrUpdatePollerResponse from the provided client and resume token. +func (l *RoutingIntentCreateOrUpdatePollerResponse) Resume(ctx context.Context, client *RoutingIntentClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("RoutingIntentClient.CreateOrUpdate", token, client.pl, client.createOrUpdateHandleError) + if err != nil { + return err + } + poller := &RoutingIntentCreateOrUpdatePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// RoutingIntentCreateOrUpdateResponse contains the response from method RoutingIntent.CreateOrUpdate. +type RoutingIntentCreateOrUpdateResponse struct { + RoutingIntentCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RoutingIntentCreateOrUpdateResult contains the result from method RoutingIntent.CreateOrUpdate. +type RoutingIntentCreateOrUpdateResult struct { + RoutingIntent +} + +// RoutingIntentDeletePollerResponse contains the response from method RoutingIntent.Delete. +type RoutingIntentDeletePollerResponse struct { + // Poller contains an initialized poller. + Poller *RoutingIntentDeletePoller + + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. +func (l RoutingIntentDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RoutingIntentDeleteResponse, error) { + respType := RoutingIntentDeleteResponse{} + resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) + if err != nil { + return respType, err + } + respType.RawResponse = resp + return respType, nil +} + +// Resume rehydrates a RoutingIntentDeletePollerResponse from the provided client and resume token. +func (l *RoutingIntentDeletePollerResponse) Resume(ctx context.Context, client *RoutingIntentClient, token string) error { + pt, err := armruntime.NewPollerFromResumeToken("RoutingIntentClient.Delete", token, client.pl, client.deleteHandleError) + if err != nil { + return err + } + poller := &RoutingIntentDeletePoller{ + pt: pt, + } + resp, err := poller.Poll(ctx) + if err != nil { + return err + } + l.Poller = poller + l.RawResponse = resp + return nil +} + +// RoutingIntentDeleteResponse contains the response from method RoutingIntent.Delete. +type RoutingIntentDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RoutingIntentGetResponse contains the response from method RoutingIntent.Get. +type RoutingIntentGetResponse struct { + RoutingIntentGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RoutingIntentGetResult contains the result from method RoutingIntent.Get. +type RoutingIntentGetResult struct { + RoutingIntent +} + +// RoutingIntentListResponse contains the response from method RoutingIntent.List. +type RoutingIntentListResponse struct { + RoutingIntentListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// RoutingIntentListResult contains the result from method RoutingIntent.List. +type RoutingIntentListResult struct { + ListRoutingIntentResult +} + // SecurityPartnerProvidersCreateOrUpdatePollerResponse contains the response from method SecurityPartnerProviders.CreateOrUpdate. type SecurityPartnerProvidersCreateOrUpdatePollerResponse struct { // Poller contains an initialized poller. @@ -9357,6 +9884,8 @@ type SecurityPartnerProvidersCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SecurityPartnerProvidersCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SecurityPartnerProvidersCreateOrUpdateResponse, error) { respType := SecurityPartnerProvidersCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SecurityPartnerProvider) @@ -9407,6 +9936,8 @@ type SecurityPartnerProvidersDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SecurityPartnerProvidersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SecurityPartnerProvidersDeleteResponse, error) { respType := SecurityPartnerProvidersDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -9499,6 +10030,8 @@ type SecurityRulesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SecurityRulesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SecurityRulesCreateOrUpdateResponse, error) { respType := SecurityRulesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SecurityRule) @@ -9549,6 +10082,8 @@ type SecurityRulesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SecurityRulesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SecurityRulesDeleteResponse, error) { respType := SecurityRulesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -9629,6 +10164,8 @@ type ServiceEndpointPoliciesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServiceEndpointPoliciesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServiceEndpointPoliciesCreateOrUpdateResponse, error) { respType := ServiceEndpointPoliciesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServiceEndpointPolicy) @@ -9679,6 +10216,8 @@ type ServiceEndpointPoliciesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServiceEndpointPoliciesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServiceEndpointPoliciesDeleteResponse, error) { respType := ServiceEndpointPoliciesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -9771,6 +10310,8 @@ type ServiceEndpointPolicyDefinitionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServiceEndpointPolicyDefinitionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServiceEndpointPolicyDefinitionsCreateOrUpdateResponse, error) { respType := ServiceEndpointPolicyDefinitionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServiceEndpointPolicyDefinition) @@ -9821,6 +10362,8 @@ type ServiceEndpointPolicyDefinitionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServiceEndpointPolicyDefinitionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServiceEndpointPolicyDefinitionsDeleteResponse, error) { respType := ServiceEndpointPolicyDefinitionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -9913,6 +10456,8 @@ type SubnetsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SubnetsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SubnetsCreateOrUpdateResponse, error) { respType := SubnetsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Subnet) @@ -9963,6 +10508,8 @@ type SubnetsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SubnetsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SubnetsDeleteResponse, error) { respType := SubnetsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -10031,6 +10578,8 @@ type SubnetsPrepareNetworkPoliciesPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SubnetsPrepareNetworkPoliciesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SubnetsPrepareNetworkPoliciesResponse, error) { respType := SubnetsPrepareNetworkPoliciesResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -10075,6 +10624,8 @@ type SubnetsUnprepareNetworkPoliciesPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SubnetsUnprepareNetworkPoliciesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SubnetsUnprepareNetworkPoliciesResponse, error) { respType := SubnetsUnprepareNetworkPoliciesResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -10131,6 +10682,8 @@ type VPNConnectionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VPNConnectionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VPNConnectionsCreateOrUpdateResponse, error) { respType := VPNConnectionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VPNConnection) @@ -10181,6 +10734,8 @@ type VPNConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VPNConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VPNConnectionsDeleteResponse, error) { respType := VPNConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -10249,6 +10804,8 @@ type VPNConnectionsStartPacketCapturePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VPNConnectionsStartPacketCapturePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VPNConnectionsStartPacketCaptureResponse, error) { respType := VPNConnectionsStartPacketCaptureResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Value) @@ -10299,6 +10856,8 @@ type VPNConnectionsStopPacketCapturePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VPNConnectionsStopPacketCapturePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VPNConnectionsStopPacketCaptureResponse, error) { respType := VPNConnectionsStopPacketCaptureResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Value) @@ -10349,6 +10908,8 @@ type VPNGatewaysCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VPNGatewaysCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VPNGatewaysCreateOrUpdateResponse, error) { respType := VPNGatewaysCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VPNGateway) @@ -10399,6 +10960,8 @@ type VPNGatewaysDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VPNGatewaysDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VPNGatewaysDeleteResponse, error) { respType := VPNGatewaysDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -10479,6 +11042,8 @@ type VPNGatewaysResetPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VPNGatewaysResetPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VPNGatewaysResetResponse, error) { respType := VPNGatewaysResetResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VPNGateway) @@ -10529,6 +11094,8 @@ type VPNGatewaysStartPacketCapturePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VPNGatewaysStartPacketCapturePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VPNGatewaysStartPacketCaptureResponse, error) { respType := VPNGatewaysStartPacketCaptureResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Value) @@ -10579,6 +11146,8 @@ type VPNGatewaysStopPacketCapturePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VPNGatewaysStopPacketCapturePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VPNGatewaysStopPacketCaptureResponse, error) { respType := VPNGatewaysStopPacketCaptureResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Value) @@ -10629,6 +11198,8 @@ type VPNGatewaysUpdateTagsPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VPNGatewaysUpdateTagsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VPNGatewaysUpdateTagsResponse, error) { respType := VPNGatewaysUpdateTagsResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VPNGateway) @@ -10679,6 +11250,8 @@ type VPNLinkConnectionsGetIkeSasPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VPNLinkConnectionsGetIkeSasPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VPNLinkConnectionsGetIkeSasResponse, error) { respType := VPNLinkConnectionsGetIkeSasResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Value) @@ -10741,6 +11314,8 @@ type VPNLinkConnectionsResetConnectionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VPNLinkConnectionsResetConnectionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VPNLinkConnectionsResetConnectionResponse, error) { respType := VPNLinkConnectionsResetConnectionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -10785,6 +11360,8 @@ type VPNServerConfigurationsAssociatedWithVirtualWanListPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VPNServerConfigurationsAssociatedWithVirtualWanListPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VPNServerConfigurationsAssociatedWithVirtualWanListResponse, error) { respType := VPNServerConfigurationsAssociatedWithVirtualWanListResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VPNServerConfigurationsResponse) @@ -10835,6 +11412,8 @@ type VPNServerConfigurationsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VPNServerConfigurationsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VPNServerConfigurationsCreateOrUpdateResponse, error) { respType := VPNServerConfigurationsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VPNServerConfiguration) @@ -10885,6 +11464,8 @@ type VPNServerConfigurationsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VPNServerConfigurationsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VPNServerConfigurationsDeleteResponse, error) { respType := VPNServerConfigurationsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -11013,6 +11594,8 @@ type VPNSitesConfigurationDownloadPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VPNSitesConfigurationDownloadPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VPNSitesConfigurationDownloadResponse, error) { respType := VPNSitesConfigurationDownloadResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -11057,6 +11640,8 @@ type VPNSitesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VPNSitesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VPNSitesCreateOrUpdateResponse, error) { respType := VPNSitesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VPNSite) @@ -11107,6 +11692,8 @@ type VPNSitesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VPNSitesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VPNSitesDeleteResponse, error) { respType := VPNSitesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -11223,6 +11810,8 @@ type VirtualApplianceSitesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualApplianceSitesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualApplianceSitesCreateOrUpdateResponse, error) { respType := VirtualApplianceSitesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualApplianceSite) @@ -11273,6 +11862,8 @@ type VirtualApplianceSitesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualApplianceSitesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualApplianceSitesDeleteResponse, error) { respType := VirtualApplianceSitesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -11341,6 +11932,8 @@ type VirtualHubBgpConnectionCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualHubBgpConnectionCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualHubBgpConnectionCreateOrUpdateResponse, error) { respType := VirtualHubBgpConnectionCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.BgpConnection) @@ -11391,6 +11984,8 @@ type VirtualHubBgpConnectionDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualHubBgpConnectionDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualHubBgpConnectionDeleteResponse, error) { respType := VirtualHubBgpConnectionDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -11447,6 +12042,8 @@ type VirtualHubBgpConnectionsListAdvertisedRoutesPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualHubBgpConnectionsListAdvertisedRoutesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualHubBgpConnectionsListAdvertisedRoutesResponse, error) { respType := VirtualHubBgpConnectionsListAdvertisedRoutesResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PeerRouteList) @@ -11497,6 +12094,8 @@ type VirtualHubBgpConnectionsListLearnedRoutesPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualHubBgpConnectionsListLearnedRoutesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualHubBgpConnectionsListLearnedRoutesResponse, error) { respType := VirtualHubBgpConnectionsListLearnedRoutesResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PeerRouteList) @@ -11559,6 +12158,8 @@ type VirtualHubIPConfigurationCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualHubIPConfigurationCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualHubIPConfigurationCreateOrUpdateResponse, error) { respType := VirtualHubIPConfigurationCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.HubIPConfiguration) @@ -11609,6 +12210,8 @@ type VirtualHubIPConfigurationDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualHubIPConfigurationDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualHubIPConfigurationDeleteResponse, error) { respType := VirtualHubIPConfigurationDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -11677,6 +12280,8 @@ type VirtualHubRouteTableV2SCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualHubRouteTableV2SCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualHubRouteTableV2SCreateOrUpdateResponse, error) { respType := VirtualHubRouteTableV2SCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualHubRouteTableV2) @@ -11727,6 +12332,8 @@ type VirtualHubRouteTableV2SDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualHubRouteTableV2SDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualHubRouteTableV2SDeleteResponse, error) { respType := VirtualHubRouteTableV2SDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -11795,6 +12402,8 @@ type VirtualHubsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualHubsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualHubsCreateOrUpdateResponse, error) { respType := VirtualHubsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualHub) @@ -11845,6 +12454,8 @@ type VirtualHubsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualHubsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualHubsDeleteResponse, error) { respType := VirtualHubsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -11889,6 +12500,8 @@ type VirtualHubsGetEffectiveVirtualHubRoutesPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualHubsGetEffectiveVirtualHubRoutesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualHubsGetEffectiveVirtualHubRoutesResponse, error) { respType := VirtualHubsGetEffectiveVirtualHubRoutesResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -11981,6 +12594,8 @@ type VirtualNetworkGatewayConnectionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewayConnectionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewayConnectionsCreateOrUpdateResponse, error) { respType := VirtualNetworkGatewayConnectionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualNetworkGatewayConnection) @@ -12031,6 +12646,8 @@ type VirtualNetworkGatewayConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewayConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewayConnectionsDeleteResponse, error) { respType := VirtualNetworkGatewayConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -12075,6 +12692,8 @@ type VirtualNetworkGatewayConnectionsGetIkeSasPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewayConnectionsGetIkeSasPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewayConnectionsGetIkeSasResponse, error) { respType := VirtualNetworkGatewayConnectionsGetIkeSasResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Value) @@ -12161,6 +12780,8 @@ type VirtualNetworkGatewayConnectionsResetConnectionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewayConnectionsResetConnectionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewayConnectionsResetConnectionResponse, error) { respType := VirtualNetworkGatewayConnectionsResetConnectionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -12205,6 +12826,8 @@ type VirtualNetworkGatewayConnectionsResetSharedKeyPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewayConnectionsResetSharedKeyPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewayConnectionsResetSharedKeyResponse, error) { respType := VirtualNetworkGatewayConnectionsResetSharedKeyResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ConnectionResetSharedKey) @@ -12255,6 +12878,8 @@ type VirtualNetworkGatewayConnectionsSetSharedKeyPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewayConnectionsSetSharedKeyPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewayConnectionsSetSharedKeyResponse, error) { respType := VirtualNetworkGatewayConnectionsSetSharedKeyResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ConnectionSharedKey) @@ -12305,6 +12930,8 @@ type VirtualNetworkGatewayConnectionsStartPacketCapturePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewayConnectionsStartPacketCapturePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewayConnectionsStartPacketCaptureResponse, error) { respType := VirtualNetworkGatewayConnectionsStartPacketCaptureResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Value) @@ -12355,6 +12982,8 @@ type VirtualNetworkGatewayConnectionsStopPacketCapturePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewayConnectionsStopPacketCapturePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewayConnectionsStopPacketCaptureResponse, error) { respType := VirtualNetworkGatewayConnectionsStopPacketCaptureResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Value) @@ -12405,6 +13034,8 @@ type VirtualNetworkGatewayConnectionsUpdateTagsPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewayConnectionsUpdateTagsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewayConnectionsUpdateTagsResponse, error) { respType := VirtualNetworkGatewayConnectionsUpdateTagsResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualNetworkGatewayConnection) @@ -12455,6 +13086,8 @@ type VirtualNetworkGatewayNatRulesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewayNatRulesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewayNatRulesCreateOrUpdateResponse, error) { respType := VirtualNetworkGatewayNatRulesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualNetworkGatewayNatRule) @@ -12505,6 +13138,8 @@ type VirtualNetworkGatewayNatRulesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewayNatRulesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewayNatRulesDeleteResponse, error) { respType := VirtualNetworkGatewayNatRulesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -12573,6 +13208,8 @@ type VirtualNetworkGatewaysCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewaysCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewaysCreateOrUpdateResponse, error) { respType := VirtualNetworkGatewaysCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualNetworkGateway) @@ -12623,6 +13260,8 @@ type VirtualNetworkGatewaysDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewaysDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewaysDeleteResponse, error) { respType := VirtualNetworkGatewaysDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -12667,6 +13306,8 @@ type VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVPNConnectionsPollerRe } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVPNConnectionsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVPNConnectionsResponse, error) { respType := VirtualNetworkGatewaysDisconnectVirtualNetworkGatewayVPNConnectionsResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -12711,6 +13352,8 @@ type VirtualNetworkGatewaysGenerateVPNProfilePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewaysGenerateVPNProfilePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewaysGenerateVPNProfileResponse, error) { respType := VirtualNetworkGatewaysGenerateVPNProfileResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Value) @@ -12761,6 +13404,8 @@ type VirtualNetworkGatewaysGeneratevpnclientpackagePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewaysGeneratevpnclientpackagePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewaysGeneratevpnclientpackageResponse, error) { respType := VirtualNetworkGatewaysGeneratevpnclientpackageResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Value) @@ -12811,6 +13456,8 @@ type VirtualNetworkGatewaysGetAdvertisedRoutesPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewaysGetAdvertisedRoutesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewaysGetAdvertisedRoutesResponse, error) { respType := VirtualNetworkGatewaysGetAdvertisedRoutesResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GatewayRouteListResult) @@ -12861,6 +13508,8 @@ type VirtualNetworkGatewaysGetBgpPeerStatusPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewaysGetBgpPeerStatusPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewaysGetBgpPeerStatusResponse, error) { respType := VirtualNetworkGatewaysGetBgpPeerStatusResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.BgpPeerStatusListResult) @@ -12911,6 +13560,8 @@ type VirtualNetworkGatewaysGetLearnedRoutesPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewaysGetLearnedRoutesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewaysGetLearnedRoutesResponse, error) { respType := VirtualNetworkGatewaysGetLearnedRoutesResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GatewayRouteListResult) @@ -12973,6 +13624,8 @@ type VirtualNetworkGatewaysGetVPNProfilePackageURLPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewaysGetVPNProfilePackageURLPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewaysGetVPNProfilePackageURLResponse, error) { respType := VirtualNetworkGatewaysGetVPNProfilePackageURLResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Value) @@ -13023,6 +13676,8 @@ type VirtualNetworkGatewaysGetVpnclientConnectionHealthPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewaysGetVpnclientConnectionHealthPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewaysGetVpnclientConnectionHealthResponse, error) { respType := VirtualNetworkGatewaysGetVpnclientConnectionHealthResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VPNClientConnectionHealthDetailListResult) @@ -13073,6 +13728,8 @@ type VirtualNetworkGatewaysGetVpnclientIPSecParametersPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewaysGetVpnclientIPSecParametersPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewaysGetVpnclientIPSecParametersResponse, error) { respType := VirtualNetworkGatewaysGetVpnclientIPSecParametersResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VPNClientIPsecParameters) @@ -13147,6 +13804,8 @@ type VirtualNetworkGatewaysResetPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewaysResetPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewaysResetResponse, error) { respType := VirtualNetworkGatewaysResetResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualNetworkGateway) @@ -13197,6 +13856,8 @@ type VirtualNetworkGatewaysResetVPNClientSharedKeyPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewaysResetVPNClientSharedKeyPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewaysResetVPNClientSharedKeyResponse, error) { respType := VirtualNetworkGatewaysResetVPNClientSharedKeyResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -13241,6 +13902,8 @@ type VirtualNetworkGatewaysSetVpnclientIPSecParametersPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewaysSetVpnclientIPSecParametersPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewaysSetVpnclientIPSecParametersResponse, error) { respType := VirtualNetworkGatewaysSetVpnclientIPSecParametersResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VPNClientIPsecParameters) @@ -13291,6 +13954,8 @@ type VirtualNetworkGatewaysStartPacketCapturePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewaysStartPacketCapturePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewaysStartPacketCaptureResponse, error) { respType := VirtualNetworkGatewaysStartPacketCaptureResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Value) @@ -13341,6 +14006,8 @@ type VirtualNetworkGatewaysStopPacketCapturePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewaysStopPacketCapturePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewaysStopPacketCaptureResponse, error) { respType := VirtualNetworkGatewaysStopPacketCaptureResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Value) @@ -13403,6 +14070,8 @@ type VirtualNetworkGatewaysUpdateTagsPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkGatewaysUpdateTagsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkGatewaysUpdateTagsResponse, error) { respType := VirtualNetworkGatewaysUpdateTagsResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualNetworkGateway) @@ -13465,6 +14134,8 @@ type VirtualNetworkPeeringsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkPeeringsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkPeeringsCreateOrUpdateResponse, error) { respType := VirtualNetworkPeeringsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualNetworkPeering) @@ -13515,6 +14186,8 @@ type VirtualNetworkPeeringsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkPeeringsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkPeeringsDeleteResponse, error) { respType := VirtualNetworkPeeringsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -13583,6 +14256,8 @@ type VirtualNetworkTapsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkTapsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkTapsCreateOrUpdateResponse, error) { respType := VirtualNetworkTapsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualNetworkTap) @@ -13633,6 +14308,8 @@ type VirtualNetworkTapsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkTapsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkTapsDeleteResponse, error) { respType := VirtualNetworkTapsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -13737,6 +14414,8 @@ type VirtualNetworksCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworksCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworksCreateOrUpdateResponse, error) { respType := VirtualNetworksCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualNetwork) @@ -13787,6 +14466,8 @@ type VirtualNetworksDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworksDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworksDeleteResponse, error) { respType := VirtualNetworksDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -13891,6 +14572,8 @@ type VirtualRouterPeeringsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualRouterPeeringsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualRouterPeeringsCreateOrUpdateResponse, error) { respType := VirtualRouterPeeringsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualRouterPeering) @@ -13941,6 +14624,8 @@ type VirtualRouterPeeringsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualRouterPeeringsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualRouterPeeringsDeleteResponse, error) { respType := VirtualRouterPeeringsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -14009,6 +14694,8 @@ type VirtualRoutersCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualRoutersCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualRoutersCreateOrUpdateResponse, error) { respType := VirtualRoutersCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualRouter) @@ -14059,6 +14746,8 @@ type VirtualRoutersDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualRoutersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualRoutersDeleteResponse, error) { respType := VirtualRoutersDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -14139,6 +14828,8 @@ type VirtualWansCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualWansCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualWansCreateOrUpdateResponse, error) { respType := VirtualWansCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualWAN) @@ -14189,6 +14880,8 @@ type VirtualWansDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualWansDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualWansDeleteResponse, error) { respType := VirtualWansDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -14293,6 +14986,8 @@ type WebApplicationFirewallPoliciesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebApplicationFirewallPoliciesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebApplicationFirewallPoliciesDeleteResponse, error) { respType := WebApplicationFirewallPoliciesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_routefilterrules_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_routefilterrules_client.go index b0d496304ba1..a2885d05ff8c 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_routefilterrules_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_routefilterrules_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RouteFilterRulesClient contains the methods for the RouteFilterRules group. @@ -31,8 +31,15 @@ type RouteFilterRulesClient struct { } // NewRouteFilterRulesClient creates a new instance of RouteFilterRulesClient with the specified values. -func NewRouteFilterRulesClient(con *arm.Connection, subscriptionID string) *RouteFilterRulesClient { - return &RouteFilterRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRouteFilterRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RouteFilterRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RouteFilterRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a route in the specified route filter. @@ -96,7 +103,7 @@ func (client *RouteFilterRulesClient) createOrUpdateCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, routeFilterRuleParameters) @@ -176,7 +183,7 @@ func (client *RouteFilterRulesClient) deleteCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *RouteFilterRulesClient) getCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *RouteFilterRulesClient) getCreateRequest(ctx context.Context, reso func (client *RouteFilterRulesClient) getHandleResponse(resp *http.Response) (RouteFilterRulesGetResponse, error) { result := RouteFilterRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RouteFilterRule); err != nil { - return RouteFilterRulesGetResponse{}, err + return RouteFilterRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *RouteFilterRulesClient) listByRouteFilterCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *RouteFilterRulesClient) listByRouteFilterCreateRequest(ctx context func (client *RouteFilterRulesClient) listByRouteFilterHandleResponse(resp *http.Response) (RouteFilterRulesListByRouteFilterResponse, error) { result := RouteFilterRulesListByRouteFilterResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RouteFilterRuleListResult); err != nil { - return RouteFilterRulesListByRouteFilterResponse{}, err + return RouteFilterRulesListByRouteFilterResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_routefilters_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_routefilters_client.go index ff8a628555ec..ecd74d92301c 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_routefilters_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_routefilters_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RouteFiltersClient contains the methods for the RouteFilters group. @@ -31,8 +31,15 @@ type RouteFiltersClient struct { } // NewRouteFiltersClient creates a new instance of RouteFiltersClient with the specified values. -func NewRouteFiltersClient(con *arm.Connection, subscriptionID string) *RouteFiltersClient { - return &RouteFiltersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRouteFiltersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RouteFiltersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RouteFiltersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a route filter in a specified resource group. @@ -92,7 +99,7 @@ func (client *RouteFiltersClient) createOrUpdateCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, routeFilterParameters) @@ -168,7 +175,7 @@ func (client *RouteFiltersClient) deleteCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *RouteFiltersClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -237,7 +244,7 @@ func (client *RouteFiltersClient) getCreateRequest(ctx context.Context, resource func (client *RouteFiltersClient) getHandleResponse(resp *http.Response) (RouteFiltersGetResponse, error) { result := RouteFiltersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RouteFilter); err != nil { - return RouteFiltersGetResponse{}, err + return RouteFiltersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -281,7 +288,7 @@ func (client *RouteFiltersClient) listCreateRequest(ctx context.Context, options return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -291,7 +298,7 @@ func (client *RouteFiltersClient) listCreateRequest(ctx context.Context, options func (client *RouteFiltersClient) listHandleResponse(resp *http.Response) (RouteFiltersListResponse, error) { result := RouteFiltersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RouteFilterListResult); err != nil { - return RouteFiltersListResponse{}, err + return RouteFiltersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -339,7 +346,7 @@ func (client *RouteFiltersClient) listByResourceGroupCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -349,7 +356,7 @@ func (client *RouteFiltersClient) listByResourceGroupCreateRequest(ctx context.C func (client *RouteFiltersClient) listByResourceGroupHandleResponse(resp *http.Response) (RouteFiltersListByResourceGroupResponse, error) { result := RouteFiltersListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RouteFilterListResult); err != nil { - return RouteFiltersListByResourceGroupResponse{}, err + return RouteFiltersListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -404,7 +411,7 @@ func (client *RouteFiltersClient) updateTagsCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -414,7 +421,7 @@ func (client *RouteFiltersClient) updateTagsCreateRequest(ctx context.Context, r func (client *RouteFiltersClient) updateTagsHandleResponse(resp *http.Response) (RouteFiltersUpdateTagsResponse, error) { result := RouteFiltersUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RouteFilter); err != nil { - return RouteFiltersUpdateTagsResponse{}, err + return RouteFiltersUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_routes_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_routes_client.go index 8838856cf53a..6bdc184a0215 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_routes_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_routes_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RoutesClient contains the methods for the Routes group. @@ -31,8 +31,15 @@ type RoutesClient struct { } // NewRoutesClient creates a new instance of RoutesClient with the specified values. -func NewRoutesClient(con *arm.Connection, subscriptionID string) *RoutesClient { - return &RoutesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRoutesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RoutesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RoutesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a route in the specified route table. @@ -96,7 +103,7 @@ func (client *RoutesClient) createOrUpdateCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, routeParameters) @@ -176,7 +183,7 @@ func (client *RoutesClient) deleteCreateRequest(ctx context.Context, resourceGro return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *RoutesClient) getCreateRequest(ctx context.Context, resourceGroupN return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *RoutesClient) getCreateRequest(ctx context.Context, resourceGroupN func (client *RoutesClient) getHandleResponse(resp *http.Response) (RoutesGetResponse, error) { result := RoutesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Route); err != nil { - return RoutesGetResponse{}, err + return RoutesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *RoutesClient) listCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *RoutesClient) listCreateRequest(ctx context.Context, resourceGroup func (client *RoutesClient) listHandleResponse(resp *http.Response) (RoutesListResponse, error) { result := RoutesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RouteListResult); err != nil { - return RoutesListResponse{}, err + return RoutesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_routetables_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_routetables_client.go index 40699ccb6c7d..578774928fb8 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_routetables_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_routetables_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RouteTablesClient contains the methods for the RouteTables group. @@ -31,8 +31,15 @@ type RouteTablesClient struct { } // NewRouteTablesClient creates a new instance of RouteTablesClient with the specified values. -func NewRouteTablesClient(con *arm.Connection, subscriptionID string) *RouteTablesClient { - return &RouteTablesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRouteTablesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RouteTablesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RouteTablesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or updates a route table in a specified resource group. @@ -92,7 +99,7 @@ func (client *RouteTablesClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *RouteTablesClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *RouteTablesClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -237,7 +244,7 @@ func (client *RouteTablesClient) getCreateRequest(ctx context.Context, resourceG func (client *RouteTablesClient) getHandleResponse(resp *http.Response) (RouteTablesGetResponse, error) { result := RouteTablesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RouteTable); err != nil { - return RouteTablesGetResponse{}, err + return RouteTablesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -285,7 +292,7 @@ func (client *RouteTablesClient) listCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -295,7 +302,7 @@ func (client *RouteTablesClient) listCreateRequest(ctx context.Context, resource func (client *RouteTablesClient) listHandleResponse(resp *http.Response) (RouteTablesListResponse, error) { result := RouteTablesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RouteTableListResult); err != nil { - return RouteTablesListResponse{}, err + return RouteTablesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -339,7 +346,7 @@ func (client *RouteTablesClient) listAllCreateRequest(ctx context.Context, optio return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -349,7 +356,7 @@ func (client *RouteTablesClient) listAllCreateRequest(ctx context.Context, optio func (client *RouteTablesClient) listAllHandleResponse(resp *http.Response) (RouteTablesListAllResponse, error) { result := RouteTablesListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RouteTableListResult); err != nil { - return RouteTablesListAllResponse{}, err + return RouteTablesListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -404,7 +411,7 @@ func (client *RouteTablesClient) updateTagsCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -414,7 +421,7 @@ func (client *RouteTablesClient) updateTagsCreateRequest(ctx context.Context, re func (client *RouteTablesClient) updateTagsHandleResponse(resp *http.Response) (RouteTablesUpdateTagsResponse, error) { result := RouteTablesUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RouteTable); err != nil { - return RouteTablesUpdateTagsResponse{}, err + return RouteTablesUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_routingintent_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_routingintent_client.go new file mode 100644 index 000000000000..39e52cac3d0e --- /dev/null +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_routingintent_client.go @@ -0,0 +1,334 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armnetwork + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// RoutingIntentClient contains the methods for the RoutingIntent group. +// Don't use this type directly, use NewRoutingIntentClient() instead. +type RoutingIntentClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewRoutingIntentClient creates a new instance of RoutingIntentClient with the specified values. +func NewRoutingIntentClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RoutingIntentClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RoutingIntentClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// BeginCreateOrUpdate - Creates a RoutingIntent resource if it doesn't exist else updates the existing RoutingIntent. +// If the operation fails it returns the *CloudError error type. +func (client *RoutingIntentClient) BeginCreateOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, routingIntentParameters RoutingIntent, options *RoutingIntentBeginCreateOrUpdateOptions) (RoutingIntentCreateOrUpdatePollerResponse, error) { + resp, err := client.createOrUpdate(ctx, resourceGroupName, virtualHubName, routingIntentName, routingIntentParameters, options) + if err != nil { + return RoutingIntentCreateOrUpdatePollerResponse{}, err + } + result := RoutingIntentCreateOrUpdatePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("RoutingIntentClient.CreateOrUpdate", "azure-async-operation", resp, client.pl, client.createOrUpdateHandleError) + if err != nil { + return RoutingIntentCreateOrUpdatePollerResponse{}, err + } + result.Poller = &RoutingIntentCreateOrUpdatePoller{ + pt: pt, + } + return result, nil +} + +// CreateOrUpdate - Creates a RoutingIntent resource if it doesn't exist else updates the existing RoutingIntent. +// If the operation fails it returns the *CloudError error type. +func (client *RoutingIntentClient) createOrUpdate(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, routingIntentParameters RoutingIntent, options *RoutingIntentBeginCreateOrUpdateOptions) (*http.Response, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, virtualHubName, routingIntentName, routingIntentParameters, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return nil, client.createOrUpdateHandleError(resp) + } + return resp, nil +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *RoutingIntentClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, routingIntentParameters RoutingIntent, options *RoutingIntentBeginCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if routingIntentName == "" { + return nil, errors.New("parameter routingIntentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routingIntentName}", url.PathEscape(routingIntentName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, routingIntentParameters) +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *RoutingIntentClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// BeginDelete - Deletes a RoutingIntent. +// If the operation fails it returns the *CloudError error type. +func (client *RoutingIntentClient) BeginDelete(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, options *RoutingIntentBeginDeleteOptions) (RoutingIntentDeletePollerResponse, error) { + resp, err := client.deleteOperation(ctx, resourceGroupName, virtualHubName, routingIntentName, options) + if err != nil { + return RoutingIntentDeletePollerResponse{}, err + } + result := RoutingIntentDeletePollerResponse{ + RawResponse: resp, + } + pt, err := armruntime.NewPoller("RoutingIntentClient.Delete", "location", resp, client.pl, client.deleteHandleError) + if err != nil { + return RoutingIntentDeletePollerResponse{}, err + } + result.Poller = &RoutingIntentDeletePoller{ + pt: pt, + } + return result, nil +} + +// Delete - Deletes a RoutingIntent. +// If the operation fails it returns the *CloudError error type. +func (client *RoutingIntentClient) deleteOperation(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, options *RoutingIntentBeginDeleteOptions) (*http.Response, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, virtualHubName, routingIntentName, options) + if err != nil { + return nil, err + } + resp, err := client.pl.Do(req) + if err != nil { + return nil, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusAccepted, http.StatusNoContent) { + return nil, client.deleteHandleError(resp) + } + return resp, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *RoutingIntentClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, options *RoutingIntentBeginDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if routingIntentName == "" { + return nil, errors.New("parameter routingIntentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routingIntentName}", url.PathEscape(routingIntentName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *RoutingIntentClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Retrieves the details of a RoutingIntent. +// If the operation fails it returns the *CloudError error type. +func (client *RoutingIntentClient) Get(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, options *RoutingIntentGetOptions) (RoutingIntentGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, virtualHubName, routingIntentName, options) + if err != nil { + return RoutingIntentGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return RoutingIntentGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return RoutingIntentGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *RoutingIntentClient) getCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, routingIntentName string, options *RoutingIntentGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent/{routingIntentName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + if routingIntentName == "" { + return nil, errors.New("parameter routingIntentName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{routingIntentName}", url.PathEscape(routingIntentName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *RoutingIntentClient) getHandleResponse(resp *http.Response) (RoutingIntentGetResponse, error) { + result := RoutingIntentGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.RoutingIntent); err != nil { + return RoutingIntentGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *RoutingIntentClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Retrieves the details of all RoutingIntent child resources of the VirtualHub. +// If the operation fails it returns the *CloudError error type. +func (client *RoutingIntentClient) List(resourceGroupName string, virtualHubName string, options *RoutingIntentListOptions) *RoutingIntentListPager { + return &RoutingIntentListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, resourceGroupName, virtualHubName, options) + }, + advancer: func(ctx context.Context, resp RoutingIntentListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.ListRoutingIntentResult.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *RoutingIntentClient) listCreateRequest(ctx context.Context, resourceGroupName string, virtualHubName string, options *RoutingIntentListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Network/virtualHubs/{virtualHubName}/routingIntent" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if virtualHubName == "" { + return nil, errors.New("parameter virtualHubName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{virtualHubName}", url.PathEscape(virtualHubName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-05-01") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *RoutingIntentClient) listHandleResponse(resp *http.Response) (RoutingIntentListResponse, error) { + result := RoutingIntentListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.ListRoutingIntentResult); err != nil { + return RoutingIntentListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *RoutingIntentClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_securitypartnerproviders_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_securitypartnerproviders_client.go index c1a8bfb42f7a..38a9955e791b 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_securitypartnerproviders_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_securitypartnerproviders_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SecurityPartnerProvidersClient contains the methods for the SecurityPartnerProviders group. @@ -31,8 +31,15 @@ type SecurityPartnerProvidersClient struct { } // NewSecurityPartnerProvidersClient creates a new instance of SecurityPartnerProvidersClient with the specified values. -func NewSecurityPartnerProvidersClient(con *arm.Connection, subscriptionID string) *SecurityPartnerProvidersClient { - return &SecurityPartnerProvidersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSecurityPartnerProvidersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SecurityPartnerProvidersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SecurityPartnerProvidersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates the specified Security Partner Provider. @@ -92,7 +99,7 @@ func (client *SecurityPartnerProvidersClient) createOrUpdateCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *SecurityPartnerProvidersClient) deleteCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *SecurityPartnerProvidersClient) getCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +241,7 @@ func (client *SecurityPartnerProvidersClient) getCreateRequest(ctx context.Conte func (client *SecurityPartnerProvidersClient) getHandleResponse(resp *http.Response) (SecurityPartnerProvidersGetResponse, error) { result := SecurityPartnerProvidersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityPartnerProvider); err != nil { - return SecurityPartnerProvidersGetResponse{}, err + return SecurityPartnerProvidersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -278,7 +285,7 @@ func (client *SecurityPartnerProvidersClient) listCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -288,7 +295,7 @@ func (client *SecurityPartnerProvidersClient) listCreateRequest(ctx context.Cont func (client *SecurityPartnerProvidersClient) listHandleResponse(resp *http.Response) (SecurityPartnerProvidersListResponse, error) { result := SecurityPartnerProvidersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityPartnerProviderListResult); err != nil { - return SecurityPartnerProvidersListResponse{}, err + return SecurityPartnerProvidersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -336,7 +343,7 @@ func (client *SecurityPartnerProvidersClient) listByResourceGroupCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -346,7 +353,7 @@ func (client *SecurityPartnerProvidersClient) listByResourceGroupCreateRequest(c func (client *SecurityPartnerProvidersClient) listByResourceGroupHandleResponse(resp *http.Response) (SecurityPartnerProvidersListByResourceGroupResponse, error) { result := SecurityPartnerProvidersListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityPartnerProviderListResult); err != nil { - return SecurityPartnerProvidersListByResourceGroupResponse{}, err + return SecurityPartnerProvidersListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -401,7 +408,7 @@ func (client *SecurityPartnerProvidersClient) updateTagsCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -411,7 +418,7 @@ func (client *SecurityPartnerProvidersClient) updateTagsCreateRequest(ctx contex func (client *SecurityPartnerProvidersClient) updateTagsHandleResponse(resp *http.Response) (SecurityPartnerProvidersUpdateTagsResponse, error) { result := SecurityPartnerProvidersUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityPartnerProvider); err != nil { - return SecurityPartnerProvidersUpdateTagsResponse{}, err + return SecurityPartnerProvidersUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_securityrules_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_securityrules_client.go index bf3cd6de9180..86f28ec4a411 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_securityrules_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_securityrules_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SecurityRulesClient contains the methods for the SecurityRules group. @@ -31,8 +31,15 @@ type SecurityRulesClient struct { } // NewSecurityRulesClient creates a new instance of SecurityRulesClient with the specified values. -func NewSecurityRulesClient(con *arm.Connection, subscriptionID string) *SecurityRulesClient { - return &SecurityRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSecurityRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SecurityRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SecurityRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a security rule in the specified network security group. @@ -96,7 +103,7 @@ func (client *SecurityRulesClient) createOrUpdateCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, securityRuleParameters) @@ -176,7 +183,7 @@ func (client *SecurityRulesClient) deleteCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *SecurityRulesClient) getCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *SecurityRulesClient) getCreateRequest(ctx context.Context, resourc func (client *SecurityRulesClient) getHandleResponse(resp *http.Response) (SecurityRulesGetResponse, error) { result := SecurityRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityRule); err != nil { - return SecurityRulesGetResponse{}, err + return SecurityRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *SecurityRulesClient) listCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *SecurityRulesClient) listCreateRequest(ctx context.Context, resour func (client *SecurityRulesClient) listHandleResponse(resp *http.Response) (SecurityRulesListResponse, error) { result := SecurityRulesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityRuleListResult); err != nil { - return SecurityRulesListResponse{}, err + return SecurityRulesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_serviceassociationlinks_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_serviceassociationlinks_client.go index 6c33333c7534..b28696b2a812 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_serviceassociationlinks_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_serviceassociationlinks_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServiceAssociationLinksClient contains the methods for the ServiceAssociationLinks group. @@ -30,8 +31,15 @@ type ServiceAssociationLinksClient struct { } // NewServiceAssociationLinksClient creates a new instance of ServiceAssociationLinksClient with the specified values. -func NewServiceAssociationLinksClient(con *arm.Connection, subscriptionID string) *ServiceAssociationLinksClient { - return &ServiceAssociationLinksClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServiceAssociationLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServiceAssociationLinksClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServiceAssociationLinksClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets a list of service association links for a subnet. @@ -75,7 +83,7 @@ func (client *ServiceAssociationLinksClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -85,7 +93,7 @@ func (client *ServiceAssociationLinksClient) listCreateRequest(ctx context.Conte func (client *ServiceAssociationLinksClient) listHandleResponse(resp *http.Response) (ServiceAssociationLinksListResponse, error) { result := ServiceAssociationLinksListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServiceAssociationLinksListResult); err != nil { - return ServiceAssociationLinksListResponse{}, err + return ServiceAssociationLinksListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_serviceendpointpolicies_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_serviceendpointpolicies_client.go index 75e22f22ec80..2dbd5c679a5d 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_serviceendpointpolicies_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_serviceendpointpolicies_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServiceEndpointPoliciesClient contains the methods for the ServiceEndpointPolicies group. @@ -31,8 +31,15 @@ type ServiceEndpointPoliciesClient struct { } // NewServiceEndpointPoliciesClient creates a new instance of ServiceEndpointPoliciesClient with the specified values. -func NewServiceEndpointPoliciesClient(con *arm.Connection, subscriptionID string) *ServiceEndpointPoliciesClient { - return &ServiceEndpointPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServiceEndpointPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServiceEndpointPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServiceEndpointPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a service Endpoint Policies. @@ -92,7 +99,7 @@ func (client *ServiceEndpointPoliciesClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *ServiceEndpointPoliciesClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *ServiceEndpointPoliciesClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -237,7 +244,7 @@ func (client *ServiceEndpointPoliciesClient) getCreateRequest(ctx context.Contex func (client *ServiceEndpointPoliciesClient) getHandleResponse(resp *http.Response) (ServiceEndpointPoliciesGetResponse, error) { result := ServiceEndpointPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServiceEndpointPolicy); err != nil { - return ServiceEndpointPoliciesGetResponse{}, err + return ServiceEndpointPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -281,7 +288,7 @@ func (client *ServiceEndpointPoliciesClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -291,7 +298,7 @@ func (client *ServiceEndpointPoliciesClient) listCreateRequest(ctx context.Conte func (client *ServiceEndpointPoliciesClient) listHandleResponse(resp *http.Response) (ServiceEndpointPoliciesListResponse, error) { result := ServiceEndpointPoliciesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServiceEndpointPolicyListResult); err != nil { - return ServiceEndpointPoliciesListResponse{}, err + return ServiceEndpointPoliciesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -339,7 +346,7 @@ func (client *ServiceEndpointPoliciesClient) listByResourceGroupCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -349,7 +356,7 @@ func (client *ServiceEndpointPoliciesClient) listByResourceGroupCreateRequest(ct func (client *ServiceEndpointPoliciesClient) listByResourceGroupHandleResponse(resp *http.Response) (ServiceEndpointPoliciesListByResourceGroupResponse, error) { result := ServiceEndpointPoliciesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServiceEndpointPolicyListResult); err != nil { - return ServiceEndpointPoliciesListByResourceGroupResponse{}, err + return ServiceEndpointPoliciesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -404,7 +411,7 @@ func (client *ServiceEndpointPoliciesClient) updateTagsCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -414,7 +421,7 @@ func (client *ServiceEndpointPoliciesClient) updateTagsCreateRequest(ctx context func (client *ServiceEndpointPoliciesClient) updateTagsHandleResponse(resp *http.Response) (ServiceEndpointPoliciesUpdateTagsResponse, error) { result := ServiceEndpointPoliciesUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServiceEndpointPolicy); err != nil { - return ServiceEndpointPoliciesUpdateTagsResponse{}, err + return ServiceEndpointPoliciesUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_serviceendpointpolicydefinitions_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_serviceendpointpolicydefinitions_client.go index e08e38cf47c7..edb6377f254c 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_serviceendpointpolicydefinitions_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_serviceendpointpolicydefinitions_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServiceEndpointPolicyDefinitionsClient contains the methods for the ServiceEndpointPolicyDefinitions group. @@ -31,8 +31,15 @@ type ServiceEndpointPolicyDefinitionsClient struct { } // NewServiceEndpointPolicyDefinitionsClient creates a new instance of ServiceEndpointPolicyDefinitionsClient with the specified values. -func NewServiceEndpointPolicyDefinitionsClient(con *arm.Connection, subscriptionID string) *ServiceEndpointPolicyDefinitionsClient { - return &ServiceEndpointPolicyDefinitionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServiceEndpointPolicyDefinitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServiceEndpointPolicyDefinitionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServiceEndpointPolicyDefinitionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a service endpoint policy definition in the specified service endpoint policy. @@ -96,7 +103,7 @@ func (client *ServiceEndpointPolicyDefinitionsClient) createOrUpdateCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, serviceEndpointPolicyDefinitions) @@ -176,7 +183,7 @@ func (client *ServiceEndpointPolicyDefinitionsClient) deleteCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *ServiceEndpointPolicyDefinitionsClient) getCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *ServiceEndpointPolicyDefinitionsClient) getCreateRequest(ctx conte func (client *ServiceEndpointPolicyDefinitionsClient) getHandleResponse(resp *http.Response) (ServiceEndpointPolicyDefinitionsGetResponse, error) { result := ServiceEndpointPolicyDefinitionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServiceEndpointPolicyDefinition); err != nil { - return ServiceEndpointPolicyDefinitionsGetResponse{}, err + return ServiceEndpointPolicyDefinitionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *ServiceEndpointPolicyDefinitionsClient) listByResourceGroupCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *ServiceEndpointPolicyDefinitionsClient) listByResourceGroupCreateR func (client *ServiceEndpointPolicyDefinitionsClient) listByResourceGroupHandleResponse(resp *http.Response) (ServiceEndpointPolicyDefinitionsListByResourceGroupResponse, error) { result := ServiceEndpointPolicyDefinitionsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServiceEndpointPolicyDefinitionListResult); err != nil { - return ServiceEndpointPolicyDefinitionsListByResourceGroupResponse{}, err + return ServiceEndpointPolicyDefinitionsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_servicetaginformation_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_servicetaginformation_client.go index ba8b4d41270b..c7cb93fb2300 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_servicetaginformation_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_servicetaginformation_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // ServiceTagInformationClient contains the methods for the ServiceTagInformation group. @@ -31,8 +32,15 @@ type ServiceTagInformationClient struct { } // NewServiceTagInformationClient creates a new instance of ServiceTagInformationClient with the specified values. -func NewServiceTagInformationClient(con *arm.Connection, subscriptionID string) *ServiceTagInformationClient { - return &ServiceTagInformationClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServiceTagInformationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServiceTagInformationClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServiceTagInformationClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets a list of service tag information resources with pagination. @@ -65,7 +73,7 @@ func (client *ServiceTagInformationClient) listCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.NoAddressPrefixes != nil { reqQP.Set("noAddressPrefixes", strconv.FormatBool(*options.NoAddressPrefixes)) } @@ -81,7 +89,7 @@ func (client *ServiceTagInformationClient) listCreateRequest(ctx context.Context func (client *ServiceTagInformationClient) listHandleResponse(resp *http.Response) (ServiceTagInformationListResponse, error) { result := ServiceTagInformationListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServiceTagInformationListResult); err != nil { - return ServiceTagInformationListResponse{}, err + return ServiceTagInformationListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_servicetags_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_servicetags_client.go index 51aa9dc904cd..607f133f36c7 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_servicetags_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_servicetags_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServiceTagsClient contains the methods for the ServiceTags group. @@ -30,8 +31,15 @@ type ServiceTagsClient struct { } // NewServiceTagsClient creates a new instance of ServiceTagsClient with the specified values. -func NewServiceTagsClient(con *arm.Connection, subscriptionID string) *ServiceTagsClient { - return &ServiceTagsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServiceTagsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServiceTagsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServiceTagsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets a list of service tag information resources. @@ -67,7 +75,7 @@ func (client *ServiceTagsClient) listCreateRequest(ctx context.Context, location return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -77,7 +85,7 @@ func (client *ServiceTagsClient) listCreateRequest(ctx context.Context, location func (client *ServiceTagsClient) listHandleResponse(resp *http.Response) (ServiceTagsListResponse, error) { result := ServiceTagsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServiceTagsListResult); err != nil { - return ServiceTagsListResponse{}, err + return ServiceTagsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_subnets_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_subnets_client.go index c6cdb580e872..16f3f1fe24fc 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_subnets_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_subnets_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SubnetsClient contains the methods for the Subnets group. @@ -31,8 +31,15 @@ type SubnetsClient struct { } // NewSubnetsClient creates a new instance of SubnetsClient with the specified values. -func NewSubnetsClient(con *arm.Connection, subscriptionID string) *SubnetsClient { - return &SubnetsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSubnetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SubnetsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SubnetsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a subnet in the specified virtual network. @@ -96,7 +103,7 @@ func (client *SubnetsClient) createOrUpdateCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, subnetParameters) @@ -176,7 +183,7 @@ func (client *SubnetsClient) deleteCreateRequest(ctx context.Context, resourceGr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *SubnetsClient) getCreateRequest(ctx context.Context, resourceGroup return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -249,7 +256,7 @@ func (client *SubnetsClient) getCreateRequest(ctx context.Context, resourceGroup func (client *SubnetsClient) getHandleResponse(resp *http.Response) (SubnetsGetResponse, error) { result := SubnetsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Subnet); err != nil { - return SubnetsGetResponse{}, err + return SubnetsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -301,7 +308,7 @@ func (client *SubnetsClient) listCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -311,7 +318,7 @@ func (client *SubnetsClient) listCreateRequest(ctx context.Context, resourceGrou func (client *SubnetsClient) listHandleResponse(resp *http.Response) (SubnetsListResponse, error) { result := SubnetsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SubnetListResult); err != nil { - return SubnetsListResponse{}, err + return SubnetsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -390,7 +397,7 @@ func (client *SubnetsClient) prepareNetworkPoliciesCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, prepareNetworkPoliciesRequestParameters) @@ -470,7 +477,7 @@ func (client *SubnetsClient) unprepareNetworkPoliciesCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, unprepareNetworkPoliciesRequestParameters) diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_time_rfc3339.go b/sdk/resourcemanager/network/armnetwork/zz_generated_time_rfc3339.go index f724e9d21668..66ed1d8c8a9f 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armnetwork import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_usages_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_usages_client.go index 2b06cb47d424..0ac1ecf0650b 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_usages_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_usages_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // UsagesClient contains the methods for the Usages group. @@ -30,8 +31,15 @@ type UsagesClient struct { } // NewUsagesClient creates a new instance of UsagesClient with the specified values. -func NewUsagesClient(con *arm.Connection, subscriptionID string) *UsagesClient { - return &UsagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UsagesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &UsagesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - List network usages for a subscription. @@ -64,7 +72,7 @@ func (client *UsagesClient) listCreateRequest(ctx context.Context, location stri return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -74,7 +82,7 @@ func (client *UsagesClient) listCreateRequest(ctx context.Context, location stri func (client *UsagesClient) listHandleResponse(resp *http.Response) (UsagesListResponse, error) { result := UsagesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UsagesListResult); err != nil { - return UsagesListResponse{}, err + return UsagesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualappliancesites_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualappliancesites_client.go index 9a98b8e467a8..815fe8e49fce 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualappliancesites_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualappliancesites_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualApplianceSitesClient contains the methods for the VirtualApplianceSites group. @@ -31,8 +31,15 @@ type VirtualApplianceSitesClient struct { } // NewVirtualApplianceSitesClient creates a new instance of VirtualApplianceSitesClient with the specified values. -func NewVirtualApplianceSitesClient(con *arm.Connection, subscriptionID string) *VirtualApplianceSitesClient { - return &VirtualApplianceSitesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualApplianceSitesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualApplianceSitesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualApplianceSitesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates the specified Network Virtual Appliance Site. @@ -96,7 +103,7 @@ func (client *VirtualApplianceSitesClient) createOrUpdateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -176,7 +183,7 @@ func (client *VirtualApplianceSitesClient) deleteCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *VirtualApplianceSitesClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *VirtualApplianceSitesClient) getCreateRequest(ctx context.Context, func (client *VirtualApplianceSitesClient) getHandleResponse(resp *http.Response) (VirtualApplianceSitesGetResponse, error) { result := VirtualApplianceSitesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualApplianceSite); err != nil { - return VirtualApplianceSitesGetResponse{}, err + return VirtualApplianceSitesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *VirtualApplianceSitesClient) listCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *VirtualApplianceSitesClient) listCreateRequest(ctx context.Context func (client *VirtualApplianceSitesClient) listHandleResponse(resp *http.Response) (VirtualApplianceSitesListResponse, error) { result := VirtualApplianceSitesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkVirtualApplianceSiteListResult); err != nil { - return VirtualApplianceSitesListResponse{}, err + return VirtualApplianceSitesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualapplianceskus_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualapplianceskus_client.go index 06aa4852704c..ff98b3e6e6a6 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualapplianceskus_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualapplianceskus_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualApplianceSKUsClient contains the methods for the VirtualApplianceSKUs group. @@ -30,8 +31,15 @@ type VirtualApplianceSKUsClient struct { } // NewVirtualApplianceSKUsClient creates a new instance of VirtualApplianceSKUsClient with the specified values. -func NewVirtualApplianceSKUsClient(con *arm.Connection, subscriptionID string) *VirtualApplianceSKUsClient { - return &VirtualApplianceSKUsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualApplianceSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualApplianceSKUsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualApplianceSKUsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Retrieves a single available sku for network virtual appliance. @@ -67,7 +75,7 @@ func (client *VirtualApplianceSKUsClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -77,7 +85,7 @@ func (client *VirtualApplianceSKUsClient) getCreateRequest(ctx context.Context, func (client *VirtualApplianceSKUsClient) getHandleResponse(resp *http.Response) (VirtualApplianceSKUsGetResponse, error) { result := VirtualApplianceSKUsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkVirtualApplianceSKU); err != nil { - return VirtualApplianceSKUsGetResponse{}, err + return VirtualApplianceSKUsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -121,7 +129,7 @@ func (client *VirtualApplianceSKUsClient) listCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -131,7 +139,7 @@ func (client *VirtualApplianceSKUsClient) listCreateRequest(ctx context.Context, func (client *VirtualApplianceSKUsClient) listHandleResponse(resp *http.Response) (VirtualApplianceSKUsListResponse, error) { result := VirtualApplianceSKUsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkVirtualApplianceSKUListResult); err != nil { - return VirtualApplianceSKUsListResponse{}, err + return VirtualApplianceSKUsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubbgpconnection_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubbgpconnection_client.go index a402b1a8d0b3..55e20018e6ff 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubbgpconnection_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubbgpconnection_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualHubBgpConnectionClient contains the methods for the VirtualHubBgpConnection group. @@ -31,8 +31,15 @@ type VirtualHubBgpConnectionClient struct { } // NewVirtualHubBgpConnectionClient creates a new instance of VirtualHubBgpConnectionClient with the specified values. -func NewVirtualHubBgpConnectionClient(con *arm.Connection, subscriptionID string) *VirtualHubBgpConnectionClient { - return &VirtualHubBgpConnectionClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualHubBgpConnectionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualHubBgpConnectionClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualHubBgpConnectionClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a VirtualHubBgpConnection resource if it doesn't exist else updates the existing VirtualHubBgpConnection. @@ -96,7 +103,7 @@ func (client *VirtualHubBgpConnectionClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -176,7 +183,7 @@ func (client *VirtualHubBgpConnectionClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *VirtualHubBgpConnectionClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *VirtualHubBgpConnectionClient) getCreateRequest(ctx context.Contex func (client *VirtualHubBgpConnectionClient) getHandleResponse(resp *http.Response) (VirtualHubBgpConnectionGetResponse, error) { result := VirtualHubBgpConnectionGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BgpConnection); err != nil { - return VirtualHubBgpConnectionGetResponse{}, err + return VirtualHubBgpConnectionGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubbgpconnections_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubbgpconnections_client.go index 86dd29f63e8d..43a92a8f7f7c 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubbgpconnections_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubbgpconnections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualHubBgpConnectionsClient contains the methods for the VirtualHubBgpConnections group. @@ -31,8 +31,15 @@ type VirtualHubBgpConnectionsClient struct { } // NewVirtualHubBgpConnectionsClient creates a new instance of VirtualHubBgpConnectionsClient with the specified values. -func NewVirtualHubBgpConnectionsClient(con *arm.Connection, subscriptionID string) *VirtualHubBgpConnectionsClient { - return &VirtualHubBgpConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualHubBgpConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualHubBgpConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualHubBgpConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Retrieves the details of all VirtualHubBgpConnections. @@ -69,7 +76,7 @@ func (client *VirtualHubBgpConnectionsClient) listCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -79,7 +86,7 @@ func (client *VirtualHubBgpConnectionsClient) listCreateRequest(ctx context.Cont func (client *VirtualHubBgpConnectionsClient) listHandleResponse(resp *http.Response) (VirtualHubBgpConnectionsListResponse, error) { result := VirtualHubBgpConnectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListVirtualHubBgpConnectionResults); err != nil { - return VirtualHubBgpConnectionsListResponse{}, err + return VirtualHubBgpConnectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -158,7 +165,7 @@ func (client *VirtualHubBgpConnectionsClient) listAdvertisedRoutesCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -238,7 +245,7 @@ func (client *VirtualHubBgpConnectionsClient) listLearnedRoutesCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubipconfiguration_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubipconfiguration_client.go index 0be443e3924f..76e9e393badb 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubipconfiguration_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubipconfiguration_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualHubIPConfigurationClient contains the methods for the VirtualHubIPConfiguration group. @@ -31,8 +31,15 @@ type VirtualHubIPConfigurationClient struct { } // NewVirtualHubIPConfigurationClient creates a new instance of VirtualHubIPConfigurationClient with the specified values. -func NewVirtualHubIPConfigurationClient(con *arm.Connection, subscriptionID string) *VirtualHubIPConfigurationClient { - return &VirtualHubIPConfigurationClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualHubIPConfigurationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualHubIPConfigurationClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualHubIPConfigurationClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a VirtualHubIpConfiguration resource if it doesn't exist else updates the existing VirtualHubIpConfiguration. @@ -96,7 +103,7 @@ func (client *VirtualHubIPConfigurationClient) createOrUpdateCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -176,7 +183,7 @@ func (client *VirtualHubIPConfigurationClient) deleteCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *VirtualHubIPConfigurationClient) getCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *VirtualHubIPConfigurationClient) getCreateRequest(ctx context.Cont func (client *VirtualHubIPConfigurationClient) getHandleResponse(resp *http.Response) (VirtualHubIPConfigurationGetResponse, error) { result := VirtualHubIPConfigurationGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HubIPConfiguration); err != nil { - return VirtualHubIPConfigurationGetResponse{}, err + return VirtualHubIPConfigurationGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *VirtualHubIPConfigurationClient) listCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *VirtualHubIPConfigurationClient) listCreateRequest(ctx context.Con func (client *VirtualHubIPConfigurationClient) listHandleResponse(resp *http.Response) (VirtualHubIPConfigurationListResponse, error) { result := VirtualHubIPConfigurationListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListVirtualHubIPConfigurationResults); err != nil { - return VirtualHubIPConfigurationListResponse{}, err + return VirtualHubIPConfigurationListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubroutetablev2s_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubroutetablev2s_client.go index 46df90dce5c3..6d152d0ff7c1 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubroutetablev2s_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubroutetablev2s_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualHubRouteTableV2SClient contains the methods for the VirtualHubRouteTableV2S group. @@ -31,8 +31,15 @@ type VirtualHubRouteTableV2SClient struct { } // NewVirtualHubRouteTableV2SClient creates a new instance of VirtualHubRouteTableV2SClient with the specified values. -func NewVirtualHubRouteTableV2SClient(con *arm.Connection, subscriptionID string) *VirtualHubRouteTableV2SClient { - return &VirtualHubRouteTableV2SClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualHubRouteTableV2SClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualHubRouteTableV2SClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualHubRouteTableV2SClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a VirtualHubRouteTableV2 resource if it doesn't exist else updates the existing VirtualHubRouteTableV2. @@ -96,7 +103,7 @@ func (client *VirtualHubRouteTableV2SClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, virtualHubRouteTableV2Parameters) @@ -176,7 +183,7 @@ func (client *VirtualHubRouteTableV2SClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *VirtualHubRouteTableV2SClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *VirtualHubRouteTableV2SClient) getCreateRequest(ctx context.Contex func (client *VirtualHubRouteTableV2SClient) getHandleResponse(resp *http.Response) (VirtualHubRouteTableV2SGetResponse, error) { result := VirtualHubRouteTableV2SGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualHubRouteTableV2); err != nil { - return VirtualHubRouteTableV2SGetResponse{}, err + return VirtualHubRouteTableV2SGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *VirtualHubRouteTableV2SClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *VirtualHubRouteTableV2SClient) listCreateRequest(ctx context.Conte func (client *VirtualHubRouteTableV2SClient) listHandleResponse(resp *http.Response) (VirtualHubRouteTableV2SListResponse, error) { result := VirtualHubRouteTableV2SListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListVirtualHubRouteTableV2SResult); err != nil { - return VirtualHubRouteTableV2SListResponse{}, err + return VirtualHubRouteTableV2SListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubs_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubs_client.go index b182f922168b..7b9eb508b57f 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubs_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualhubs_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualHubsClient contains the methods for the VirtualHubs group. @@ -31,8 +31,15 @@ type VirtualHubsClient struct { } // NewVirtualHubsClient creates a new instance of VirtualHubsClient with the specified values. -func NewVirtualHubsClient(con *arm.Connection, subscriptionID string) *VirtualHubsClient { - return &VirtualHubsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualHubsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualHubsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualHubsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a VirtualHub resource if it doesn't exist else updates the existing VirtualHub. @@ -92,7 +99,7 @@ func (client *VirtualHubsClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, virtualHubParameters) @@ -168,7 +175,7 @@ func (client *VirtualHubsClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *VirtualHubsClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +241,7 @@ func (client *VirtualHubsClient) getCreateRequest(ctx context.Context, resourceG func (client *VirtualHubsClient) getHandleResponse(resp *http.Response) (VirtualHubsGetResponse, error) { result := VirtualHubsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualHub); err != nil { - return VirtualHubsGetResponse{}, err + return VirtualHubsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -309,7 +316,7 @@ func (client *VirtualHubsClient) getEffectiveVirtualHubRoutesCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.EffectiveRoutesParameters != nil { @@ -357,7 +364,7 @@ func (client *VirtualHubsClient) listCreateRequest(ctx context.Context, options return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -367,7 +374,7 @@ func (client *VirtualHubsClient) listCreateRequest(ctx context.Context, options func (client *VirtualHubsClient) listHandleResponse(resp *http.Response) (VirtualHubsListResponse, error) { result := VirtualHubsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListVirtualHubsResult); err != nil { - return VirtualHubsListResponse{}, err + return VirtualHubsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -415,7 +422,7 @@ func (client *VirtualHubsClient) listByResourceGroupCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -425,7 +432,7 @@ func (client *VirtualHubsClient) listByResourceGroupCreateRequest(ctx context.Co func (client *VirtualHubsClient) listByResourceGroupHandleResponse(resp *http.Response) (VirtualHubsListByResourceGroupResponse, error) { result := VirtualHubsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListVirtualHubsResult); err != nil { - return VirtualHubsListByResourceGroupResponse{}, err + return VirtualHubsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -480,7 +487,7 @@ func (client *VirtualHubsClient) updateTagsCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, virtualHubParameters) @@ -490,7 +497,7 @@ func (client *VirtualHubsClient) updateTagsCreateRequest(ctx context.Context, re func (client *VirtualHubsClient) updateTagsHandleResponse(resp *http.Response) (VirtualHubsUpdateTagsResponse, error) { result := VirtualHubsUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualHub); err != nil { - return VirtualHubsUpdateTagsResponse{}, err + return VirtualHubsUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworkgatewayconnections_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworkgatewayconnections_client.go index 61377cce88e8..6643eb1be270 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworkgatewayconnections_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworkgatewayconnections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualNetworkGatewayConnectionsClient contains the methods for the VirtualNetworkGatewayConnections group. @@ -31,8 +31,15 @@ type VirtualNetworkGatewayConnectionsClient struct { } // NewVirtualNetworkGatewayConnectionsClient creates a new instance of VirtualNetworkGatewayConnectionsClient with the specified values. -func NewVirtualNetworkGatewayConnectionsClient(con *arm.Connection, subscriptionID string) *VirtualNetworkGatewayConnectionsClient { - return &VirtualNetworkGatewayConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualNetworkGatewayConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualNetworkGatewayConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualNetworkGatewayConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a virtual network gateway connection in the specified resource group. @@ -92,7 +99,7 @@ func (client *VirtualNetworkGatewayConnectionsClient) createOrUpdateCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *VirtualNetworkGatewayConnectionsClient) deleteCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *VirtualNetworkGatewayConnectionsClient) getCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +241,7 @@ func (client *VirtualNetworkGatewayConnectionsClient) getCreateRequest(ctx conte func (client *VirtualNetworkGatewayConnectionsClient) getHandleResponse(resp *http.Response) (VirtualNetworkGatewayConnectionsGetResponse, error) { result := VirtualNetworkGatewayConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkGatewayConnection); err != nil { - return VirtualNetworkGatewayConnectionsGetResponse{}, err + return VirtualNetworkGatewayConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -309,7 +316,7 @@ func (client *VirtualNetworkGatewayConnectionsClient) getIkeSasCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -366,7 +373,7 @@ func (client *VirtualNetworkGatewayConnectionsClient) getSharedKeyCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -376,7 +383,7 @@ func (client *VirtualNetworkGatewayConnectionsClient) getSharedKeyCreateRequest( func (client *VirtualNetworkGatewayConnectionsClient) getSharedKeyHandleResponse(resp *http.Response) (VirtualNetworkGatewayConnectionsGetSharedKeyResponse, error) { result := VirtualNetworkGatewayConnectionsGetSharedKeyResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionSharedKey); err != nil { - return VirtualNetworkGatewayConnectionsGetSharedKeyResponse{}, err + return VirtualNetworkGatewayConnectionsGetSharedKeyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -424,7 +431,7 @@ func (client *VirtualNetworkGatewayConnectionsClient) listCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -434,7 +441,7 @@ func (client *VirtualNetworkGatewayConnectionsClient) listCreateRequest(ctx cont func (client *VirtualNetworkGatewayConnectionsClient) listHandleResponse(resp *http.Response) (VirtualNetworkGatewayConnectionsListResponse, error) { result := VirtualNetworkGatewayConnectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkGatewayConnectionListResult); err != nil { - return VirtualNetworkGatewayConnectionsListResponse{}, err + return VirtualNetworkGatewayConnectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -509,7 +516,7 @@ func (client *VirtualNetworkGatewayConnectionsClient) resetConnectionCreateReque return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -589,7 +596,7 @@ func (client *VirtualNetworkGatewayConnectionsClient) resetSharedKeyCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -669,7 +676,7 @@ func (client *VirtualNetworkGatewayConnectionsClient) setSharedKeyCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -745,7 +752,7 @@ func (client *VirtualNetworkGatewayConnectionsClient) startPacketCaptureCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Parameters != nil { @@ -824,7 +831,7 @@ func (client *VirtualNetworkGatewayConnectionsClient) stopPacketCaptureCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -900,7 +907,7 @@ func (client *VirtualNetworkGatewayConnectionsClient) updateTagsCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworkgatewaynatrules_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworkgatewaynatrules_client.go index b77133a100e4..0a5ff841e11f 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworkgatewaynatrules_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworkgatewaynatrules_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualNetworkGatewayNatRulesClient contains the methods for the VirtualNetworkGatewayNatRules group. @@ -31,8 +31,15 @@ type VirtualNetworkGatewayNatRulesClient struct { } // NewVirtualNetworkGatewayNatRulesClient creates a new instance of VirtualNetworkGatewayNatRulesClient with the specified values. -func NewVirtualNetworkGatewayNatRulesClient(con *arm.Connection, subscriptionID string) *VirtualNetworkGatewayNatRulesClient { - return &VirtualNetworkGatewayNatRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualNetworkGatewayNatRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualNetworkGatewayNatRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualNetworkGatewayNatRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a nat rule to a scalable virtual network gateway if it doesn't exist else updates the existing nat rules. @@ -96,7 +103,7 @@ func (client *VirtualNetworkGatewayNatRulesClient) createOrUpdateCreateRequest(c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, natRuleParameters) @@ -176,7 +183,7 @@ func (client *VirtualNetworkGatewayNatRulesClient) deleteCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *VirtualNetworkGatewayNatRulesClient) getCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *VirtualNetworkGatewayNatRulesClient) getCreateRequest(ctx context. func (client *VirtualNetworkGatewayNatRulesClient) getHandleResponse(resp *http.Response) (VirtualNetworkGatewayNatRulesGetResponse, error) { result := VirtualNetworkGatewayNatRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkGatewayNatRule); err != nil { - return VirtualNetworkGatewayNatRulesGetResponse{}, err + return VirtualNetworkGatewayNatRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *VirtualNetworkGatewayNatRulesClient) listByVirtualNetworkGatewayCr return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *VirtualNetworkGatewayNatRulesClient) listByVirtualNetworkGatewayCr func (client *VirtualNetworkGatewayNatRulesClient) listByVirtualNetworkGatewayHandleResponse(resp *http.Response) (VirtualNetworkGatewayNatRulesListByVirtualNetworkGatewayResponse, error) { result := VirtualNetworkGatewayNatRulesListByVirtualNetworkGatewayResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListVirtualNetworkGatewayNatRulesResult); err != nil { - return VirtualNetworkGatewayNatRulesListByVirtualNetworkGatewayResponse{}, err + return VirtualNetworkGatewayNatRulesListByVirtualNetworkGatewayResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworkgateways_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworkgateways_client.go index 14d1b48a426c..1c942ff38bd0 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworkgateways_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworkgateways_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualNetworkGatewaysClient contains the methods for the VirtualNetworkGateways group. @@ -31,8 +31,15 @@ type VirtualNetworkGatewaysClient struct { } // NewVirtualNetworkGatewaysClient creates a new instance of VirtualNetworkGatewaysClient with the specified values. -func NewVirtualNetworkGatewaysClient(con *arm.Connection, subscriptionID string) *VirtualNetworkGatewaysClient { - return &VirtualNetworkGatewaysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualNetworkGatewaysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualNetworkGatewaysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualNetworkGatewaysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a virtual network gateway in the specified resource group. @@ -92,7 +99,7 @@ func (client *VirtualNetworkGatewaysClient) createOrUpdateCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *VirtualNetworkGatewaysClient) deleteCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -244,7 +251,7 @@ func (client *VirtualNetworkGatewaysClient) disconnectVirtualNetworkGatewayVPNCo return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, request) @@ -322,7 +329,7 @@ func (client *VirtualNetworkGatewaysClient) generateVPNProfileCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -398,7 +405,7 @@ func (client *VirtualNetworkGatewaysClient) generatevpnclientpackageCreateReques return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -454,7 +461,7 @@ func (client *VirtualNetworkGatewaysClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -464,7 +471,7 @@ func (client *VirtualNetworkGatewaysClient) getCreateRequest(ctx context.Context func (client *VirtualNetworkGatewaysClient) getHandleResponse(resp *http.Response) (VirtualNetworkGatewaysGetResponse, error) { result := VirtualNetworkGatewaysGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkGateway); err != nil { - return VirtualNetworkGatewaysGetResponse{}, err + return VirtualNetworkGatewaysGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -540,7 +547,7 @@ func (client *VirtualNetworkGatewaysClient) getAdvertisedRoutesCreateRequest(ctx } reqQP := req.Raw().URL.Query() reqQP.Set("peer", peer) - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -619,7 +626,7 @@ func (client *VirtualNetworkGatewaysClient) getBgpPeerStatusCreateRequest(ctx co if options != nil && options.Peer != nil { reqQP.Set("peer", *options.Peer) } - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -695,7 +702,7 @@ func (client *VirtualNetworkGatewaysClient) getLearnedRoutesCreateRequest(ctx co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -773,7 +780,7 @@ func (client *VirtualNetworkGatewaysClient) getVPNProfilePackageURLCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -851,7 +858,7 @@ func (client *VirtualNetworkGatewaysClient) getVpnclientConnectionHealthCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -931,7 +938,7 @@ func (client *VirtualNetworkGatewaysClient) getVpnclientIPSecParametersCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -980,7 +987,7 @@ func (client *VirtualNetworkGatewaysClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -990,7 +997,7 @@ func (client *VirtualNetworkGatewaysClient) listCreateRequest(ctx context.Contex func (client *VirtualNetworkGatewaysClient) listHandleResponse(resp *http.Response) (VirtualNetworkGatewaysListResponse, error) { result := VirtualNetworkGatewaysListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkGatewayListResult); err != nil { - return VirtualNetworkGatewaysListResponse{}, err + return VirtualNetworkGatewaysListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1042,7 +1049,7 @@ func (client *VirtualNetworkGatewaysClient) listConnectionsCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1052,7 +1059,7 @@ func (client *VirtualNetworkGatewaysClient) listConnectionsCreateRequest(ctx con func (client *VirtualNetworkGatewaysClient) listConnectionsHandleResponse(resp *http.Response) (VirtualNetworkGatewaysListConnectionsResponse, error) { result := VirtualNetworkGatewaysListConnectionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkGatewayListConnectionsResult); err != nil { - return VirtualNetworkGatewaysListConnectionsResponse{}, err + return VirtualNetworkGatewaysListConnectionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1130,7 +1137,7 @@ func (client *VirtualNetworkGatewaysClient) resetCreateRequest(ctx context.Conte if options != nil && options.GatewayVip != nil { reqQP.Set("gatewayVip", *options.GatewayVip) } - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1206,7 +1213,7 @@ func (client *VirtualNetworkGatewaysClient) resetVPNClientSharedKeyCreateRequest return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1284,7 +1291,7 @@ func (client *VirtualNetworkGatewaysClient) setVpnclientIPSecParametersCreateReq return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, vpnclientIPSecParams) @@ -1360,7 +1367,7 @@ func (client *VirtualNetworkGatewaysClient) startPacketCaptureCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Parameters != nil { @@ -1439,7 +1446,7 @@ func (client *VirtualNetworkGatewaysClient) stopPacketCaptureCreateRequest(ctx c return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -1495,7 +1502,7 @@ func (client *VirtualNetworkGatewaysClient) supportedVPNDevicesCreateRequest(ctx return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -1505,7 +1512,7 @@ func (client *VirtualNetworkGatewaysClient) supportedVPNDevicesCreateRequest(ctx func (client *VirtualNetworkGatewaysClient) supportedVPNDevicesHandleResponse(resp *http.Response) (VirtualNetworkGatewaysSupportedVPNDevicesResponse, error) { result := VirtualNetworkGatewaysSupportedVPNDevicesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Value); err != nil { - return VirtualNetworkGatewaysSupportedVPNDevicesResponse{}, err + return VirtualNetworkGatewaysSupportedVPNDevicesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1580,7 +1587,7 @@ func (client *VirtualNetworkGatewaysClient) updateTagsCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -1636,7 +1643,7 @@ func (client *VirtualNetworkGatewaysClient) vpnDeviceConfigurationScriptCreateRe return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -1646,7 +1653,7 @@ func (client *VirtualNetworkGatewaysClient) vpnDeviceConfigurationScriptCreateRe func (client *VirtualNetworkGatewaysClient) vpnDeviceConfigurationScriptHandleResponse(resp *http.Response) (VirtualNetworkGatewaysVPNDeviceConfigurationScriptResponse, error) { result := VirtualNetworkGatewaysVPNDeviceConfigurationScriptResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Value); err != nil { - return VirtualNetworkGatewaysVPNDeviceConfigurationScriptResponse{}, err + return VirtualNetworkGatewaysVPNDeviceConfigurationScriptResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworkpeerings_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworkpeerings_client.go index 5b0a43c13bec..e1031a1fbfb7 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworkpeerings_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworkpeerings_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualNetworkPeeringsClient contains the methods for the VirtualNetworkPeerings group. @@ -31,8 +31,15 @@ type VirtualNetworkPeeringsClient struct { } // NewVirtualNetworkPeeringsClient creates a new instance of VirtualNetworkPeeringsClient with the specified values. -func NewVirtualNetworkPeeringsClient(con *arm.Connection, subscriptionID string) *VirtualNetworkPeeringsClient { - return &VirtualNetworkPeeringsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualNetworkPeeringsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualNetworkPeeringsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualNetworkPeeringsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a peering in the specified virtual network. @@ -99,7 +106,7 @@ func (client *VirtualNetworkPeeringsClient) createOrUpdateCreateRequest(ctx cont if options != nil && options.SyncRemoteAddressSpace != nil { reqQP.Set("syncRemoteAddressSpace", string(*options.SyncRemoteAddressSpace)) } - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, virtualNetworkPeeringParameters) @@ -179,7 +186,7 @@ func (client *VirtualNetworkPeeringsClient) deleteCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -239,7 +246,7 @@ func (client *VirtualNetworkPeeringsClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -249,7 +256,7 @@ func (client *VirtualNetworkPeeringsClient) getCreateRequest(ctx context.Context func (client *VirtualNetworkPeeringsClient) getHandleResponse(resp *http.Response) (VirtualNetworkPeeringsGetResponse, error) { result := VirtualNetworkPeeringsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkPeering); err != nil { - return VirtualNetworkPeeringsGetResponse{}, err + return VirtualNetworkPeeringsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -301,7 +308,7 @@ func (client *VirtualNetworkPeeringsClient) listCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -311,7 +318,7 @@ func (client *VirtualNetworkPeeringsClient) listCreateRequest(ctx context.Contex func (client *VirtualNetworkPeeringsClient) listHandleResponse(resp *http.Response) (VirtualNetworkPeeringsListResponse, error) { result := VirtualNetworkPeeringsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkPeeringListResult); err != nil { - return VirtualNetworkPeeringsListResponse{}, err + return VirtualNetworkPeeringsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworks_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworks_client.go index 6900a158545a..f42f0075c340 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworks_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworks_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualNetworksClient contains the methods for the VirtualNetworks group. @@ -31,8 +31,15 @@ type VirtualNetworksClient struct { } // NewVirtualNetworksClient creates a new instance of VirtualNetworksClient with the specified values. -func NewVirtualNetworksClient(con *arm.Connection, subscriptionID string) *VirtualNetworksClient { - return &VirtualNetworksClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualNetworksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualNetworksClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualNetworksClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckIPAddressAvailability - Checks whether a private IP address is available for use. @@ -73,7 +80,7 @@ func (client *VirtualNetworksClient) checkIPAddressAvailabilityCreateRequest(ctx } reqQP := req.Raw().URL.Query() reqQP.Set("ipAddress", ipAddress) - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -83,7 +90,7 @@ func (client *VirtualNetworksClient) checkIPAddressAvailabilityCreateRequest(ctx func (client *VirtualNetworksClient) checkIPAddressAvailabilityHandleResponse(resp *http.Response) (VirtualNetworksCheckIPAddressAvailabilityResponse, error) { result := VirtualNetworksCheckIPAddressAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IPAddressAvailabilityResult); err != nil { - return VirtualNetworksCheckIPAddressAvailabilityResponse{}, err + return VirtualNetworksCheckIPAddressAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -158,7 +165,7 @@ func (client *VirtualNetworksClient) createOrUpdateCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -234,7 +241,7 @@ func (client *VirtualNetworksClient) deleteCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -290,7 +297,7 @@ func (client *VirtualNetworksClient) getCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -303,7 +310,7 @@ func (client *VirtualNetworksClient) getCreateRequest(ctx context.Context, resou func (client *VirtualNetworksClient) getHandleResponse(resp *http.Response) (VirtualNetworksGetResponse, error) { result := VirtualNetworksGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetwork); err != nil { - return VirtualNetworksGetResponse{}, err + return VirtualNetworksGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -351,7 +358,7 @@ func (client *VirtualNetworksClient) listCreateRequest(ctx context.Context, reso return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -361,7 +368,7 @@ func (client *VirtualNetworksClient) listCreateRequest(ctx context.Context, reso func (client *VirtualNetworksClient) listHandleResponse(resp *http.Response) (VirtualNetworksListResponse, error) { result := VirtualNetworksListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkListResult); err != nil { - return VirtualNetworksListResponse{}, err + return VirtualNetworksListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -405,7 +412,7 @@ func (client *VirtualNetworksClient) listAllCreateRequest(ctx context.Context, o return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -415,7 +422,7 @@ func (client *VirtualNetworksClient) listAllCreateRequest(ctx context.Context, o func (client *VirtualNetworksClient) listAllHandleResponse(resp *http.Response) (VirtualNetworksListAllResponse, error) { result := VirtualNetworksListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkListResult); err != nil { - return VirtualNetworksListAllResponse{}, err + return VirtualNetworksListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -467,7 +474,7 @@ func (client *VirtualNetworksClient) listUsageCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -477,7 +484,7 @@ func (client *VirtualNetworksClient) listUsageCreateRequest(ctx context.Context, func (client *VirtualNetworksClient) listUsageHandleResponse(resp *http.Response) (VirtualNetworksListUsageResponse, error) { result := VirtualNetworksListUsageResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkListUsageResult); err != nil { - return VirtualNetworksListUsageResponse{}, err + return VirtualNetworksListUsageResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -532,7 +539,7 @@ func (client *VirtualNetworksClient) updateTagsCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -542,7 +549,7 @@ func (client *VirtualNetworksClient) updateTagsCreateRequest(ctx context.Context func (client *VirtualNetworksClient) updateTagsHandleResponse(resp *http.Response) (VirtualNetworksUpdateTagsResponse, error) { result := VirtualNetworksUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetwork); err != nil { - return VirtualNetworksUpdateTagsResponse{}, err + return VirtualNetworksUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworktaps_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworktaps_client.go index 5028f0b91f00..5c2f3f4b21e2 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworktaps_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualnetworktaps_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualNetworkTapsClient contains the methods for the VirtualNetworkTaps group. @@ -31,8 +31,15 @@ type VirtualNetworkTapsClient struct { } // NewVirtualNetworkTapsClient creates a new instance of VirtualNetworkTapsClient with the specified values. -func NewVirtualNetworkTapsClient(con *arm.Connection, subscriptionID string) *VirtualNetworkTapsClient { - return &VirtualNetworkTapsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualNetworkTapsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualNetworkTapsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualNetworkTapsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a Virtual Network Tap. @@ -92,7 +99,7 @@ func (client *VirtualNetworkTapsClient) createOrUpdateCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *VirtualNetworkTapsClient) deleteCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *VirtualNetworkTapsClient) getCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +241,7 @@ func (client *VirtualNetworkTapsClient) getCreateRequest(ctx context.Context, re func (client *VirtualNetworkTapsClient) getHandleResponse(resp *http.Response) (VirtualNetworkTapsGetResponse, error) { result := VirtualNetworkTapsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkTap); err != nil { - return VirtualNetworkTapsGetResponse{}, err + return VirtualNetworkTapsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -278,7 +285,7 @@ func (client *VirtualNetworkTapsClient) listAllCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -288,7 +295,7 @@ func (client *VirtualNetworkTapsClient) listAllCreateRequest(ctx context.Context func (client *VirtualNetworkTapsClient) listAllHandleResponse(resp *http.Response) (VirtualNetworkTapsListAllResponse, error) { result := VirtualNetworkTapsListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkTapListResult); err != nil { - return VirtualNetworkTapsListAllResponse{}, err + return VirtualNetworkTapsListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -336,7 +343,7 @@ func (client *VirtualNetworkTapsClient) listByResourceGroupCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -346,7 +353,7 @@ func (client *VirtualNetworkTapsClient) listByResourceGroupCreateRequest(ctx con func (client *VirtualNetworkTapsClient) listByResourceGroupHandleResponse(resp *http.Response) (VirtualNetworkTapsListByResourceGroupResponse, error) { result := VirtualNetworkTapsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkTapListResult); err != nil { - return VirtualNetworkTapsListByResourceGroupResponse{}, err + return VirtualNetworkTapsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -401,7 +408,7 @@ func (client *VirtualNetworkTapsClient) updateTagsCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, tapParameters) @@ -411,7 +418,7 @@ func (client *VirtualNetworkTapsClient) updateTagsCreateRequest(ctx context.Cont func (client *VirtualNetworkTapsClient) updateTagsHandleResponse(resp *http.Response) (VirtualNetworkTapsUpdateTagsResponse, error) { result := VirtualNetworkTapsUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkTap); err != nil { - return VirtualNetworkTapsUpdateTagsResponse{}, err + return VirtualNetworkTapsUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualrouterpeerings_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualrouterpeerings_client.go index 47fd6c68f5ee..26440ca7cf44 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualrouterpeerings_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualrouterpeerings_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualRouterPeeringsClient contains the methods for the VirtualRouterPeerings group. @@ -31,8 +31,15 @@ type VirtualRouterPeeringsClient struct { } // NewVirtualRouterPeeringsClient creates a new instance of VirtualRouterPeeringsClient with the specified values. -func NewVirtualRouterPeeringsClient(con *arm.Connection, subscriptionID string) *VirtualRouterPeeringsClient { - return &VirtualRouterPeeringsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualRouterPeeringsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualRouterPeeringsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualRouterPeeringsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates the specified Virtual Router Peering. @@ -96,7 +103,7 @@ func (client *VirtualRouterPeeringsClient) createOrUpdateCreateRequest(ctx conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -176,7 +183,7 @@ func (client *VirtualRouterPeeringsClient) deleteCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *VirtualRouterPeeringsClient) getCreateRequest(ctx context.Context, return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *VirtualRouterPeeringsClient) getCreateRequest(ctx context.Context, func (client *VirtualRouterPeeringsClient) getHandleResponse(resp *http.Response) (VirtualRouterPeeringsGetResponse, error) { result := VirtualRouterPeeringsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualRouterPeering); err != nil { - return VirtualRouterPeeringsGetResponse{}, err + return VirtualRouterPeeringsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *VirtualRouterPeeringsClient) listCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *VirtualRouterPeeringsClient) listCreateRequest(ctx context.Context func (client *VirtualRouterPeeringsClient) listHandleResponse(resp *http.Response) (VirtualRouterPeeringsListResponse, error) { result := VirtualRouterPeeringsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualRouterPeeringListResult); err != nil { - return VirtualRouterPeeringsListResponse{}, err + return VirtualRouterPeeringsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualrouters_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualrouters_client.go index 54a709dc109c..d08d304c6485 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualrouters_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualrouters_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualRoutersClient contains the methods for the VirtualRouters group. @@ -31,8 +31,15 @@ type VirtualRoutersClient struct { } // NewVirtualRoutersClient creates a new instance of VirtualRoutersClient with the specified values. -func NewVirtualRoutersClient(con *arm.Connection, subscriptionID string) *VirtualRoutersClient { - return &VirtualRoutersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualRoutersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualRoutersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualRoutersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates the specified Virtual Router. @@ -92,7 +99,7 @@ func (client *VirtualRoutersClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -168,7 +175,7 @@ func (client *VirtualRoutersClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *VirtualRoutersClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -237,7 +244,7 @@ func (client *VirtualRoutersClient) getCreateRequest(ctx context.Context, resour func (client *VirtualRoutersClient) getHandleResponse(resp *http.Response) (VirtualRoutersGetResponse, error) { result := VirtualRoutersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualRouter); err != nil { - return VirtualRoutersGetResponse{}, err + return VirtualRoutersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -281,7 +288,7 @@ func (client *VirtualRoutersClient) listCreateRequest(ctx context.Context, optio return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -291,7 +298,7 @@ func (client *VirtualRoutersClient) listCreateRequest(ctx context.Context, optio func (client *VirtualRoutersClient) listHandleResponse(resp *http.Response) (VirtualRoutersListResponse, error) { result := VirtualRoutersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualRouterListResult); err != nil { - return VirtualRoutersListResponse{}, err + return VirtualRoutersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -339,7 +346,7 @@ func (client *VirtualRoutersClient) listByResourceGroupCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -349,7 +356,7 @@ func (client *VirtualRoutersClient) listByResourceGroupCreateRequest(ctx context func (client *VirtualRoutersClient) listByResourceGroupHandleResponse(resp *http.Response) (VirtualRoutersListByResourceGroupResponse, error) { result := VirtualRoutersListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualRouterListResult); err != nil { - return VirtualRoutersListByResourceGroupResponse{}, err + return VirtualRoutersListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualwans_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualwans_client.go index 40cf685d6300..7e657f60423c 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_virtualwans_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_virtualwans_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualWansClient contains the methods for the VirtualWans group. @@ -31,8 +31,15 @@ type VirtualWansClient struct { } // NewVirtualWansClient creates a new instance of VirtualWansClient with the specified values. -func NewVirtualWansClient(con *arm.Connection, subscriptionID string) *VirtualWansClient { - return &VirtualWansClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualWansClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualWansClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualWansClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a VirtualWAN resource if it doesn't exist else updates the existing VirtualWAN. @@ -92,7 +99,7 @@ func (client *VirtualWansClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, wanParameters) @@ -168,7 +175,7 @@ func (client *VirtualWansClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *VirtualWansClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +241,7 @@ func (client *VirtualWansClient) getCreateRequest(ctx context.Context, resourceG func (client *VirtualWansClient) getHandleResponse(resp *http.Response) (VirtualWansGetResponse, error) { result := VirtualWansGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualWAN); err != nil { - return VirtualWansGetResponse{}, err + return VirtualWansGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -278,7 +285,7 @@ func (client *VirtualWansClient) listCreateRequest(ctx context.Context, options return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -288,7 +295,7 @@ func (client *VirtualWansClient) listCreateRequest(ctx context.Context, options func (client *VirtualWansClient) listHandleResponse(resp *http.Response) (VirtualWansListResponse, error) { result := VirtualWansListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListVirtualWANsResult); err != nil { - return VirtualWansListResponse{}, err + return VirtualWansListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -336,7 +343,7 @@ func (client *VirtualWansClient) listByResourceGroupCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -346,7 +353,7 @@ func (client *VirtualWansClient) listByResourceGroupCreateRequest(ctx context.Co func (client *VirtualWansClient) listByResourceGroupHandleResponse(resp *http.Response) (VirtualWansListByResourceGroupResponse, error) { result := VirtualWansListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListVirtualWANsResult); err != nil { - return VirtualWansListByResourceGroupResponse{}, err + return VirtualWansListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -401,7 +408,7 @@ func (client *VirtualWansClient) updateTagsCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, wanParameters) @@ -411,7 +418,7 @@ func (client *VirtualWansClient) updateTagsCreateRequest(ctx context.Context, re func (client *VirtualWansClient) updateTagsHandleResponse(resp *http.Response) (VirtualWansUpdateTagsResponse, error) { result := VirtualWansUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualWAN); err != nil { - return VirtualWansUpdateTagsResponse{}, err + return VirtualWansUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_vpnconnections_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_vpnconnections_client.go index 2eac81803712..c25130a5a422 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_vpnconnections_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_vpnconnections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VPNConnectionsClient contains the methods for the VPNConnections group. @@ -31,8 +31,15 @@ type VPNConnectionsClient struct { } // NewVPNConnectionsClient creates a new instance of VPNConnectionsClient with the specified values. -func NewVPNConnectionsClient(con *arm.Connection, subscriptionID string) *VPNConnectionsClient { - return &VPNConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVPNConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VPNConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VPNConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a vpn connection to a scalable vpn gateway if it doesn't exist else updates the existing connection. @@ -96,7 +103,7 @@ func (client *VPNConnectionsClient) createOrUpdateCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, vpnConnectionParameters) @@ -176,7 +183,7 @@ func (client *VPNConnectionsClient) deleteCreateRequest(ctx context.Context, res return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -236,7 +243,7 @@ func (client *VPNConnectionsClient) getCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -246,7 +253,7 @@ func (client *VPNConnectionsClient) getCreateRequest(ctx context.Context, resour func (client *VPNConnectionsClient) getHandleResponse(resp *http.Response) (VPNConnectionsGetResponse, error) { result := VPNConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VPNConnection); err != nil { - return VPNConnectionsGetResponse{}, err + return VPNConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *VPNConnectionsClient) listByVPNGatewayCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -308,7 +315,7 @@ func (client *VPNConnectionsClient) listByVPNGatewayCreateRequest(ctx context.Co func (client *VPNConnectionsClient) listByVPNGatewayHandleResponse(resp *http.Response) (VPNConnectionsListByVPNGatewayResponse, error) { result := VPNConnectionsListByVPNGatewayResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNConnectionsResult); err != nil { - return VPNConnectionsListByVPNGatewayResponse{}, err + return VPNConnectionsListByVPNGatewayResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -387,7 +394,7 @@ func (client *VPNConnectionsClient) startPacketCaptureCreateRequest(ctx context. return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Parameters != nil { @@ -470,7 +477,7 @@ func (client *VPNConnectionsClient) stopPacketCaptureCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Parameters != nil { diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_vpngateways_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_vpngateways_client.go index ccfd1e8fe7cc..c454d39bc921 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_vpngateways_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_vpngateways_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VPNGatewaysClient contains the methods for the VPNGateways group. @@ -31,8 +31,15 @@ type VPNGatewaysClient struct { } // NewVPNGatewaysClient creates a new instance of VPNGatewaysClient with the specified values. -func NewVPNGatewaysClient(con *arm.Connection, subscriptionID string) *VPNGatewaysClient { - return &VPNGatewaysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVPNGatewaysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VPNGatewaysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VPNGatewaysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a virtual wan vpn gateway if it doesn't exist else updates the existing gateway. @@ -92,7 +99,7 @@ func (client *VPNGatewaysClient) createOrUpdateCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, vpnGatewayParameters) @@ -168,7 +175,7 @@ func (client *VPNGatewaysClient) deleteCreateRequest(ctx context.Context, resour return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *VPNGatewaysClient) getCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +241,7 @@ func (client *VPNGatewaysClient) getCreateRequest(ctx context.Context, resourceG func (client *VPNGatewaysClient) getHandleResponse(resp *http.Response) (VPNGatewaysGetResponse, error) { result := VPNGatewaysGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VPNGateway); err != nil { - return VPNGatewaysGetResponse{}, err + return VPNGatewaysGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -278,7 +285,7 @@ func (client *VPNGatewaysClient) listCreateRequest(ctx context.Context, options return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -288,7 +295,7 @@ func (client *VPNGatewaysClient) listCreateRequest(ctx context.Context, options func (client *VPNGatewaysClient) listHandleResponse(resp *http.Response) (VPNGatewaysListResponse, error) { result := VPNGatewaysListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNGatewaysResult); err != nil { - return VPNGatewaysListResponse{}, err + return VPNGatewaysListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -336,7 +343,7 @@ func (client *VPNGatewaysClient) listByResourceGroupCreateRequest(ctx context.Co return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -346,7 +353,7 @@ func (client *VPNGatewaysClient) listByResourceGroupCreateRequest(ctx context.Co func (client *VPNGatewaysClient) listByResourceGroupHandleResponse(resp *http.Response) (VPNGatewaysListByResourceGroupResponse, error) { result := VPNGatewaysListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNGatewaysResult); err != nil { - return VPNGatewaysListByResourceGroupResponse{}, err + return VPNGatewaysListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -421,7 +428,7 @@ func (client *VPNGatewaysClient) resetCreateRequest(ctx context.Context, resourc return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -497,7 +504,7 @@ func (client *VPNGatewaysClient) startPacketCaptureCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Parameters != nil { @@ -576,7 +583,7 @@ func (client *VPNGatewaysClient) stopPacketCaptureCreateRequest(ctx context.Cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") if options != nil && options.Parameters != nil { @@ -655,7 +662,7 @@ func (client *VPNGatewaysClient) updateTagsCreateRequest(ctx context.Context, re return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, vpnGatewayParameters) diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_vpnlinkconnections_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_vpnlinkconnections_client.go index 60268aa5e42a..a6cea939c367 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_vpnlinkconnections_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_vpnlinkconnections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VPNLinkConnectionsClient contains the methods for the VPNLinkConnections group. @@ -31,8 +31,15 @@ type VPNLinkConnectionsClient struct { } // NewVPNLinkConnectionsClient creates a new instance of VPNLinkConnectionsClient with the specified values. -func NewVPNLinkConnectionsClient(con *arm.Connection, subscriptionID string) *VPNLinkConnectionsClient { - return &VPNLinkConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVPNLinkConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VPNLinkConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VPNLinkConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginGetIkeSas - Lists IKE Security Associations for Vpn Site Link Connection in the specified resource group. @@ -100,7 +107,7 @@ func (client *VPNLinkConnectionsClient) getIkeSasCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -157,7 +164,7 @@ func (client *VPNLinkConnectionsClient) listByVPNConnectionCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -167,7 +174,7 @@ func (client *VPNLinkConnectionsClient) listByVPNConnectionCreateRequest(ctx con func (client *VPNLinkConnectionsClient) listByVPNConnectionHandleResponse(resp *http.Response) (VPNLinkConnectionsListByVPNConnectionResponse, error) { result := VPNLinkConnectionsListByVPNConnectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNSiteLinkConnectionsResult); err != nil { - return VPNLinkConnectionsListByVPNConnectionResponse{}, err + return VPNLinkConnectionsListByVPNConnectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -250,7 +257,7 @@ func (client *VPNLinkConnectionsClient) resetConnectionCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_vpnserverconfigurations_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_vpnserverconfigurations_client.go index bb66bcbc59d2..2dae981f4596 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_vpnserverconfigurations_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_vpnserverconfigurations_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VPNServerConfigurationsClient contains the methods for the VPNServerConfigurations group. @@ -31,8 +31,15 @@ type VPNServerConfigurationsClient struct { } // NewVPNServerConfigurationsClient creates a new instance of VPNServerConfigurationsClient with the specified values. -func NewVPNServerConfigurationsClient(con *arm.Connection, subscriptionID string) *VPNServerConfigurationsClient { - return &VPNServerConfigurationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVPNServerConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VPNServerConfigurationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VPNServerConfigurationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a VpnServerConfiguration resource if it doesn't exist else updates the existing VpnServerConfiguration. @@ -92,7 +99,7 @@ func (client *VPNServerConfigurationsClient) createOrUpdateCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, vpnServerConfigurationParameters) @@ -168,7 +175,7 @@ func (client *VPNServerConfigurationsClient) deleteCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *VPNServerConfigurationsClient) getCreateRequest(ctx context.Contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +241,7 @@ func (client *VPNServerConfigurationsClient) getCreateRequest(ctx context.Contex func (client *VPNServerConfigurationsClient) getHandleResponse(resp *http.Response) (VPNServerConfigurationsGetResponse, error) { result := VPNServerConfigurationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VPNServerConfiguration); err != nil { - return VPNServerConfigurationsGetResponse{}, err + return VPNServerConfigurationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -278,7 +285,7 @@ func (client *VPNServerConfigurationsClient) listCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -288,7 +295,7 @@ func (client *VPNServerConfigurationsClient) listCreateRequest(ctx context.Conte func (client *VPNServerConfigurationsClient) listHandleResponse(resp *http.Response) (VPNServerConfigurationsListResponse, error) { result := VPNServerConfigurationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNServerConfigurationsResult); err != nil { - return VPNServerConfigurationsListResponse{}, err + return VPNServerConfigurationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -336,7 +343,7 @@ func (client *VPNServerConfigurationsClient) listByResourceGroupCreateRequest(ct return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -346,7 +353,7 @@ func (client *VPNServerConfigurationsClient) listByResourceGroupCreateRequest(ct func (client *VPNServerConfigurationsClient) listByResourceGroupHandleResponse(resp *http.Response) (VPNServerConfigurationsListByResourceGroupResponse, error) { result := VPNServerConfigurationsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNServerConfigurationsResult); err != nil { - return VPNServerConfigurationsListByResourceGroupResponse{}, err + return VPNServerConfigurationsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -401,7 +408,7 @@ func (client *VPNServerConfigurationsClient) updateTagsCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, vpnServerConfigurationParameters) @@ -411,7 +418,7 @@ func (client *VPNServerConfigurationsClient) updateTagsCreateRequest(ctx context func (client *VPNServerConfigurationsClient) updateTagsHandleResponse(resp *http.Response) (VPNServerConfigurationsUpdateTagsResponse, error) { result := VPNServerConfigurationsUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VPNServerConfiguration); err != nil { - return VPNServerConfigurationsUpdateTagsResponse{}, err + return VPNServerConfigurationsUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_vpnserverconfigurationsassociatedwithvirtualwan_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_vpnserverconfigurationsassociatedwithvirtualwan_client.go index 8fcc9f009a73..79f1184b6be5 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_vpnserverconfigurationsassociatedwithvirtualwan_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_vpnserverconfigurationsassociatedwithvirtualwan_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VPNServerConfigurationsAssociatedWithVirtualWanClient contains the methods for the VPNServerConfigurationsAssociatedWithVirtualWan group. @@ -31,8 +31,15 @@ type VPNServerConfigurationsAssociatedWithVirtualWanClient struct { } // NewVPNServerConfigurationsAssociatedWithVirtualWanClient creates a new instance of VPNServerConfigurationsAssociatedWithVirtualWanClient with the specified values. -func NewVPNServerConfigurationsAssociatedWithVirtualWanClient(con *arm.Connection, subscriptionID string) *VPNServerConfigurationsAssociatedWithVirtualWanClient { - return &VPNServerConfigurationsAssociatedWithVirtualWanClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVPNServerConfigurationsAssociatedWithVirtualWanClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VPNServerConfigurationsAssociatedWithVirtualWanClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VPNServerConfigurationsAssociatedWithVirtualWanClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginList - Gives the list of VpnServerConfigurations associated with Virtual Wan in a resource group. @@ -92,7 +99,7 @@ func (client *VPNServerConfigurationsAssociatedWithVirtualWanClient) listCreateR return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_vpnsitelinkconnections_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_vpnsitelinkconnections_client.go index fa6450c1635c..aae6c38e5b78 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_vpnsitelinkconnections_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_vpnsitelinkconnections_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VPNSiteLinkConnectionsClient contains the methods for the VPNSiteLinkConnections group. @@ -30,8 +31,15 @@ type VPNSiteLinkConnectionsClient struct { } // NewVPNSiteLinkConnectionsClient creates a new instance of VPNSiteLinkConnectionsClient with the specified values. -func NewVPNSiteLinkConnectionsClient(con *arm.Connection, subscriptionID string) *VPNSiteLinkConnectionsClient { - return &VPNSiteLinkConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVPNSiteLinkConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VPNSiteLinkConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VPNSiteLinkConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Retrieves the details of a vpn site link connection. @@ -79,7 +87,7 @@ func (client *VPNSiteLinkConnectionsClient) getCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -89,7 +97,7 @@ func (client *VPNSiteLinkConnectionsClient) getCreateRequest(ctx context.Context func (client *VPNSiteLinkConnectionsClient) getHandleResponse(resp *http.Response) (VPNSiteLinkConnectionsGetResponse, error) { result := VPNSiteLinkConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VPNSiteLinkConnection); err != nil { - return VPNSiteLinkConnectionsGetResponse{}, err + return VPNSiteLinkConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_vpnsitelinks_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_vpnsitelinks_client.go index d54f0e79f1a4..976118afc201 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_vpnsitelinks_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_vpnsitelinks_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VPNSiteLinksClient contains the methods for the VPNSiteLinks group. @@ -30,8 +31,15 @@ type VPNSiteLinksClient struct { } // NewVPNSiteLinksClient creates a new instance of VPNSiteLinksClient with the specified values. -func NewVPNSiteLinksClient(con *arm.Connection, subscriptionID string) *VPNSiteLinksClient { - return &VPNSiteLinksClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVPNSiteLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VPNSiteLinksClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VPNSiteLinksClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Retrieves the details of a VPN site link. @@ -75,7 +83,7 @@ func (client *VPNSiteLinksClient) getCreateRequest(ctx context.Context, resource return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -85,7 +93,7 @@ func (client *VPNSiteLinksClient) getCreateRequest(ctx context.Context, resource func (client *VPNSiteLinksClient) getHandleResponse(resp *http.Response) (VPNSiteLinksGetResponse, error) { result := VPNSiteLinksGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VPNSiteLink); err != nil { - return VPNSiteLinksGetResponse{}, err + return VPNSiteLinksGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -137,7 +145,7 @@ func (client *VPNSiteLinksClient) listByVPNSiteCreateRequest(ctx context.Context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -147,7 +155,7 @@ func (client *VPNSiteLinksClient) listByVPNSiteCreateRequest(ctx context.Context func (client *VPNSiteLinksClient) listByVPNSiteHandleResponse(resp *http.Response) (VPNSiteLinksListByVPNSiteResponse, error) { result := VPNSiteLinksListByVPNSiteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNSiteLinksResult); err != nil { - return VPNSiteLinksListByVPNSiteResponse{}, err + return VPNSiteLinksListByVPNSiteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_vpnsites_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_vpnsites_client.go index fbf8aae3f4e6..7798602e488a 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_vpnsites_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_vpnsites_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VPNSitesClient contains the methods for the VPNSites group. @@ -31,8 +31,15 @@ type VPNSitesClient struct { } // NewVPNSitesClient creates a new instance of VPNSitesClient with the specified values. -func NewVPNSitesClient(con *arm.Connection, subscriptionID string) *VPNSitesClient { - return &VPNSitesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVPNSitesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VPNSitesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VPNSitesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a VpnSite resource if it doesn't exist else updates the existing VpnSite. @@ -92,7 +99,7 @@ func (client *VPNSitesClient) createOrUpdateCreateRequest(ctx context.Context, r return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, vpnSiteParameters) @@ -168,7 +175,7 @@ func (client *VPNSitesClient) deleteCreateRequest(ctx context.Context, resourceG return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -224,7 +231,7 @@ func (client *VPNSitesClient) getCreateRequest(ctx context.Context, resourceGrou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -234,7 +241,7 @@ func (client *VPNSitesClient) getCreateRequest(ctx context.Context, resourceGrou func (client *VPNSitesClient) getHandleResponse(resp *http.Response) (VPNSitesGetResponse, error) { result := VPNSitesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VPNSite); err != nil { - return VPNSitesGetResponse{}, err + return VPNSitesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -278,7 +285,7 @@ func (client *VPNSitesClient) listCreateRequest(ctx context.Context, options *VP return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -288,7 +295,7 @@ func (client *VPNSitesClient) listCreateRequest(ctx context.Context, options *VP func (client *VPNSitesClient) listHandleResponse(resp *http.Response) (VPNSitesListResponse, error) { result := VPNSitesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNSitesResult); err != nil { - return VPNSitesListResponse{}, err + return VPNSitesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -336,7 +343,7 @@ func (client *VPNSitesClient) listByResourceGroupCreateRequest(ctx context.Conte return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -346,7 +353,7 @@ func (client *VPNSitesClient) listByResourceGroupCreateRequest(ctx context.Conte func (client *VPNSitesClient) listByResourceGroupHandleResponse(resp *http.Response) (VPNSitesListByResourceGroupResponse, error) { result := VPNSitesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListVPNSitesResult); err != nil { - return VPNSitesListByResourceGroupResponse{}, err + return VPNSitesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -401,7 +408,7 @@ func (client *VPNSitesClient) updateTagsCreateRequest(ctx context.Context, resou return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, vpnSiteParameters) @@ -411,7 +418,7 @@ func (client *VPNSitesClient) updateTagsCreateRequest(ctx context.Context, resou func (client *VPNSitesClient) updateTagsHandleResponse(resp *http.Response) (VPNSitesUpdateTagsResponse, error) { result := VPNSitesUpdateTagsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VPNSite); err != nil { - return VPNSitesUpdateTagsResponse{}, err + return VPNSitesUpdateTagsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_vpnsitesconfiguration_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_vpnsitesconfiguration_client.go index a21c245f5c10..77517b76bbfe 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_vpnsitesconfiguration_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_vpnsitesconfiguration_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VPNSitesConfigurationClient contains the methods for the VPNSitesConfiguration group. @@ -31,8 +31,15 @@ type VPNSitesConfigurationClient struct { } // NewVPNSitesConfigurationClient creates a new instance of VPNSitesConfigurationClient with the specified values. -func NewVPNSitesConfigurationClient(con *arm.Connection, subscriptionID string) *VPNSitesConfigurationClient { - return &VPNSitesConfigurationClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVPNSitesConfigurationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VPNSitesConfigurationClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VPNSitesConfigurationClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginDownload - Gives the sas-url to download the configurations for vpn-sites in a resource group. @@ -92,7 +99,7 @@ func (client *VPNSitesConfigurationClient) downloadCreateRequest(ctx context.Con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, request) diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_webapplicationfirewallpolicies_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_webapplicationfirewallpolicies_client.go index 7091a437e3c1..d73a5842228c 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_webapplicationfirewallpolicies_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_webapplicationfirewallpolicies_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // WebApplicationFirewallPoliciesClient contains the methods for the WebApplicationFirewallPolicies group. @@ -31,8 +31,15 @@ type WebApplicationFirewallPoliciesClient struct { } // NewWebApplicationFirewallPoliciesClient creates a new instance of WebApplicationFirewallPoliciesClient with the specified values. -func NewWebApplicationFirewallPoliciesClient(con *arm.Connection, subscriptionID string) *WebApplicationFirewallPoliciesClient { - return &WebApplicationFirewallPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWebApplicationFirewallPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WebApplicationFirewallPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WebApplicationFirewallPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or update policy with specified rule set name within a resource group. @@ -72,7 +79,7 @@ func (client *WebApplicationFirewallPoliciesClient) createOrUpdateCreateRequest( return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, runtime.MarshalAsJSON(req, parameters) @@ -82,7 +89,7 @@ func (client *WebApplicationFirewallPoliciesClient) createOrUpdateCreateRequest( func (client *WebApplicationFirewallPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (WebApplicationFirewallPoliciesCreateOrUpdateResponse, error) { result := WebApplicationFirewallPoliciesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebApplicationFirewallPolicy); err != nil { - return WebApplicationFirewallPoliciesCreateOrUpdateResponse{}, err + return WebApplicationFirewallPoliciesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -157,7 +164,7 @@ func (client *WebApplicationFirewallPoliciesClient) deleteCreateRequest(ctx cont return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -213,7 +220,7 @@ func (client *WebApplicationFirewallPoliciesClient) getCreateRequest(ctx context return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -223,7 +230,7 @@ func (client *WebApplicationFirewallPoliciesClient) getCreateRequest(ctx context func (client *WebApplicationFirewallPoliciesClient) getHandleResponse(resp *http.Response) (WebApplicationFirewallPoliciesGetResponse, error) { result := WebApplicationFirewallPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebApplicationFirewallPolicy); err != nil { - return WebApplicationFirewallPoliciesGetResponse{}, err + return WebApplicationFirewallPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -271,7 +278,7 @@ func (client *WebApplicationFirewallPoliciesClient) listCreateRequest(ctx contex return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -281,7 +288,7 @@ func (client *WebApplicationFirewallPoliciesClient) listCreateRequest(ctx contex func (client *WebApplicationFirewallPoliciesClient) listHandleResponse(resp *http.Response) (WebApplicationFirewallPoliciesListResponse, error) { result := WebApplicationFirewallPoliciesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebApplicationFirewallPolicyListResult); err != nil { - return WebApplicationFirewallPoliciesListResponse{}, err + return WebApplicationFirewallPoliciesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -325,7 +332,7 @@ func (client *WebApplicationFirewallPoliciesClient) listAllCreateRequest(ctx con return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -335,7 +342,7 @@ func (client *WebApplicationFirewallPoliciesClient) listAllCreateRequest(ctx con func (client *WebApplicationFirewallPoliciesClient) listAllHandleResponse(resp *http.Response) (WebApplicationFirewallPoliciesListAllResponse, error) { result := WebApplicationFirewallPoliciesListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebApplicationFirewallPolicyListResult); err != nil { - return WebApplicationFirewallPoliciesListAllResponse{}, err + return WebApplicationFirewallPoliciesListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/network/armnetwork/zz_generated_webcategories_client.go b/sdk/resourcemanager/network/armnetwork/zz_generated_webcategories_client.go index 0c453bae3ce8..61e50ce95d65 100644 --- a/sdk/resourcemanager/network/armnetwork/zz_generated_webcategories_client.go +++ b/sdk/resourcemanager/network/armnetwork/zz_generated_webcategories_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // WebCategoriesClient contains the methods for the WebCategories group. @@ -30,8 +31,15 @@ type WebCategoriesClient struct { } // NewWebCategoriesClient creates a new instance of WebCategoriesClient with the specified values. -func NewWebCategoriesClient(con *arm.Connection, subscriptionID string) *WebCategoriesClient { - return &WebCategoriesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWebCategoriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WebCategoriesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WebCategoriesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the specified Azure Web Category. @@ -67,7 +75,7 @@ func (client *WebCategoriesClient) getCreateRequest(ctx context.Context, name st return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") if options != nil && options.Expand != nil { reqQP.Set("$expand", *options.Expand) } @@ -80,7 +88,7 @@ func (client *WebCategoriesClient) getCreateRequest(ctx context.Context, name st func (client *WebCategoriesClient) getHandleResponse(resp *http.Response) (WebCategoriesGetResponse, error) { result := WebCategoriesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AzureWebCategory); err != nil { - return WebCategoriesGetResponse{}, err + return WebCategoriesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -124,7 +132,7 @@ func (client *WebCategoriesClient) listBySubscriptionCreateRequest(ctx context.C return nil, err } reqQP := req.Raw().URL.Query() - reqQP.Set("api-version", "2021-03-01") + reqQP.Set("api-version", "2021-05-01") req.Raw().URL.RawQuery = reqQP.Encode() req.Raw().Header.Set("Accept", "application/json") return req, nil @@ -134,7 +142,7 @@ func (client *WebCategoriesClient) listBySubscriptionCreateRequest(ctx context.C func (client *WebCategoriesClient) listBySubscriptionHandleResponse(resp *http.Response) (WebCategoriesListBySubscriptionResponse, error) { result := WebCategoriesListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AzureWebCategoryListResult); err != nil { - return WebCategoriesListBySubscriptionResponse{}, err + return WebCategoriesListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/notificationhubs/armnotificationhubs/CHANGELOG.md b/sdk/resourcemanager/notificationhubs/armnotificationhubs/CHANGELOG.md index e4f3d9f035c1..6ee9f3587c1a 100644 --- a/sdk/resourcemanager/notificationhubs/armnotificationhubs/CHANGELOG.md +++ b/sdk/resourcemanager/notificationhubs/armnotificationhubs/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-26) diff --git a/sdk/resourcemanager/notificationhubs/armnotificationhubs/README.md b/sdk/resourcemanager/notificationhubs/armnotificationhubs/README.md index cd89580b6d4c..f1c2c839fe11 100644 --- a/sdk/resourcemanager/notificationhubs/armnotificationhubs/README.md +++ b/sdk/resourcemanager/notificationhubs/armnotificationhubs/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Notification Hubs +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Notification Hubs modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armnotificationhubs.NewNamespacesClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Notification Hubs modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armnotificationhubs.NewNamespacesClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armnotificationhubs.NewNamespacesClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/notificationhubs/armnotificationhubs/autorest.md b/sdk/resourcemanager/notificationhubs/armnotificationhubs/autorest.md index 736ea5635b05..11452bd2d45c 100644 --- a/sdk/resourcemanager/notificationhubs/armnotificationhubs/autorest.md +++ b/sdk/resourcemanager/notificationhubs/armnotificationhubs/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/2a5304178ab7416e40622808dea5b630fb7854d9/specification/notificationhubs/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/2a5304178ab7416e40622808dea5b630fb7854d9/specification/notificationhubs/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/notificationhubs/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/notificationhubs/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/notificationhubs/armnotificationhubs/go.mod b/sdk/resourcemanager/notificationhubs/armnotificationhubs/go.mod index cc384ed9ddc4..18070e5e038e 100644 --- a/sdk/resourcemanager/notificationhubs/armnotificationhubs/go.mod +++ b/sdk/resourcemanager/notificationhubs/armnotificationhubs/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/notificationhubs/ar go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.2.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/notificationhubs/armnotificationhubs/go.sum b/sdk/resourcemanager/notificationhubs/armnotificationhubs/go.sum index c8ff7a2143ad..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/notificationhubs/armnotificationhubs/go.sum +++ b/sdk/resourcemanager/notificationhubs/armnotificationhubs/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible h1:iCb2tuoEm3N7ZpUDOvu1Yxl1B3iOVDmaD6weaRuIPzs= -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_constants.go b/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_constants.go index 511c519d44ce..6442663e4029 100644 --- a/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_constants.go +++ b/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_constants.go @@ -10,7 +10,7 @@ package armnotificationhubs const ( module = "armnotificationhubs" - version = "v0.1.1" + version = "v0.2.0" ) type AccessRights string diff --git a/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_models.go b/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_models.go index ac991cbc4e13..258132933864 100644 --- a/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_models.go +++ b/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_models.go @@ -10,10 +10,9 @@ package armnotificationhubs import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // AdmCredential - Description of a NotificationHub AdmCredential. @@ -318,7 +317,7 @@ type NamespaceProperties struct { // MarshalJSON implements the json.Marshaller interface for type NamespaceProperties. func (n NamespaceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(n.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", n.CreatedAt) populate(objectMap, "critical", n.Critical) populate(objectMap, "dataCenter", n.DataCenter) populate(objectMap, "enabled", n.Enabled) @@ -331,7 +330,7 @@ func (n NamespaceProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "serviceBusEndpoint", n.ServiceBusEndpoint) populate(objectMap, "status", n.Status) populate(objectMap, "subscriptionId", n.SubscriptionID) - populate(objectMap, "updatedAt", (*timeRFC3339)(n.UpdatedAt)) + populateTimeRFC3339(objectMap, "updatedAt", n.UpdatedAt) return json.Marshal(objectMap) } @@ -345,9 +344,7 @@ func (n *NamespaceProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - n.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &n.CreatedAt) delete(rawMsg, key) case "critical": err = unpopulate(val, &n.Critical) @@ -386,9 +383,7 @@ func (n *NamespaceProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &n.SubscriptionID) delete(rawMsg, key) case "updatedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - n.UpdatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &n.UpdatedAt) delete(rawMsg, key) } if err != nil { diff --git a/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_namespaces_client.go b/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_namespaces_client.go index e010f011df4d..f1657728a6d1 100644 --- a/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_namespaces_client.go +++ b/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_namespaces_client.go @@ -11,14 +11,14 @@ package armnotificationhubs import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NamespacesClient contains the methods for the Namespaces group. @@ -30,8 +30,15 @@ type NamespacesClient struct { } // NewNamespacesClient creates a new instance of NamespacesClient with the specified values. -func NewNamespacesClient(con *arm.Connection, subscriptionID string) *NamespacesClient { - return &NamespacesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNamespacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NamespacesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NamespacesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckAvailability - Checks the availability of the given service namespace across all Azure subscriptions. This is useful because the domain name is @@ -74,7 +81,7 @@ func (client *NamespacesClient) checkAvailabilityCreateRequest(ctx context.Conte func (client *NamespacesClient) checkAvailabilityHandleResponse(resp *http.Response) (NamespacesCheckAvailabilityResponse, error) { result := NamespacesCheckAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CheckAvailabilityResult); err != nil { - return NamespacesCheckAvailabilityResponse{}, err + return NamespacesCheckAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -138,7 +145,7 @@ func (client *NamespacesClient) createOrUpdateCreateRequest(ctx context.Context, func (client *NamespacesClient) createOrUpdateHandleResponse(resp *http.Response) (NamespacesCreateOrUpdateResponse, error) { result := NamespacesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NamespaceResource); err != nil { - return NamespacesCreateOrUpdateResponse{}, err + return NamespacesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -206,7 +213,7 @@ func (client *NamespacesClient) createOrUpdateAuthorizationRuleCreateRequest(ctx func (client *NamespacesClient) createOrUpdateAuthorizationRuleHandleResponse(resp *http.Response) (NamespacesCreateOrUpdateAuthorizationRuleResponse, error) { result := NamespacesCreateOrUpdateAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SharedAccessAuthorizationRuleResource); err != nil { - return NamespacesCreateOrUpdateAuthorizationRuleResponse{}, err + return NamespacesCreateOrUpdateAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -402,7 +409,7 @@ func (client *NamespacesClient) getCreateRequest(ctx context.Context, resourceGr func (client *NamespacesClient) getHandleResponse(resp *http.Response) (NamespacesGetResponse, error) { result := NamespacesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NamespaceResource); err != nil { - return NamespacesGetResponse{}, err + return NamespacesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -470,7 +477,7 @@ func (client *NamespacesClient) getAuthorizationRuleCreateRequest(ctx context.Co func (client *NamespacesClient) getAuthorizationRuleHandleResponse(resp *http.Response) (NamespacesGetAuthorizationRuleResponse, error) { result := NamespacesGetAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SharedAccessAuthorizationRuleResource); err != nil { - return NamespacesGetAuthorizationRuleResponse{}, err + return NamespacesGetAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -527,7 +534,7 @@ func (client *NamespacesClient) listCreateRequest(ctx context.Context, resourceG func (client *NamespacesClient) listHandleResponse(resp *http.Response) (NamespacesListResponse, error) { result := NamespacesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NamespaceListResult); err != nil { - return NamespacesListResponse{}, err + return NamespacesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -580,7 +587,7 @@ func (client *NamespacesClient) listAllCreateRequest(ctx context.Context, option func (client *NamespacesClient) listAllHandleResponse(resp *http.Response) (NamespacesListAllResponse, error) { result := NamespacesListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NamespaceListResult); err != nil { - return NamespacesListAllResponse{}, err + return NamespacesListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -641,7 +648,7 @@ func (client *NamespacesClient) listAuthorizationRulesCreateRequest(ctx context. func (client *NamespacesClient) listAuthorizationRulesHandleResponse(resp *http.Response) (NamespacesListAuthorizationRulesResponse, error) { result := NamespacesListAuthorizationRulesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SharedAccessAuthorizationRuleListResult); err != nil { - return NamespacesListAuthorizationRulesResponse{}, err + return NamespacesListAuthorizationRulesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -709,7 +716,7 @@ func (client *NamespacesClient) listKeysCreateRequest(ctx context.Context, resou func (client *NamespacesClient) listKeysHandleResponse(resp *http.Response) (NamespacesListKeysResponse, error) { result := NamespacesListKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SharedAccessAuthorizationRuleListResult); err != nil { - return NamespacesListKeysResponse{}, err + return NamespacesListKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -773,7 +780,7 @@ func (client *NamespacesClient) patchCreateRequest(ctx context.Context, resource func (client *NamespacesClient) patchHandleResponse(resp *http.Response) (NamespacesPatchResponse, error) { result := NamespacesPatchResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NamespaceResource); err != nil { - return NamespacesPatchResponse{}, err + return NamespacesPatchResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -841,7 +848,7 @@ func (client *NamespacesClient) regenerateKeysCreateRequest(ctx context.Context, func (client *NamespacesClient) regenerateKeysHandleResponse(resp *http.Response) (NamespacesRegenerateKeysResponse, error) { result := NamespacesRegenerateKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListKeys); err != nil { - return NamespacesRegenerateKeysResponse{}, err + return NamespacesRegenerateKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_notificationhubs_client.go b/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_notificationhubs_client.go index af12c9aa5965..a6acfcbeaf7d 100644 --- a/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_notificationhubs_client.go +++ b/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_notificationhubs_client.go @@ -11,13 +11,14 @@ package armnotificationhubs import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NotificationHubsClient contains the methods for the NotificationHubs group. @@ -29,8 +30,15 @@ type NotificationHubsClient struct { } // NewNotificationHubsClient creates a new instance of NotificationHubsClient with the specified values. -func NewNotificationHubsClient(con *arm.Connection, subscriptionID string) *NotificationHubsClient { - return &NotificationHubsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNotificationHubsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NotificationHubsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NotificationHubsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNotificationHubAvailability - Checks the availability of the given notificationHub in a namespace. @@ -80,7 +88,7 @@ func (client *NotificationHubsClient) checkNotificationHubAvailabilityCreateRequ func (client *NotificationHubsClient) checkNotificationHubAvailabilityHandleResponse(resp *http.Response) (NotificationHubsCheckNotificationHubAvailabilityResponse, error) { result := NotificationHubsCheckNotificationHubAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CheckAvailabilityResult); err != nil { - return NotificationHubsCheckNotificationHubAvailabilityResponse{}, err + return NotificationHubsCheckNotificationHubAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -148,7 +156,7 @@ func (client *NotificationHubsClient) createOrUpdateCreateRequest(ctx context.Co func (client *NotificationHubsClient) createOrUpdateHandleResponse(resp *http.Response) (NotificationHubsCreateOrUpdateResponse, error) { result := NotificationHubsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NotificationHubResource); err != nil { - return NotificationHubsCreateOrUpdateResponse{}, err + return NotificationHubsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -220,7 +228,7 @@ func (client *NotificationHubsClient) createOrUpdateAuthorizationRuleCreateReque func (client *NotificationHubsClient) createOrUpdateAuthorizationRuleHandleResponse(resp *http.Response) (NotificationHubsCreateOrUpdateAuthorizationRuleResponse, error) { result := NotificationHubsCreateOrUpdateAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SharedAccessAuthorizationRuleResource); err != nil { - return NotificationHubsCreateOrUpdateAuthorizationRuleResponse{}, err + return NotificationHubsCreateOrUpdateAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -291,7 +299,7 @@ func (client *NotificationHubsClient) debugSendCreateRequest(ctx context.Context func (client *NotificationHubsClient) debugSendHandleResponse(resp *http.Response) (NotificationHubsDebugSendResponse, error) { result := NotificationHubsDebugSendResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DebugSendResponse); err != nil { - return NotificationHubsDebugSendResponse{}, err + return NotificationHubsDebugSendResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -479,7 +487,7 @@ func (client *NotificationHubsClient) getCreateRequest(ctx context.Context, reso func (client *NotificationHubsClient) getHandleResponse(resp *http.Response) (NotificationHubsGetResponse, error) { result := NotificationHubsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NotificationHubResource); err != nil { - return NotificationHubsGetResponse{}, err + return NotificationHubsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -551,7 +559,7 @@ func (client *NotificationHubsClient) getAuthorizationRuleCreateRequest(ctx cont func (client *NotificationHubsClient) getAuthorizationRuleHandleResponse(resp *http.Response) (NotificationHubsGetAuthorizationRuleResponse, error) { result := NotificationHubsGetAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SharedAccessAuthorizationRuleResource); err != nil { - return NotificationHubsGetAuthorizationRuleResponse{}, err + return NotificationHubsGetAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -619,7 +627,7 @@ func (client *NotificationHubsClient) getPnsCredentialsCreateRequest(ctx context func (client *NotificationHubsClient) getPnsCredentialsHandleResponse(resp *http.Response) (NotificationHubsGetPnsCredentialsResponse, error) { result := NotificationHubsGetPnsCredentialsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PnsCredentialsResource); err != nil { - return NotificationHubsGetPnsCredentialsResponse{}, err + return NotificationHubsGetPnsCredentialsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -680,7 +688,7 @@ func (client *NotificationHubsClient) listCreateRequest(ctx context.Context, res func (client *NotificationHubsClient) listHandleResponse(resp *http.Response) (NotificationHubsListResponse, error) { result := NotificationHubsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NotificationHubListResult); err != nil { - return NotificationHubsListResponse{}, err + return NotificationHubsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -745,7 +753,7 @@ func (client *NotificationHubsClient) listAuthorizationRulesCreateRequest(ctx co func (client *NotificationHubsClient) listAuthorizationRulesHandleResponse(resp *http.Response) (NotificationHubsListAuthorizationRulesResponse, error) { result := NotificationHubsListAuthorizationRulesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SharedAccessAuthorizationRuleListResult); err != nil { - return NotificationHubsListAuthorizationRulesResponse{}, err + return NotificationHubsListAuthorizationRulesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -817,7 +825,7 @@ func (client *NotificationHubsClient) listKeysCreateRequest(ctx context.Context, func (client *NotificationHubsClient) listKeysHandleResponse(resp *http.Response) (NotificationHubsListKeysResponse, error) { result := NotificationHubsListKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListKeys); err != nil { - return NotificationHubsListKeysResponse{}, err + return NotificationHubsListKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -888,7 +896,7 @@ func (client *NotificationHubsClient) patchCreateRequest(ctx context.Context, re func (client *NotificationHubsClient) patchHandleResponse(resp *http.Response) (NotificationHubsPatchResponse, error) { result := NotificationHubsPatchResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NotificationHubResource); err != nil { - return NotificationHubsPatchResponse{}, err + return NotificationHubsPatchResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -960,7 +968,7 @@ func (client *NotificationHubsClient) regenerateKeysCreateRequest(ctx context.Co func (client *NotificationHubsClient) regenerateKeysHandleResponse(resp *http.Response) (NotificationHubsRegenerateKeysResponse, error) { result := NotificationHubsRegenerateKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListKeys); err != nil { - return NotificationHubsRegenerateKeysResponse{}, err + return NotificationHubsRegenerateKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_operations_client.go b/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_operations_client.go index 4ba85102c070..3c3844e46243 100644 --- a/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_operations_client.go +++ b/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armnotificationhubs import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available NotificationHubs REST API operations. @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_pagers.go b/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_pagers.go index ebfc75754ca3..124c26d61949 100644 --- a/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_pagers.go +++ b/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armnotificationhubs import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // NamespacesListAllPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_pollers.go b/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_pollers.go index 65e6ba7287e0..919c0a925816 100644 --- a/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_pollers.go +++ b/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armnotificationhubs import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // NamespacesDeletePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_response_types.go b/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_response_types.go index dad4dff2930e..befc86419448 100644 --- a/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_response_types.go +++ b/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armnotificationhubs import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // NamespacesCheckAvailabilityResponse contains the response from method Namespaces.CheckAvailability. @@ -68,6 +67,8 @@ type NamespacesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NamespacesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NamespacesDeleteResponse, error) { respType := NamespacesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_time_rfc3339.go b/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_time_rfc3339.go index ffb676153bd9..ea9ef079471f 100644 --- a/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/notificationhubs/armnotificationhubs/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armnotificationhubs import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/CHANGELOG.md b/sdk/resourcemanager/operationalinsights/armoperationalinsights/CHANGELOG.md index 2f63fa33a485..65fa4b9dba03 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/CHANGELOG.md +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-10-08) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/operationalinsights/armoperationalinsights". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/operationalinsights/armoperationalinsights") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/README.md b/sdk/resourcemanager/operationalinsights/armoperationalinsights/README.md index 5331d20d3a51..1ec64ab7343a 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/README.md +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Operational Insights +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Operational Insights modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armoperationalinsights.NewStorageInsightConfigsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Operational Insights modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armoperationalinsights.NewStorageInsightConfigsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armoperationalinsights.NewStorageInsightConfigsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/autorest.md b/sdk/resourcemanager/operationalinsights/armoperationalinsights/autorest.md index de90c9165f6c..11e2425fad93 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/autorest.md +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/operationalinsights/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/operationalinsights/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/operationalinsights/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/operationalinsights/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/go.mod b/sdk/resourcemanager/operationalinsights/armoperationalinsights/go.mod index 65c67a3bc119..e2becabcba1d 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/go.mod +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/operationalinsights go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/go.sum b/sdk/resourcemanager/operationalinsights/armoperationalinsights/go.sum index 4f0fb709cf31..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/go.sum +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible h1:Cw16jiP4dI+CK761aq44ol4RV5dUiIIXky1+EKpoiVM= -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_availableservicetiers_client.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_availableservicetiers_client.go index 401aab14f8ad..bd35f862767d 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_availableservicetiers_client.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_availableservicetiers_client.go @@ -11,13 +11,14 @@ package armoperationalinsights import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AvailableServiceTiersClient contains the methods for the AvailableServiceTiers group. @@ -29,8 +30,15 @@ type AvailableServiceTiersClient struct { } // NewAvailableServiceTiersClient creates a new instance of AvailableServiceTiersClient with the specified values. -func NewAvailableServiceTiersClient(con *arm.Connection, subscriptionID string) *AvailableServiceTiersClient { - return &AvailableServiceTiersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAvailableServiceTiersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AvailableServiceTiersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AvailableServiceTiersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByWorkspace - Gets the available service tiers for the workspace. @@ -80,7 +88,7 @@ func (client *AvailableServiceTiersClient) listByWorkspaceCreateRequest(ctx cont func (client *AvailableServiceTiersClient) listByWorkspaceHandleResponse(resp *http.Response) (AvailableServiceTiersListByWorkspaceResponse, error) { result := AvailableServiceTiersListByWorkspaceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailableServiceTierArray); err != nil { - return AvailableServiceTiersListByWorkspaceResponse{}, err + return AvailableServiceTiersListByWorkspaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_clusters_client.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_clusters_client.go index c033902c0517..0b81628d6624 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_clusters_client.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_clusters_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ClustersClient contains the methods for the Clusters group. @@ -31,8 +31,15 @@ type ClustersClient struct { } // NewClustersClient creates a new instance of ClustersClient with the specified values. -func NewClustersClient(con *arm.Connection, subscriptionID string) *ClustersClient { - return &ClustersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ClustersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ClustersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update a Log Analytics cluster. @@ -234,7 +241,7 @@ func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGrou func (client *ClustersClient) getHandleResponse(resp *http.Response) (ClustersGetResponse, error) { result := ClustersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Cluster); err != nil { - return ClustersGetResponse{}, err + return ClustersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -288,7 +295,7 @@ func (client *ClustersClient) listCreateRequest(ctx context.Context, options *Cl func (client *ClustersClient) listHandleResponse(resp *http.Response) (ClustersListResponse, error) { result := ClustersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ClusterListResult); err != nil { - return ClustersListResponse{}, err + return ClustersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -346,7 +353,7 @@ func (client *ClustersClient) listByResourceGroupCreateRequest(ctx context.Conte func (client *ClustersClient) listByResourceGroupHandleResponse(resp *http.Response) (ClustersListByResourceGroupResponse, error) { result := ClustersListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ClusterListResult); err != nil { - return ClustersListByResourceGroupResponse{}, err + return ClustersListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -411,7 +418,7 @@ func (client *ClustersClient) updateCreateRequest(ctx context.Context, resourceG func (client *ClustersClient) updateHandleResponse(resp *http.Response) (ClustersUpdateResponse, error) { result := ClustersUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Cluster); err != nil { - return ClustersUpdateResponse{}, err + return ClustersUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_constants.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_constants.go index 8a2304bed3bb..b052e3279170 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_constants.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_constants.go @@ -10,7 +10,7 @@ package armoperationalinsights const ( module = "armoperationalinsights" - version = "v0.1.0" + version = "v0.2.0" ) // BillingType - Configures whether billing will be only on the cluster or each workspace will be billed by its proportional use. This does not change the diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_dataexports_client.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_dataexports_client.go index 939c6e5c12eb..4bf1a0be558c 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_dataexports_client.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_dataexports_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DataExportsClient contains the methods for the DataExports group. @@ -30,8 +31,15 @@ type DataExportsClient struct { } // NewDataExportsClient creates a new instance of DataExportsClient with the specified values. -func NewDataExportsClient(con *arm.Connection, subscriptionID string) *DataExportsClient { - return &DataExportsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDataExportsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DataExportsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DataExportsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update a data export. @@ -85,7 +93,7 @@ func (client *DataExportsClient) createOrUpdateCreateRequest(ctx context.Context func (client *DataExportsClient) createOrUpdateHandleResponse(resp *http.Response) (DataExportsCreateOrUpdateResponse, error) { result := DataExportsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataExport); err != nil { - return DataExportsCreateOrUpdateResponse{}, err + return DataExportsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *DataExportsClient) getCreateRequest(ctx context.Context, resourceG func (client *DataExportsClient) getHandleResponse(resp *http.Response) (DataExportsGetResponse, error) { result := DataExportsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataExport); err != nil { - return DataExportsGetResponse{}, err + return DataExportsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -279,7 +287,7 @@ func (client *DataExportsClient) listByWorkspaceCreateRequest(ctx context.Contex func (client *DataExportsClient) listByWorkspaceHandleResponse(resp *http.Response) (DataExportsListByWorkspaceResponse, error) { result := DataExportsListByWorkspaceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataExportListResult); err != nil { - return DataExportsListByWorkspaceResponse{}, err + return DataExportsListByWorkspaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_datasources_client.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_datasources_client.go index f2ceb7d4015c..51bee8ee8f2a 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_datasources_client.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_datasources_client.go @@ -11,13 +11,14 @@ package armoperationalinsights import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DataSourcesClient contains the methods for the DataSources group. @@ -29,8 +30,15 @@ type DataSourcesClient struct { } // NewDataSourcesClient creates a new instance of DataSourcesClient with the specified values. -func NewDataSourcesClient(con *arm.Connection, subscriptionID string) *DataSourcesClient { - return &DataSourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDataSourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DataSourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DataSourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update a data source. @@ -84,7 +92,7 @@ func (client *DataSourcesClient) createOrUpdateCreateRequest(ctx context.Context func (client *DataSourcesClient) createOrUpdateHandleResponse(resp *http.Response) (DataSourcesCreateOrUpdateResponse, error) { result := DataSourcesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataSource); err != nil { - return DataSourcesCreateOrUpdateResponse{}, err + return DataSourcesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -210,7 +218,7 @@ func (client *DataSourcesClient) getCreateRequest(ctx context.Context, resourceG func (client *DataSourcesClient) getHandleResponse(resp *http.Response) (DataSourcesGetResponse, error) { result := DataSourcesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataSource); err != nil { - return DataSourcesGetResponse{}, err + return DataSourcesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -275,7 +283,7 @@ func (client *DataSourcesClient) listByWorkspaceCreateRequest(ctx context.Contex func (client *DataSourcesClient) listByWorkspaceHandleResponse(resp *http.Response) (DataSourcesListByWorkspaceResponse, error) { result := DataSourcesListByWorkspaceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataSourceListResult); err != nil { - return DataSourcesListByWorkspaceResponse{}, err + return DataSourcesListByWorkspaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_deletedworkspaces_client.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_deletedworkspaces_client.go index eb70182a683d..b4c322775928 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_deletedworkspaces_client.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_deletedworkspaces_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DeletedWorkspacesClient contains the methods for the DeletedWorkspaces group. @@ -30,8 +31,15 @@ type DeletedWorkspacesClient struct { } // NewDeletedWorkspacesClient creates a new instance of DeletedWorkspacesClient with the specified values. -func NewDeletedWorkspacesClient(con *arm.Connection, subscriptionID string) *DeletedWorkspacesClient { - return &DeletedWorkspacesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDeletedWorkspacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DeletedWorkspacesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DeletedWorkspacesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets recently deleted workspaces in a subscription, available for recovery. @@ -73,7 +81,7 @@ func (client *DeletedWorkspacesClient) listCreateRequest(ctx context.Context, op func (client *DeletedWorkspacesClient) listHandleResponse(resp *http.Response) (DeletedWorkspacesListResponse, error) { result := DeletedWorkspacesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceListResult); err != nil { - return DeletedWorkspacesListResponse{}, err + return DeletedWorkspacesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -134,7 +142,7 @@ func (client *DeletedWorkspacesClient) listByResourceGroupCreateRequest(ctx cont func (client *DeletedWorkspacesClient) listByResourceGroupHandleResponse(resp *http.Response) (DeletedWorkspacesListByResourceGroupResponse, error) { result := DeletedWorkspacesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceListResult); err != nil { - return DeletedWorkspacesListByResourceGroupResponse{}, err + return DeletedWorkspacesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_gateways_client.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_gateways_client.go index d7f8bd281d4d..0037cd082bb4 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_gateways_client.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_gateways_client.go @@ -11,13 +11,14 @@ package armoperationalinsights import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // GatewaysClient contains the methods for the Gateways group. @@ -29,8 +30,15 @@ type GatewaysClient struct { } // NewGatewaysClient creates a new instance of GatewaysClient with the specified values. -func NewGatewaysClient(con *arm.Connection, subscriptionID string) *GatewaysClient { - return &GatewaysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewGatewaysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *GatewaysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &GatewaysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Delete - Delete a Log Analytics gateway. diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_intelligencepacks_client.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_intelligencepacks_client.go index 02e972045997..6555f578bbfc 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_intelligencepacks_client.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_intelligencepacks_client.go @@ -11,13 +11,14 @@ package armoperationalinsights import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // IntelligencePacksClient contains the methods for the IntelligencePacks group. @@ -29,8 +30,15 @@ type IntelligencePacksClient struct { } // NewIntelligencePacksClient creates a new instance of IntelligencePacksClient with the specified values. -func NewIntelligencePacksClient(con *arm.Connection, subscriptionID string) *IntelligencePacksClient { - return &IntelligencePacksClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIntelligencePacksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IntelligencePacksClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IntelligencePacksClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Disable - Disables an intelligence pack for a given workspace. @@ -196,7 +204,7 @@ func (client *IntelligencePacksClient) listCreateRequest(ctx context.Context, re func (client *IntelligencePacksClient) listHandleResponse(resp *http.Response) (IntelligencePacksListResponse, error) { result := IntelligencePacksListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IntelligencePackArray); err != nil { - return IntelligencePacksListResponse{}, err + return IntelligencePacksListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_linkedservices_client.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_linkedservices_client.go index 41f9959b9ac6..ea361e1848f1 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_linkedservices_client.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_linkedservices_client.go @@ -11,14 +11,14 @@ package armoperationalinsights import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LinkedServicesClient contains the methods for the LinkedServices group. @@ -30,8 +30,15 @@ type LinkedServicesClient struct { } // NewLinkedServicesClient creates a new instance of LinkedServicesClient with the specified values. -func NewLinkedServicesClient(con *arm.Connection, subscriptionID string) *LinkedServicesClient { - return &LinkedServicesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLinkedServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LinkedServicesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LinkedServicesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update a linked service. @@ -243,7 +250,7 @@ func (client *LinkedServicesClient) getCreateRequest(ctx context.Context, resour func (client *LinkedServicesClient) getHandleResponse(resp *http.Response) (LinkedServicesGetResponse, error) { result := LinkedServicesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LinkedService); err != nil { - return LinkedServicesGetResponse{}, err + return LinkedServicesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -307,7 +314,7 @@ func (client *LinkedServicesClient) listByWorkspaceCreateRequest(ctx context.Con func (client *LinkedServicesClient) listByWorkspaceHandleResponse(resp *http.Response) (LinkedServicesListByWorkspaceResponse, error) { result := LinkedServicesListByWorkspaceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LinkedServiceListResult); err != nil { - return LinkedServicesListByWorkspaceResponse{}, err + return LinkedServicesListByWorkspaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_linkedstorageaccounts_client.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_linkedstorageaccounts_client.go index 8f7c14d4ccec..699f82d9b06b 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_linkedstorageaccounts_client.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_linkedstorageaccounts_client.go @@ -11,13 +11,14 @@ package armoperationalinsights import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LinkedStorageAccountsClient contains the methods for the LinkedStorageAccounts group. @@ -29,8 +30,15 @@ type LinkedStorageAccountsClient struct { } // NewLinkedStorageAccountsClient creates a new instance of LinkedStorageAccountsClient with the specified values. -func NewLinkedStorageAccountsClient(con *arm.Connection, subscriptionID string) *LinkedStorageAccountsClient { - return &LinkedStorageAccountsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLinkedStorageAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LinkedStorageAccountsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LinkedStorageAccountsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or Update a link relation between current workspace and a group of storage accounts of a specific data source type. @@ -84,7 +92,7 @@ func (client *LinkedStorageAccountsClient) createOrUpdateCreateRequest(ctx conte func (client *LinkedStorageAccountsClient) createOrUpdateHandleResponse(resp *http.Response) (LinkedStorageAccountsCreateOrUpdateResponse, error) { result := LinkedStorageAccountsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LinkedStorageAccountsResource); err != nil { - return LinkedStorageAccountsCreateOrUpdateResponse{}, err + return LinkedStorageAccountsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -210,7 +218,7 @@ func (client *LinkedStorageAccountsClient) getCreateRequest(ctx context.Context, func (client *LinkedStorageAccountsClient) getHandleResponse(resp *http.Response) (LinkedStorageAccountsGetResponse, error) { result := LinkedStorageAccountsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LinkedStorageAccountsResource); err != nil { - return LinkedStorageAccountsGetResponse{}, err + return LinkedStorageAccountsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -274,7 +282,7 @@ func (client *LinkedStorageAccountsClient) listByWorkspaceCreateRequest(ctx cont func (client *LinkedStorageAccountsClient) listByWorkspaceHandleResponse(resp *http.Response) (LinkedStorageAccountsListByWorkspaceResponse, error) { result := LinkedStorageAccountsListByWorkspaceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LinkedStorageAccountsListResult); err != nil { - return LinkedStorageAccountsListByWorkspaceResponse{}, err + return LinkedStorageAccountsListByWorkspaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_managementgroups_client.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_managementgroups_client.go index 0a08dd27ba89..708e2e8d122f 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_managementgroups_client.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_managementgroups_client.go @@ -11,13 +11,14 @@ package armoperationalinsights import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagementGroupsClient contains the methods for the ManagementGroups group. @@ -29,8 +30,15 @@ type ManagementGroupsClient struct { } // NewManagementGroupsClient creates a new instance of ManagementGroupsClient with the specified values. -func NewManagementGroupsClient(con *arm.Connection, subscriptionID string) *ManagementGroupsClient { - return &ManagementGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagementGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagementGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagementGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets a list of management groups connected to a workspace. @@ -80,7 +88,7 @@ func (client *ManagementGroupsClient) listCreateRequest(ctx context.Context, res func (client *ManagementGroupsClient) listHandleResponse(resp *http.Response) (ManagementGroupsListResponse, error) { result := ManagementGroupsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceListManagementGroupsResult); err != nil { - return ManagementGroupsListResponse{}, err + return ManagementGroupsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_models.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_models.go index b92470d76240..7c0c438bab03 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_models.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_models.go @@ -10,10 +10,9 @@ package armoperationalinsights import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // AssociatedWorkspace - The list of Log Analytics workspaces associated with the cluster. @@ -732,8 +731,8 @@ type ManagementGroupProperties struct { // MarshalJSON implements the json.Marshaller interface for type ManagementGroupProperties. func (m ManagementGroupProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "created", (*timeRFC3339)(m.Created)) - populate(objectMap, "dataReceived", (*timeRFC3339)(m.DataReceived)) + populateTimeRFC3339(objectMap, "created", m.Created) + populateTimeRFC3339(objectMap, "dataReceived", m.DataReceived) populate(objectMap, "id", m.ID) populate(objectMap, "isGateway", m.IsGateway) populate(objectMap, "name", m.Name) @@ -753,14 +752,10 @@ func (m *ManagementGroupProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "created": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.Created = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.Created) delete(rawMsg, key) case "dataReceived": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.DataReceived = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.DataReceived) delete(rawMsg, key) case "id": err = unpopulate(val, &m.ID) @@ -1092,14 +1087,14 @@ func (s SearchMetadata) MarshalJSON() ([]byte, error) { populate(objectMap, "coreSummaries", s.CoreSummaries) populate(objectMap, "eTag", s.ETag) populate(objectMap, "id", s.ID) - populate(objectMap, "lastUpdated", (*timeRFC3339)(s.LastUpdated)) + populateTimeRFC3339(objectMap, "lastUpdated", s.LastUpdated) populate(objectMap, "max", s.Max) populate(objectMap, "requestTime", s.RequestTime) populate(objectMap, "resultType", s.ResultType) populate(objectMap, "schema", s.Schema) populate(objectMap, "requestId", s.SearchID) populate(objectMap, "sort", s.Sort) - populate(objectMap, "startTime", (*timeRFC3339)(s.StartTime)) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) populate(objectMap, "status", s.Status) populate(objectMap, "sum", s.Sum) populate(objectMap, "top", s.Top) @@ -1132,9 +1127,7 @@ func (s *SearchMetadata) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.ID) delete(rawMsg, key) case "lastUpdated": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastUpdated = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastUpdated) delete(rawMsg, key) case "max": err = unpopulate(val, &s.Max) @@ -1155,9 +1148,7 @@ func (s *SearchMetadata) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Sort) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &s.Status) @@ -1415,7 +1406,7 @@ func (u UsageMetric) MarshalJSON() ([]byte, error) { populate(objectMap, "currentValue", u.CurrentValue) populate(objectMap, "limit", u.Limit) populate(objectMap, "name", u.Name) - populate(objectMap, "nextResetTime", (*timeRFC3339)(u.NextResetTime)) + populateTimeRFC3339(objectMap, "nextResetTime", u.NextResetTime) populate(objectMap, "quotaPeriod", u.QuotaPeriod) populate(objectMap, "unit", u.Unit) return json.Marshal(objectMap) @@ -1440,9 +1431,7 @@ func (u *UsageMetric) UnmarshalJSON(data []byte) error { err = unpopulate(val, &u.Name) delete(rawMsg, key) case "nextResetTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - u.NextResetTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &u.NextResetTime) delete(rawMsg, key) case "quotaPeriod": err = unpopulate(val, &u.QuotaPeriod) diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_operations_client.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_operations_client.go index e4ae6e3d8af1..f47000f67933 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_operations_client.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armoperationalinsights import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available OperationalInsights Rest API operations. @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_operationstatuses_client.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_operationstatuses_client.go index 42cccb661f52..0e13148f6158 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_operationstatuses_client.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_operationstatuses_client.go @@ -11,13 +11,14 @@ package armoperationalinsights import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // OperationStatusesClient contains the methods for the OperationStatuses group. @@ -29,8 +30,15 @@ type OperationStatusesClient struct { } // NewOperationStatusesClient creates a new instance of OperationStatusesClient with the specified values. -func NewOperationStatusesClient(con *arm.Connection, subscriptionID string) *OperationStatusesClient { - return &OperationStatusesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewOperationStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OperationStatusesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationStatusesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get the status of a long running azure asynchronous operation. @@ -80,7 +88,7 @@ func (client *OperationStatusesClient) getCreateRequest(ctx context.Context, loc func (client *OperationStatusesClient) getHandleResponse(resp *http.Response) (OperationStatusesGetResponse, error) { result := OperationStatusesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationStatus); err != nil { - return OperationStatusesGetResponse{}, err + return OperationStatusesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_pagers.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_pagers.go index 301adcefae1a..b1e2dd8539ac 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_pagers.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armoperationalinsights import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // ClustersListByResourceGroupPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_pollers.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_pollers.go index 9c12c225d68f..1999e41cdabf 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_pollers.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armoperationalinsights import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // ClustersCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_response_types.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_response_types.go index d868a4cfd367..cb305366a2e9 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_response_types.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armoperationalinsights import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // AvailableServiceTiersListByWorkspaceResponse contains the response from method AvailableServiceTiers.ListByWorkspace. @@ -39,6 +38,8 @@ type ClustersCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ClustersCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClustersCreateOrUpdateResponse, error) { respType := ClustersCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Cluster) @@ -89,6 +90,8 @@ type ClustersDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ClustersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClustersDeleteResponse, error) { respType := ClustersDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -320,6 +323,8 @@ type LinkedServicesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LinkedServicesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LinkedServicesCreateOrUpdateResponse, error) { respType := LinkedServicesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LinkedService) @@ -370,6 +375,8 @@ type LinkedServicesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LinkedServicesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LinkedServicesDeleteResponse, error) { respType := LinkedServicesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LinkedService) @@ -680,6 +687,8 @@ type WorkspacesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WorkspacesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WorkspacesCreateOrUpdateResponse, error) { respType := WorkspacesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Workspace) @@ -730,6 +739,8 @@ type WorkspacesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WorkspacesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WorkspacesDeleteResponse, error) { respType := WorkspacesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_savedsearches_client.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_savedsearches_client.go index 33c23e955df5..7b37721c42eb 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_savedsearches_client.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_savedsearches_client.go @@ -11,13 +11,14 @@ package armoperationalinsights import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SavedSearchesClient contains the methods for the SavedSearches group. @@ -29,8 +30,15 @@ type SavedSearchesClient struct { } // NewSavedSearchesClient creates a new instance of SavedSearchesClient with the specified values. -func NewSavedSearchesClient(con *arm.Connection, subscriptionID string) *SavedSearchesClient { - return &SavedSearchesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSavedSearchesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SavedSearchesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SavedSearchesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a saved search for a given workspace. @@ -84,7 +92,7 @@ func (client *SavedSearchesClient) createOrUpdateCreateRequest(ctx context.Conte func (client *SavedSearchesClient) createOrUpdateHandleResponse(resp *http.Response) (SavedSearchesCreateOrUpdateResponse, error) { result := SavedSearchesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SavedSearch); err != nil { - return SavedSearchesCreateOrUpdateResponse{}, err + return SavedSearchesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -210,7 +218,7 @@ func (client *SavedSearchesClient) getCreateRequest(ctx context.Context, resourc func (client *SavedSearchesClient) getHandleResponse(resp *http.Response) (SavedSearchesGetResponse, error) { result := SavedSearchesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SavedSearch); err != nil { - return SavedSearchesGetResponse{}, err + return SavedSearchesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -274,7 +282,7 @@ func (client *SavedSearchesClient) listByWorkspaceCreateRequest(ctx context.Cont func (client *SavedSearchesClient) listByWorkspaceHandleResponse(resp *http.Response) (SavedSearchesListByWorkspaceResponse, error) { result := SavedSearchesListByWorkspaceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SavedSearchesListResult); err != nil { - return SavedSearchesListByWorkspaceResponse{}, err + return SavedSearchesListByWorkspaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_schema_client.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_schema_client.go index dd85b018f1c6..a8a8899d2352 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_schema_client.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_schema_client.go @@ -11,13 +11,14 @@ package armoperationalinsights import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SchemaClient contains the methods for the Schema group. @@ -29,8 +30,15 @@ type SchemaClient struct { } // NewSchemaClient creates a new instance of SchemaClient with the specified values. -func NewSchemaClient(con *arm.Connection, subscriptionID string) *SchemaClient { - return &SchemaClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSchemaClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SchemaClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SchemaClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the schema for a given workspace. @@ -80,7 +88,7 @@ func (client *SchemaClient) getCreateRequest(ctx context.Context, resourceGroupN func (client *SchemaClient) getHandleResponse(resp *http.Response) (SchemaGetResponse, error) { result := SchemaGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SearchGetSchemaResponse); err != nil { - return SchemaGetResponse{}, err + return SchemaGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_sharedkeys_client.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_sharedkeys_client.go index 8222b02fbba5..3a6bc5aea3da 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_sharedkeys_client.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_sharedkeys_client.go @@ -11,13 +11,14 @@ package armoperationalinsights import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SharedKeysClient contains the methods for the SharedKeys group. @@ -29,8 +30,15 @@ type SharedKeysClient struct { } // NewSharedKeysClient creates a new instance of SharedKeysClient with the specified values. -func NewSharedKeysClient(con *arm.Connection, subscriptionID string) *SharedKeysClient { - return &SharedKeysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSharedKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SharedKeysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SharedKeysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetSharedKeys - Gets the shared keys for a workspace. @@ -80,7 +88,7 @@ func (client *SharedKeysClient) getSharedKeysCreateRequest(ctx context.Context, func (client *SharedKeysClient) getSharedKeysHandleResponse(resp *http.Response) (SharedKeysGetSharedKeysResponse, error) { result := SharedKeysGetSharedKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SharedKeys); err != nil { - return SharedKeysGetSharedKeysResponse{}, err + return SharedKeysGetSharedKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -144,7 +152,7 @@ func (client *SharedKeysClient) regenerateCreateRequest(ctx context.Context, res func (client *SharedKeysClient) regenerateHandleResponse(resp *http.Response) (SharedKeysRegenerateResponse, error) { result := SharedKeysRegenerateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SharedKeys); err != nil { - return SharedKeysRegenerateResponse{}, err + return SharedKeysRegenerateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_storageinsightconfigs_client.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_storageinsightconfigs_client.go index 32027c0491d6..455c98c31808 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_storageinsightconfigs_client.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_storageinsightconfigs_client.go @@ -11,13 +11,14 @@ package armoperationalinsights import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // StorageInsightConfigsClient contains the methods for the StorageInsightConfigs group. @@ -29,8 +30,15 @@ type StorageInsightConfigsClient struct { } // NewStorageInsightConfigsClient creates a new instance of StorageInsightConfigsClient with the specified values. -func NewStorageInsightConfigsClient(con *arm.Connection, subscriptionID string) *StorageInsightConfigsClient { - return &StorageInsightConfigsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewStorageInsightConfigsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *StorageInsightConfigsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &StorageInsightConfigsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update a storage insight. @@ -84,7 +92,7 @@ func (client *StorageInsightConfigsClient) createOrUpdateCreateRequest(ctx conte func (client *StorageInsightConfigsClient) createOrUpdateHandleResponse(resp *http.Response) (StorageInsightConfigsCreateOrUpdateResponse, error) { result := StorageInsightConfigsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StorageInsight); err != nil { - return StorageInsightConfigsCreateOrUpdateResponse{}, err + return StorageInsightConfigsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -210,7 +218,7 @@ func (client *StorageInsightConfigsClient) getCreateRequest(ctx context.Context, func (client *StorageInsightConfigsClient) getHandleResponse(resp *http.Response) (StorageInsightConfigsGetResponse, error) { result := StorageInsightConfigsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StorageInsight); err != nil { - return StorageInsightConfigsGetResponse{}, err + return StorageInsightConfigsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -271,7 +279,7 @@ func (client *StorageInsightConfigsClient) listByWorkspaceCreateRequest(ctx cont func (client *StorageInsightConfigsClient) listByWorkspaceHandleResponse(resp *http.Response) (StorageInsightConfigsListByWorkspaceResponse, error) { result := StorageInsightConfigsListByWorkspaceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StorageInsightListResult); err != nil { - return StorageInsightConfigsListByWorkspaceResponse{}, err + return StorageInsightConfigsListByWorkspaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_time_rfc3339.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_time_rfc3339.go index 1d5a70cc4ac8..d53d3e34553d 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armoperationalinsights import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_usages_client.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_usages_client.go index 822506303df3..c41195273669 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_usages_client.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_usages_client.go @@ -11,13 +11,14 @@ package armoperationalinsights import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // UsagesClient contains the methods for the Usages group. @@ -29,8 +30,15 @@ type UsagesClient struct { } // NewUsagesClient creates a new instance of UsagesClient with the specified values. -func NewUsagesClient(con *arm.Connection, subscriptionID string) *UsagesClient { - return &UsagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UsagesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &UsagesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets a list of usage metrics for a workspace. @@ -80,7 +88,7 @@ func (client *UsagesClient) listCreateRequest(ctx context.Context, resourceGroup func (client *UsagesClient) listHandleResponse(resp *http.Response) (UsagesListResponse, error) { result := UsagesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceListUsagesResult); err != nil { - return UsagesListResponse{}, err + return UsagesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_workspacepurge_client.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_workspacepurge_client.go index eac3b13d9f5f..80e1ee4ba2df 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_workspacepurge_client.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_workspacepurge_client.go @@ -11,13 +11,14 @@ package armoperationalinsights import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // WorkspacePurgeClient contains the methods for the WorkspacePurge group. @@ -29,8 +30,15 @@ type WorkspacePurgeClient struct { } // NewWorkspacePurgeClient creates a new instance of WorkspacePurgeClient with the specified values. -func NewWorkspacePurgeClient(con *arm.Connection, subscriptionID string) *WorkspacePurgeClient { - return &WorkspacePurgeClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWorkspacePurgeClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkspacePurgeClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WorkspacePurgeClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetPurgeStatus - Gets status of an ongoing purge operation. @@ -84,7 +92,7 @@ func (client *WorkspacePurgeClient) getPurgeStatusCreateRequest(ctx context.Cont func (client *WorkspacePurgeClient) getPurgeStatusHandleResponse(resp *http.Response) (WorkspacePurgeGetPurgeStatusResponse, error) { result := WorkspacePurgeGetPurgeStatusResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkspacePurgeStatusResponse); err != nil { - return WorkspacePurgeGetPurgeStatusResponse{}, err + return WorkspacePurgeGetPurgeStatusResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -155,7 +163,7 @@ func (client *WorkspacePurgeClient) purgeHandleResponse(resp *http.Response) (Wo result.XMSStatusLocation = &val } if err := runtime.UnmarshalAsJSON(resp, &result.WorkspacePurgeResponse); err != nil { - return WorkspacePurgePurgeResponse{}, err + return WorkspacePurgePurgeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_workspaces_client.go b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_workspaces_client.go index afff008fc5d6..dd8a35ea3f5a 100644 --- a/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_workspaces_client.go +++ b/sdk/resourcemanager/operationalinsights/armoperationalinsights/zz_generated_workspaces_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // WorkspacesClient contains the methods for the Workspaces group. @@ -32,8 +32,15 @@ type WorkspacesClient struct { } // NewWorkspacesClient creates a new instance of WorkspacesClient with the specified values. -func NewWorkspacesClient(con *arm.Connection, subscriptionID string) *WorkspacesClient { - return &WorkspacesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWorkspacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkspacesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WorkspacesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update a workspace. @@ -242,7 +249,7 @@ func (client *WorkspacesClient) getCreateRequest(ctx context.Context, resourceGr func (client *WorkspacesClient) getHandleResponse(resp *http.Response) (WorkspacesGetResponse, error) { result := WorkspacesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Workspace); err != nil { - return WorkspacesGetResponse{}, err + return WorkspacesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -299,7 +306,7 @@ func (client *WorkspacesClient) listCreateRequest(ctx context.Context, options * func (client *WorkspacesClient) listHandleResponse(resp *http.Response) (WorkspacesListResponse, error) { result := WorkspacesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceListResult); err != nil { - return WorkspacesListResponse{}, err + return WorkspacesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -360,7 +367,7 @@ func (client *WorkspacesClient) listByResourceGroupCreateRequest(ctx context.Con func (client *WorkspacesClient) listByResourceGroupHandleResponse(resp *http.Response) (WorkspacesListByResourceGroupResponse, error) { result := WorkspacesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceListResult); err != nil { - return WorkspacesListByResourceGroupResponse{}, err + return WorkspacesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -425,7 +432,7 @@ func (client *WorkspacesClient) updateCreateRequest(ctx context.Context, resourc func (client *WorkspacesClient) updateHandleResponse(resp *http.Response) (WorkspacesUpdateResponse, error) { result := WorkspacesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Workspace); err != nil { - return WorkspacesUpdateResponse{}, err + return WorkspacesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/CHANGELOG.md b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/CHANGELOG.md index 2276a757fdd8..626bf7231e27 100644 --- a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/CHANGELOG.md +++ b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-20) diff --git a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/README.md b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/README.md index 12d987caf2df..eb9fc66d1e59 100644 --- a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/README.md +++ b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Operations Management +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Operations Management modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armoperationsmanagement.NewManagementConfigurationsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Operations Management modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armoperationsmanagement.NewManagementConfigurationsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armoperationsmanagement.NewManagementConfigurationsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/autorest.md b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/autorest.md index 1a4658908311..4bff234aa050 100644 --- a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/autorest.md +++ b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/6ba37b7279bbd0d69042743246780cc3af9257b9/specification/operationsmanagement/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/6ba37b7279bbd0d69042743246780cc3af9257b9/specification/operationsmanagement/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/operationsmanagement/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/operationsmanagement/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/go.mod b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/go.mod index 8e84845c1edc..f86002124fd0 100644 --- a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/go.mod +++ b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/operationsmanagemen go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.2.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/go.sum b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/go.sum index c8ff7a2143ad..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/go.sum +++ b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible h1:iCb2tuoEm3N7ZpUDOvu1Yxl1B3iOVDmaD6weaRuIPzs= -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_constants.go b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_constants.go index ed31e0671802..897284c46f6a 100644 --- a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_constants.go +++ b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_constants.go @@ -10,5 +10,5 @@ package armoperationsmanagement const ( module = "armoperationsmanagement" - version = "v0.1.1" + version = "v0.2.0" ) diff --git a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_managementassociations_client.go b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_managementassociations_client.go index 2d8104be3ab7..b22233269dc9 100644 --- a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_managementassociations_client.go +++ b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_managementassociations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagementAssociationsClient contains the methods for the ManagementAssociations group. @@ -33,8 +34,15 @@ type ManagementAssociationsClient struct { } // NewManagementAssociationsClient creates a new instance of ManagementAssociationsClient with the specified values. -func NewManagementAssociationsClient(con *arm.Connection, subscriptionID string, providerName string, resourceType string, resourceName string) *ManagementAssociationsClient { - return &ManagementAssociationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID, providerName: providerName, resourceType: resourceType, resourceName: resourceName} +func NewManagementAssociationsClient(subscriptionID string, providerName string, resourceType string, resourceName string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagementAssociationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagementAssociationsClient{subscriptionID: subscriptionID, providerName: providerName, resourceType: resourceType, resourceName: resourceName, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the ManagementAssociation. @@ -96,7 +104,7 @@ func (client *ManagementAssociationsClient) createOrUpdateCreateRequest(ctx cont func (client *ManagementAssociationsClient) createOrUpdateHandleResponse(resp *http.Response) (ManagementAssociationsCreateOrUpdateResponse, error) { result := ManagementAssociationsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagementAssociation); err != nil { - return ManagementAssociationsCreateOrUpdateResponse{}, err + return ManagementAssociationsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -241,7 +249,7 @@ func (client *ManagementAssociationsClient) getCreateRequest(ctx context.Context func (client *ManagementAssociationsClient) getHandleResponse(resp *http.Response) (ManagementAssociationsGetResponse, error) { result := ManagementAssociationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagementAssociation); err != nil { - return ManagementAssociationsGetResponse{}, err + return ManagementAssociationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +306,7 @@ func (client *ManagementAssociationsClient) listBySubscriptionCreateRequest(ctx func (client *ManagementAssociationsClient) listBySubscriptionHandleResponse(resp *http.Response) (ManagementAssociationsListBySubscriptionResponse, error) { result := ManagementAssociationsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagementAssociationPropertiesList); err != nil { - return ManagementAssociationsListBySubscriptionResponse{}, err + return ManagementAssociationsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_managementconfigurations_client.go b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_managementconfigurations_client.go index 328c93a4d6be..a7bb54c3d24d 100644 --- a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_managementconfigurations_client.go +++ b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_managementconfigurations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagementConfigurationsClient contains the methods for the ManagementConfigurations group. @@ -30,8 +31,15 @@ type ManagementConfigurationsClient struct { } // NewManagementConfigurationsClient creates a new instance of ManagementConfigurationsClient with the specified values. -func NewManagementConfigurationsClient(con *arm.Connection, subscriptionID string) *ManagementConfigurationsClient { - return &ManagementConfigurationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagementConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagementConfigurationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagementConfigurationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the ManagementConfiguration. @@ -81,7 +89,7 @@ func (client *ManagementConfigurationsClient) createOrUpdateCreateRequest(ctx co func (client *ManagementConfigurationsClient) createOrUpdateHandleResponse(resp *http.Response) (ManagementConfigurationsCreateOrUpdateResponse, error) { result := ManagementConfigurationsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagementConfiguration); err != nil { - return ManagementConfigurationsCreateOrUpdateResponse{}, err + return ManagementConfigurationsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -202,7 +210,7 @@ func (client *ManagementConfigurationsClient) getCreateRequest(ctx context.Conte func (client *ManagementConfigurationsClient) getHandleResponse(resp *http.Response) (ManagementConfigurationsGetResponse, error) { result := ManagementConfigurationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagementConfiguration); err != nil { - return ManagementConfigurationsGetResponse{}, err + return ManagementConfigurationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -259,7 +267,7 @@ func (client *ManagementConfigurationsClient) listBySubscriptionCreateRequest(ct func (client *ManagementConfigurationsClient) listBySubscriptionHandleResponse(resp *http.Response) (ManagementConfigurationsListBySubscriptionResponse, error) { result := ManagementConfigurationsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagementConfigurationPropertiesList); err != nil { - return ManagementConfigurationsListBySubscriptionResponse{}, err + return ManagementConfigurationsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_models.go b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_models.go index 35485d1c27da..cefb01f31802 100644 --- a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_models.go +++ b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_models.go @@ -10,9 +10,8 @@ package armoperationsmanagement import ( "encoding/json" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" ) // ArmTemplateParameter - Parameter to pass to ARM template diff --git a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_operations_client.go b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_operations_client.go index 282cbc24b6ef..ed3a9e71ce2e 100644 --- a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_operations_client.go +++ b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armoperationsmanagement import ( "context" "errors" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available OperationsManagement Rest API operations. @@ -65,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_pollers.go b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_pollers.go index 42bbdb86564a..cb223012c63f 100644 --- a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_pollers.go +++ b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armoperationsmanagement import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // SolutionsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_response_types.go b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_response_types.go index b22a1d1ff26c..4a87ddc8667c 100644 --- a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_response_types.go +++ b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armoperationsmanagement import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // ManagementAssociationsCreateOrUpdateResponse contains the response from method ManagementAssociations.CreateOrUpdate. @@ -122,6 +121,8 @@ type SolutionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SolutionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SolutionsCreateOrUpdateResponse, error) { respType := SolutionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Solution) @@ -172,6 +173,8 @@ type SolutionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SolutionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SolutionsDeleteResponse, error) { respType := SolutionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -252,6 +255,8 @@ type SolutionsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SolutionsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SolutionsUpdateResponse, error) { respType := SolutionsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Solution) diff --git a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_solutions_client.go b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_solutions_client.go index 4a5e7642265b..7c9f2e2a9c4b 100644 --- a/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_solutions_client.go +++ b/sdk/resourcemanager/operationsmanagement/armoperationsmanagement/zz_generated_solutions_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SolutionsClient contains the methods for the Solutions group. @@ -31,8 +31,15 @@ type SolutionsClient struct { } // NewSolutionsClient creates a new instance of SolutionsClient with the specified values. -func NewSolutionsClient(con *arm.Connection, subscriptionID string) *SolutionsClient { - return &SolutionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSolutionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SolutionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SolutionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates the Solution. @@ -234,7 +241,7 @@ func (client *SolutionsClient) getCreateRequest(ctx context.Context, resourceGro func (client *SolutionsClient) getHandleResponse(resp *http.Response) (SolutionsGetResponse, error) { result := SolutionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Solution); err != nil { - return SolutionsGetResponse{}, err + return SolutionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -295,7 +302,7 @@ func (client *SolutionsClient) listByResourceGroupCreateRequest(ctx context.Cont func (client *SolutionsClient) listByResourceGroupHandleResponse(resp *http.Response) (SolutionsListByResourceGroupResponse, error) { result := SolutionsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SolutionPropertiesList); err != nil { - return SolutionsListByResourceGroupResponse{}, err + return SolutionsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -352,7 +359,7 @@ func (client *SolutionsClient) listBySubscriptionCreateRequest(ctx context.Conte func (client *SolutionsClient) listBySubscriptionHandleResponse(resp *http.Response) (SolutionsListBySubscriptionResponse, error) { result := SolutionsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SolutionPropertiesList); err != nil { - return SolutionsListBySubscriptionResponse{}, err + return SolutionsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/CHANGELOG.md b/sdk/resourcemanager/postgresql/armpostgresql/CHANGELOG.md index 4643b52fa56d..18efff25f2b7 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/CHANGELOG.md +++ b/sdk/resourcemanager/postgresql/armpostgresql/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-10-08) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresql". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/postgresql/armpostgresql") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/postgresql/armpostgresql/README.md b/sdk/resourcemanager/postgresql/armpostgresql/README.md index cdadada7bb19..bea4bd20ed10 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/README.md +++ b/sdk/resourcemanager/postgresql/armpostgresql/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Database for PostgreSQL +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Database for PostgreSQL modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armpostgresql.NewFirewallRulesClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Database for PostgreSQL modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armpostgresql.NewFirewallRulesClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armpostgresql.NewFirewallRulesClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/postgresql/armpostgresql/autorest.md b/sdk/resourcemanager/postgresql/armpostgresql/autorest.md index 9034a34f4cc7..5fcdb68670f4 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/autorest.md +++ b/sdk/resourcemanager/postgresql/armpostgresql/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/postgresql/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/postgresql/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/postgresql/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/postgresql/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 package-singleservers: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/postgresql/armpostgresql/go.mod b/sdk/resourcemanager/postgresql/armpostgresql/go.mod index 0f837686ba2d..3afc99d81c71 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/go.mod +++ b/sdk/resourcemanager/postgresql/armpostgresql/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostg go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/postgresql/armpostgresql/go.sum b/sdk/resourcemanager/postgresql/armpostgresql/go.sum index 4f0fb709cf31..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/go.sum +++ b/sdk/resourcemanager/postgresql/armpostgresql/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible h1:Cw16jiP4dI+CK761aq44ol4RV5dUiIIXky1+EKpoiVM= -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_checknameavailability_client.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_checknameavailability_client.go index 971b11578388..34dc1ca35419 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_checknameavailability_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_checknameavailability_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -29,8 +31,15 @@ type CheckNameAvailabilityClient struct { } // NewCheckNameAvailabilityClient creates a new instance of CheckNameAvailabilityClient with the specified values. -func NewCheckNameAvailabilityClient(con *arm.Connection, subscriptionID string) *CheckNameAvailabilityClient { - return &CheckNameAvailabilityClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCheckNameAvailabilityClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CheckNameAvailabilityClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CheckNameAvailabilityClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Execute - Check the availability of name for resource @@ -72,7 +81,7 @@ func (client *CheckNameAvailabilityClient) executeCreateRequest(ctx context.Cont func (client *CheckNameAvailabilityClient) executeHandleResponse(resp *http.Response) (CheckNameAvailabilityExecuteResponse, error) { result := CheckNameAvailabilityExecuteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NameAvailability); err != nil { - return CheckNameAvailabilityExecuteResponse{}, err + return CheckNameAvailabilityExecuteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_configurations_client.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_configurations_client.go index b29eae78ed34..5ac644719548 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_configurations_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_configurations_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type ConfigurationsClient struct { } // NewConfigurationsClient creates a new instance of ConfigurationsClient with the specified values. -func NewConfigurationsClient(con *arm.Connection, subscriptionID string) *ConfigurationsClient { - return &ConfigurationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ConfigurationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ConfigurationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Updates a configuration of a server. @@ -165,7 +173,7 @@ func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resour func (client *ConfigurationsClient) getHandleResponse(resp *http.Response) (ConfigurationsGetResponse, error) { result := ConfigurationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Configuration); err != nil { - return ConfigurationsGetResponse{}, err + return ConfigurationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -230,7 +238,7 @@ func (client *ConfigurationsClient) listByServerCreateRequest(ctx context.Contex func (client *ConfigurationsClient) listByServerHandleResponse(resp *http.Response) (ConfigurationsListByServerResponse, error) { result := ConfigurationsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationListResult); err != nil { - return ConfigurationsListByServerResponse{}, err + return ConfigurationsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_constants.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_constants.go index f19ccdf4990a..061a533acea6 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_constants.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_constants.go @@ -10,7 +10,7 @@ package armpostgresql const ( module = "armpostgresql" - version = "v0.1.0" + version = "v0.2.0" ) // CreateMode - The mode to create a new server. diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_databases_client.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_databases_client.go index 293816903af6..e18f8ec4726e 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_databases_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_databases_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type DatabasesClient struct { } // NewDatabasesClient creates a new instance of DatabasesClient with the specified values. -func NewDatabasesClient(con *arm.Connection, subscriptionID string) *DatabasesClient { - return &DatabasesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabasesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabasesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a new database or updates an existing database. @@ -245,7 +253,7 @@ func (client *DatabasesClient) getCreateRequest(ctx context.Context, resourceGro func (client *DatabasesClient) getHandleResponse(resp *http.Response) (DatabasesGetResponse, error) { result := DatabasesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Database); err != nil { - return DatabasesGetResponse{}, err + return DatabasesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -310,7 +318,7 @@ func (client *DatabasesClient) listByServerCreateRequest(ctx context.Context, re func (client *DatabasesClient) listByServerHandleResponse(resp *http.Response) (DatabasesListByServerResponse, error) { result := DatabasesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseListResult); err != nil { - return DatabasesListByServerResponse{}, err + return DatabasesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_firewallrules_client.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_firewallrules_client.go index bdb0eac45737..096513bb6f9f 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_firewallrules_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_firewallrules_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type FirewallRulesClient struct { } // NewFirewallRulesClient creates a new instance of FirewallRulesClient with the specified values. -func NewFirewallRulesClient(con *arm.Connection, subscriptionID string) *FirewallRulesClient { - return &FirewallRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FirewallRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FirewallRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a new firewall rule or updates an existing firewall rule. @@ -245,7 +253,7 @@ func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourc func (client *FirewallRulesClient) getHandleResponse(resp *http.Response) (FirewallRulesGetResponse, error) { result := FirewallRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRule); err != nil { - return FirewallRulesGetResponse{}, err + return FirewallRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -310,7 +318,7 @@ func (client *FirewallRulesClient) listByServerCreateRequest(ctx context.Context func (client *FirewallRulesClient) listByServerHandleResponse(resp *http.Response) (FirewallRulesListByServerResponse, error) { result := FirewallRulesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRuleListResult); err != nil { - return FirewallRulesListByServerResponse{}, err + return FirewallRulesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_locationbasedperformancetier_client.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_locationbasedperformancetier_client.go index dc11fb9c5761..478a9fe98017 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_locationbasedperformancetier_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_locationbasedperformancetier_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -29,8 +31,15 @@ type LocationBasedPerformanceTierClient struct { } // NewLocationBasedPerformanceTierClient creates a new instance of LocationBasedPerformanceTierClient with the specified values. -func NewLocationBasedPerformanceTierClient(con *arm.Connection, subscriptionID string) *LocationBasedPerformanceTierClient { - return &LocationBasedPerformanceTierClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLocationBasedPerformanceTierClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LocationBasedPerformanceTierClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LocationBasedPerformanceTierClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - List all the performance tiers at specified location in a given subscription. @@ -76,7 +85,7 @@ func (client *LocationBasedPerformanceTierClient) listCreateRequest(ctx context. func (client *LocationBasedPerformanceTierClient) listHandleResponse(resp *http.Response) (LocationBasedPerformanceTierListResponse, error) { result := LocationBasedPerformanceTierListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PerformanceTierListResult); err != nil { - return LocationBasedPerformanceTierListResponse{}, err + return LocationBasedPerformanceTierListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_logfiles_client.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_logfiles_client.go index 43fdcec7a66a..b485aeaef6e4 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_logfiles_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_logfiles_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -29,8 +31,15 @@ type LogFilesClient struct { } // NewLogFilesClient creates a new instance of LogFilesClient with the specified values. -func NewLogFilesClient(con *arm.Connection, subscriptionID string) *LogFilesClient { - return &LogFilesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLogFilesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LogFilesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LogFilesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByServer - List all the log files in a given server. @@ -80,7 +89,7 @@ func (client *LogFilesClient) listByServerCreateRequest(ctx context.Context, res func (client *LogFilesClient) listByServerHandleResponse(resp *http.Response) (LogFilesListByServerResponse, error) { result := LogFilesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LogFileListResult); err != nil { - return LogFilesListByServerResponse{}, err + return LogFilesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_models.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_models.go index a9409e3e59f7..7d093e0e41cb 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_models.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_models.go @@ -306,8 +306,8 @@ type LogFileProperties struct { // MarshalJSON implements the json.Marshaller interface for type LogFileProperties. func (l LogFileProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdTime", (*timeRFC3339)(l.CreatedTime)) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(l.LastModifiedTime)) + populateTimeRFC3339(objectMap, "createdTime", l.CreatedTime) + populateTimeRFC3339(objectMap, "lastModifiedTime", l.LastModifiedTime) populate(objectMap, "sizeInKB", l.SizeInKB) populate(objectMap, "type", l.Type) populate(objectMap, "url", l.URL) @@ -324,14 +324,10 @@ func (l *LogFileProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "createdTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.CreatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.CreatedTime) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.LastModifiedTime) delete(rawMsg, key) case "sizeInKB": err = unpopulate(val, &l.SizeInKB) @@ -1009,7 +1005,7 @@ type ServerKeyProperties struct { // MarshalJSON implements the json.Marshaller interface for type ServerKeyProperties. func (s ServerKeyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationDate", (*timeRFC3339)(s.CreationDate)) + populateTimeRFC3339(objectMap, "creationDate", s.CreationDate) populate(objectMap, "serverKeyType", s.ServerKeyType) populate(objectMap, "uri", s.URI) return json.Marshal(objectMap) @@ -1025,9 +1021,7 @@ func (s *ServerKeyProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreationDate) delete(rawMsg, key) case "serverKeyType": err = unpopulate(val, &s.ServerKeyType) @@ -1166,7 +1160,7 @@ func (s ServerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "administratorLogin", s.AdministratorLogin) populate(objectMap, "byokEnforcement", s.ByokEnforcement) - populate(objectMap, "earliestRestoreDate", (*timeRFC3339)(s.EarliestRestoreDate)) + populateTimeRFC3339(objectMap, "earliestRestoreDate", s.EarliestRestoreDate) populate(objectMap, "fullyQualifiedDomainName", s.FullyQualifiedDomainName) populate(objectMap, "infrastructureEncryption", s.InfrastructureEncryption) populate(objectMap, "masterServerId", s.MasterServerID) @@ -1198,9 +1192,7 @@ func (s *ServerProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.ByokEnforcement) delete(rawMsg, key) case "earliestRestoreDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.EarliestRestoreDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.EarliestRestoreDate) delete(rawMsg, key) case "fullyQualifiedDomainName": err = unpopulate(val, &s.FullyQualifiedDomainName) @@ -1473,7 +1465,7 @@ type ServerPropertiesForRestore struct { func (s ServerPropertiesForRestore) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) s.ServerPropertiesForCreate.marshalInternal(objectMap, CreateModePointInTimeRestore) - populate(objectMap, "restorePointInTime", (*timeRFC3339)(s.RestorePointInTime)) + populateTimeRFC3339(objectMap, "restorePointInTime", s.RestorePointInTime) populate(objectMap, "sourceServerId", s.SourceServerID) return json.Marshal(objectMap) } @@ -1488,9 +1480,7 @@ func (s *ServerPropertiesForRestore) UnmarshalJSON(data []byte) error { var err error switch key { case "restorePointInTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.RestorePointInTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.RestorePointInTime) delete(rawMsg, key) case "sourceServerId": err = unpopulate(val, &s.SourceServerID) diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_operations_client.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_operations_client.go index 219d82594b43..54b1bfb453ee 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_operations_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_operations_client.go @@ -11,7 +11,9 @@ package armpostgresql import ( "context" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available REST API operations. @@ -64,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_polymorphic_helpers.go index b9ecbc9a8322..d2db18054c5d 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_polymorphic_helpers.go @@ -52,3 +52,22 @@ func unmarshalServerPropertiesForCreateClassificationArray(rawMsg json.RawMessag } return fArray, nil } + +func unmarshalServerPropertiesForCreateClassificationMap(rawMsg json.RawMessage) (map[string]ServerPropertiesForCreateClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ServerPropertiesForCreateClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalServerPropertiesForCreateClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_privateendpointconnections_client.go index 60f6dc8cd5e4..707c26d0863c 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_privateendpointconnections_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { - return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. @@ -245,7 +253,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsGetResponse{}, err + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -307,7 +315,7 @@ func (client *PrivateEndpointConnectionsClient) listByServerCreateRequest(ctx co func (client *PrivateEndpointConnectionsClient) listByServerHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListByServerResponse, error) { result := PrivateEndpointConnectionsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionsListByServerResponse{}, err + return PrivateEndpointConnectionsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_privatelinkresources_client.go index 4a19e48f8e6a..54c8a909f2bf 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_privatelinkresources_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -29,8 +31,15 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { - return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a private link resource for PostgreSQL server. @@ -84,7 +93,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesGetResponse, error) { result := PrivateLinkResourcesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { - return PrivateLinkResourcesGetResponse{}, err + return PrivateLinkResourcesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -146,7 +155,7 @@ func (client *PrivateLinkResourcesClient) listByServerCreateRequest(ctx context. func (client *PrivateLinkResourcesClient) listByServerHandleResponse(resp *http.Response) (PrivateLinkResourcesListByServerResponse, error) { result := PrivateLinkResourcesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { - return PrivateLinkResourcesListByServerResponse{}, err + return PrivateLinkResourcesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_recoverableservers_client.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_recoverableservers_client.go index 15c5448af365..e0ba22aa9e53 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_recoverableservers_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_recoverableservers_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -29,8 +31,15 @@ type RecoverableServersClient struct { } // NewRecoverableServersClient creates a new instance of RecoverableServersClient with the specified values. -func NewRecoverableServersClient(con *arm.Connection, subscriptionID string) *RecoverableServersClient { - return &RecoverableServersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRecoverableServersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RecoverableServersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RecoverableServersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a recoverable PostgreSQL Server. @@ -80,7 +89,7 @@ func (client *RecoverableServersClient) getCreateRequest(ctx context.Context, re func (client *RecoverableServersClient) getHandleResponse(resp *http.Response) (RecoverableServersGetResponse, error) { result := RecoverableServersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecoverableServerResource); err != nil { - return RecoverableServersGetResponse{}, err + return RecoverableServersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_replicas_client.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_replicas_client.go index d6d77dc0f050..eef1b2653c06 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_replicas_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_replicas_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -29,8 +31,15 @@ type ReplicasClient struct { } // NewReplicasClient creates a new instance of ReplicasClient with the specified values. -func NewReplicasClient(con *arm.Connection, subscriptionID string) *ReplicasClient { - return &ReplicasClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewReplicasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ReplicasClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ReplicasClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByServer - List all the replicas for a given server. @@ -80,7 +89,7 @@ func (client *ReplicasClient) listByServerCreateRequest(ctx context.Context, res func (client *ReplicasClient) listByServerHandleResponse(resp *http.Response) (ReplicasListByServerResponse, error) { result := ReplicasListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerListResult); err != nil { - return ReplicasListByServerResponse{}, err + return ReplicasListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_response_types.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_response_types.go index 70f3765edc54..12946ed044b9 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_response_types.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_response_types.go @@ -37,6 +37,8 @@ type ConfigurationsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ConfigurationsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ConfigurationsCreateOrUpdateResponse, error) { respType := ConfigurationsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Configuration) @@ -111,6 +113,8 @@ type DatabasesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabasesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesCreateOrUpdateResponse, error) { respType := DatabasesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Database) @@ -161,6 +165,8 @@ type DatabasesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabasesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesDeleteResponse, error) { respType := DatabasesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -229,6 +235,8 @@ type FirewallRulesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FirewallRulesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FirewallRulesCreateOrUpdateResponse, error) { respType := FirewallRulesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.FirewallRule) @@ -279,6 +287,8 @@ type FirewallRulesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FirewallRulesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FirewallRulesDeleteResponse, error) { respType := FirewallRulesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -383,6 +393,8 @@ type PrivateEndpointConnectionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsCreateOrUpdateResponse, error) { respType := PrivateEndpointConnectionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) @@ -433,6 +445,8 @@ type PrivateEndpointConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsDeleteResponse, error) { respType := PrivateEndpointConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -501,6 +515,8 @@ type PrivateEndpointConnectionsUpdateTagsPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsUpdateTagsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsUpdateTagsResponse, error) { respType := PrivateEndpointConnectionsUpdateTagsResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) @@ -599,6 +615,8 @@ type ServerAdministratorsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerAdministratorsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerAdministratorsCreateOrUpdateResponse, error) { respType := ServerAdministratorsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServerAdministratorResource) @@ -649,6 +667,8 @@ type ServerAdministratorsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerAdministratorsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerAdministratorsDeleteResponse, error) { respType := ServerAdministratorsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -729,6 +749,8 @@ type ServerKeysCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerKeysCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerKeysCreateOrUpdateResponse, error) { respType := ServerKeysCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServerKey) @@ -779,6 +801,8 @@ type ServerKeysDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerKeysDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerKeysDeleteResponse, error) { respType := ServerKeysDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -847,6 +871,8 @@ type ServerParametersListUpdateConfigurationsPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerParametersListUpdateConfigurationsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerParametersListUpdateConfigurationsResponse, error) { respType := ServerParametersListUpdateConfigurationsResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ConfigurationListResult) @@ -897,6 +923,8 @@ type ServerSecurityAlertPoliciesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerSecurityAlertPoliciesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerSecurityAlertPoliciesCreateOrUpdateResponse, error) { respType := ServerSecurityAlertPoliciesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServerSecurityAlertPolicy) @@ -971,6 +999,8 @@ type ServersCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersCreateResponse, error) { respType := ServersCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Server) @@ -1021,6 +1051,8 @@ type ServersDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersDeleteResponse, error) { respType := ServersDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1101,6 +1133,8 @@ type ServersRestartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersRestartResponse, error) { respType := ServersRestartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1145,6 +1179,8 @@ type ServersUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersUpdateResponse, error) { respType := ServersUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Server) @@ -1195,6 +1231,8 @@ type VirtualNetworkRulesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkRulesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkRulesCreateOrUpdateResponse, error) { respType := VirtualNetworkRulesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualNetworkRule) @@ -1245,6 +1283,8 @@ type VirtualNetworkRulesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkRulesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkRulesDeleteResponse, error) { respType := VirtualNetworkRulesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serveradministrators_client.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serveradministrators_client.go index 1f78c38fce10..e6ac0d97d86b 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serveradministrators_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serveradministrators_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type ServerAdministratorsClient struct { } // NewServerAdministratorsClient creates a new instance of ServerAdministratorsClient with the specified values. -func NewServerAdministratorsClient(con *arm.Connection, subscriptionID string) *ServerAdministratorsClient { - return &ServerAdministratorsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerAdministratorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerAdministratorsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerAdministratorsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or update active directory administrator on an existing server. The update action will overwrite the existing administrator. @@ -233,7 +241,7 @@ func (client *ServerAdministratorsClient) getCreateRequest(ctx context.Context, func (client *ServerAdministratorsClient) getHandleResponse(resp *http.Response) (ServerAdministratorsGetResponse, error) { result := ServerAdministratorsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerAdministratorResource); err != nil { - return ServerAdministratorsGetResponse{}, err + return ServerAdministratorsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +306,7 @@ func (client *ServerAdministratorsClient) listCreateRequest(ctx context.Context, func (client *ServerAdministratorsClient) listHandleResponse(resp *http.Response) (ServerAdministratorsListResponse, error) { result := ServerAdministratorsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerAdministratorResourceListResult); err != nil { - return ServerAdministratorsListResponse{}, err + return ServerAdministratorsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serverbasedperformancetier_client.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serverbasedperformancetier_client.go index 3ef6c20d3230..6e19db5aac3b 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serverbasedperformancetier_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serverbasedperformancetier_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -29,8 +31,15 @@ type ServerBasedPerformanceTierClient struct { } // NewServerBasedPerformanceTierClient creates a new instance of ServerBasedPerformanceTierClient with the specified values. -func NewServerBasedPerformanceTierClient(con *arm.Connection, subscriptionID string) *ServerBasedPerformanceTierClient { - return &ServerBasedPerformanceTierClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerBasedPerformanceTierClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerBasedPerformanceTierClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerBasedPerformanceTierClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - List all the performance tiers for a PostgreSQL server. @@ -80,7 +89,7 @@ func (client *ServerBasedPerformanceTierClient) listCreateRequest(ctx context.Co func (client *ServerBasedPerformanceTierClient) listHandleResponse(resp *http.Response) (ServerBasedPerformanceTierListResponse, error) { result := ServerBasedPerformanceTierListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PerformanceTierListResult); err != nil { - return ServerBasedPerformanceTierListResponse{}, err + return ServerBasedPerformanceTierListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serverkeys_client.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serverkeys_client.go index 7246621fc044..3c9a58bea0c9 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serverkeys_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serverkeys_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type ServerKeysClient struct { } // NewServerKeysClient creates a new instance of ServerKeysClient with the specified values. -func NewServerKeysClient(con *arm.Connection, subscriptionID string) *ServerKeysClient { - return &ServerKeysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerKeysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerKeysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a PostgreSQL Server key. @@ -245,7 +253,7 @@ func (client *ServerKeysClient) getCreateRequest(ctx context.Context, resourceGr func (client *ServerKeysClient) getHandleResponse(resp *http.Response) (ServerKeysGetResponse, error) { result := ServerKeysGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerKey); err != nil { - return ServerKeysGetResponse{}, err + return ServerKeysGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -307,7 +315,7 @@ func (client *ServerKeysClient) listCreateRequest(ctx context.Context, resourceG func (client *ServerKeysClient) listHandleResponse(resp *http.Response) (ServerKeysListResponse, error) { result := ServerKeysListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerKeyListResult); err != nil { - return ServerKeysListResponse{}, err + return ServerKeysListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serverparameters_client.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serverparameters_client.go index 9529b300ee9b..ec5b4d60231d 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serverparameters_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serverparameters_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type ServerParametersClient struct { } // NewServerParametersClient creates a new instance of ServerParametersClient with the specified values. -func NewServerParametersClient(con *arm.Connection, subscriptionID string) *ServerParametersClient { - return &ServerParametersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerParametersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerParametersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerParametersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginListUpdateConfigurations - Update a list of configurations in a given server. diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_servers_client.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_servers_client.go index 5eda0b6eae1b..569e01c5dea9 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_servers_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_servers_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -30,8 +31,15 @@ type ServersClient struct { } // NewServersClient creates a new instance of ServersClient with the specified values. -func NewServersClient(con *arm.Connection, subscriptionID string) *ServersClient { - return &ServersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new server, or will overwrite an existing server. @@ -233,7 +241,7 @@ func (client *ServersClient) getCreateRequest(ctx context.Context, resourceGroup func (client *ServersClient) getHandleResponse(resp *http.Response) (ServersGetResponse, error) { result := ServersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Server); err != nil { - return ServersGetResponse{}, err + return ServersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -290,7 +298,7 @@ func (client *ServersClient) listCreateRequest(ctx context.Context, options *Ser func (client *ServersClient) listHandleResponse(resp *http.Response) (ServersListResponse, error) { result := ServersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerListResult); err != nil { - return ServersListResponse{}, err + return ServersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -351,7 +359,7 @@ func (client *ServersClient) listByResourceGroupCreateRequest(ctx context.Contex func (client *ServersClient) listByResourceGroupHandleResponse(resp *http.Response) (ServersListByResourceGroupResponse, error) { result := ServersListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerListResult); err != nil { - return ServersListByResourceGroupResponse{}, err + return ServersListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serversecurityalertpolicies_client.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serversecurityalertpolicies_client.go index a95bae786301..838f72daa0fb 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serversecurityalertpolicies_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_serversecurityalertpolicies_client.go @@ -11,6 +11,7 @@ package armpostgresql import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -29,8 +30,15 @@ type ServerSecurityAlertPoliciesClient struct { } // NewServerSecurityAlertPoliciesClient creates a new instance of ServerSecurityAlertPoliciesClient with the specified values. -func NewServerSecurityAlertPoliciesClient(con *arm.Connection, subscriptionID string) *ServerSecurityAlertPoliciesClient { - return &ServerSecurityAlertPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerSecurityAlertPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerSecurityAlertPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerSecurityAlertPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a threat detection policy. @@ -163,7 +171,7 @@ func (client *ServerSecurityAlertPoliciesClient) getCreateRequest(ctx context.Co func (client *ServerSecurityAlertPoliciesClient) getHandleResponse(resp *http.Response) (ServerSecurityAlertPoliciesGetResponse, error) { result := ServerSecurityAlertPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerSecurityAlertPolicy); err != nil { - return ServerSecurityAlertPoliciesGetResponse{}, err + return ServerSecurityAlertPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -224,7 +232,7 @@ func (client *ServerSecurityAlertPoliciesClient) listByServerCreateRequest(ctx c func (client *ServerSecurityAlertPoliciesClient) listByServerHandleResponse(resp *http.Response) (ServerSecurityAlertPoliciesListByServerResponse, error) { result := ServerSecurityAlertPoliciesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerSecurityAlertPolicyListResult); err != nil { - return ServerSecurityAlertPoliciesListByServerResponse{}, err + return ServerSecurityAlertPoliciesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_time_rfc3339.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_time_rfc3339.go index c671a85125b6..1f056c38796f 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armpostgresql import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_virtualnetworkrules_client.go b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_virtualnetworkrules_client.go index 19f0e71aa4a5..b73ab1678b27 100644 --- a/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_virtualnetworkrules_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresql/zz_generated_virtualnetworkrules_client.go @@ -11,6 +11,7 @@ package armpostgresql import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -29,8 +30,15 @@ type VirtualNetworkRulesClient struct { } // NewVirtualNetworkRulesClient creates a new instance of VirtualNetworkRulesClient with the specified values. -func NewVirtualNetworkRulesClient(con *arm.Connection, subscriptionID string) *VirtualNetworkRulesClient { - return &VirtualNetworkRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualNetworkRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualNetworkRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualNetworkRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates an existing virtual network rule. @@ -241,7 +249,7 @@ func (client *VirtualNetworkRulesClient) getCreateRequest(ctx context.Context, r func (client *VirtualNetworkRulesClient) getHandleResponse(resp *http.Response) (VirtualNetworkRulesGetResponse, error) { result := VirtualNetworkRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkRule); err != nil { - return VirtualNetworkRulesGetResponse{}, err + return VirtualNetworkRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -302,7 +310,7 @@ func (client *VirtualNetworkRulesClient) listByServerCreateRequest(ctx context.C func (client *VirtualNetworkRulesClient) listByServerHandleResponse(resp *http.Response) (VirtualNetworkRulesListByServerResponse, error) { result := VirtualNetworkRulesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkRuleListResult); err != nil { - return VirtualNetworkRulesListByServerResponse{}, err + return VirtualNetworkRulesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/CHANGELOG.md b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/CHANGELOG.md index 698d7eba06a6..015aecf04ac9 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/CHANGELOG.md +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-10-08) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/postgresql/armpostgresqlflexibleservers") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/README.md b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/README.md index 6d569076c413..5a470e00be71 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/README.md +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Database for PostgreSQL +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Database for PostgreSQL modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armpostgresqlflexibleservers.NewVirtualNetworkSubnetUsageClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Database for PostgreSQL modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armpostgresqlflexibleservers.NewVirtualNetworkSubnetUsageClient(con, "") +options = arm.ClientOptions{ +Host: arm.AzureChina, +} +client := armpostgresqlflexibleservers.NewVirtualNetworkSubnetUsageClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/autorest.md b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/autorest.md index c3b1df2763c7..a0e193440760 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/autorest.md +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/postgresql/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/postgresql/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/postgresql/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/postgresql/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 package-flexibleservers: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/go.mod b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/go.mod index 9feb01fd8ff7..561819727ccc 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/go.mod +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/postgresql/armpostg go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/go.sum b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/go.sum index 4f0fb709cf31..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/go.sum +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible h1:Cw16jiP4dI+CK761aq44ol4RV5dUiIIXky1+EKpoiVM= -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_checknameavailability_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_checknameavailability_client.go index 2989df2f12b6..6d1ea4c53e8d 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_checknameavailability_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_checknameavailability_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CheckNameAvailabilityClient contains the methods for the CheckNameAvailability group. @@ -30,8 +31,15 @@ type CheckNameAvailabilityClient struct { } // NewCheckNameAvailabilityClient creates a new instance of CheckNameAvailabilityClient with the specified values. -func NewCheckNameAvailabilityClient(con *arm.Connection, subscriptionID string) *CheckNameAvailabilityClient { - return &CheckNameAvailabilityClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCheckNameAvailabilityClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CheckNameAvailabilityClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CheckNameAvailabilityClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Execute - Check the availability of name for resource @@ -73,7 +81,7 @@ func (client *CheckNameAvailabilityClient) executeCreateRequest(ctx context.Cont func (client *CheckNameAvailabilityClient) executeHandleResponse(resp *http.Response) (CheckNameAvailabilityExecuteResponse, error) { result := CheckNameAvailabilityExecuteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NameAvailability); err != nil { - return CheckNameAvailabilityExecuteResponse{}, err + return CheckNameAvailabilityExecuteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_configurations_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_configurations_client.go index 332d9fdec621..77352a759860 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_configurations_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_configurations_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ConfigurationsClient contains the methods for the Configurations group. @@ -31,8 +31,15 @@ type ConfigurationsClient struct { } // NewConfigurationsClient creates a new instance of ConfigurationsClient with the specified values. -func NewConfigurationsClient(con *arm.Connection, subscriptionID string) *ConfigurationsClient { - return &ConfigurationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewConfigurationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ConfigurationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ConfigurationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets information about a configuration of server. @@ -86,7 +93,7 @@ func (client *ConfigurationsClient) getCreateRequest(ctx context.Context, resour func (client *ConfigurationsClient) getHandleResponse(resp *http.Response) (ConfigurationsGetResponse, error) { result := ConfigurationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Configuration); err != nil { - return ConfigurationsGetResponse{}, err + return ConfigurationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -148,7 +155,7 @@ func (client *ConfigurationsClient) listByServerCreateRequest(ctx context.Contex func (client *ConfigurationsClient) listByServerHandleResponse(resp *http.Response) (ConfigurationsListByServerResponse, error) { result := ConfigurationsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConfigurationListResult); err != nil { - return ConfigurationsListByServerResponse{}, err + return ConfigurationsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_constants.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_constants.go index 1474d83f3ad7..af69abf681cf 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_constants.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_constants.go @@ -10,7 +10,7 @@ package armpostgresqlflexibleservers const ( module = "armpostgresqlflexibleservers" - version = "v0.1.0" + version = "v0.2.0" ) // ConfigurationDataType - Data type of the configuration. diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_databases_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_databases_client.go index 83ed26f62992..9e4c9681de60 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_databases_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_databases_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabasesClient contains the methods for the Databases group. @@ -31,8 +31,15 @@ type DatabasesClient struct { } // NewDatabasesClient creates a new instance of DatabasesClient with the specified values. -func NewDatabasesClient(con *arm.Connection, subscriptionID string) *DatabasesClient { - return &DatabasesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabasesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabasesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new database or updates an existing database. @@ -246,7 +253,7 @@ func (client *DatabasesClient) getCreateRequest(ctx context.Context, resourceGro func (client *DatabasesClient) getHandleResponse(resp *http.Response) (DatabasesGetResponse, error) { result := DatabasesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Database); err != nil { - return DatabasesGetResponse{}, err + return DatabasesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -308,7 +315,7 @@ func (client *DatabasesClient) listByServerCreateRequest(ctx context.Context, re func (client *DatabasesClient) listByServerHandleResponse(resp *http.Response) (DatabasesListByServerResponse, error) { result := DatabasesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseListResult); err != nil { - return DatabasesListByServerResponse{}, err + return DatabasesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_firewallrules_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_firewallrules_client.go index 7e411c7c4989..b4599a74ffdb 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_firewallrules_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_firewallrules_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // FirewallRulesClient contains the methods for the FirewallRules group. @@ -31,8 +31,15 @@ type FirewallRulesClient struct { } // NewFirewallRulesClient creates a new instance of FirewallRulesClient with the specified values. -func NewFirewallRulesClient(con *arm.Connection, subscriptionID string) *FirewallRulesClient { - return &FirewallRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FirewallRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FirewallRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a new firewall rule or updates an existing firewall rule. @@ -246,7 +253,7 @@ func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourc func (client *FirewallRulesClient) getHandleResponse(resp *http.Response) (FirewallRulesGetResponse, error) { result := FirewallRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRule); err != nil { - return FirewallRulesGetResponse{}, err + return FirewallRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -308,7 +315,7 @@ func (client *FirewallRulesClient) listByServerCreateRequest(ctx context.Context func (client *FirewallRulesClient) listByServerHandleResponse(resp *http.Response) (FirewallRulesListByServerResponse, error) { result := FirewallRulesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRuleListResult); err != nil { - return FirewallRulesListByServerResponse{}, err + return FirewallRulesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_getprivatednszonesuffix_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_getprivatednszonesuffix_client.go index 86aace5f884b..5254d8647330 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_getprivatednszonesuffix_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_getprivatednszonesuffix_client.go @@ -11,11 +11,12 @@ package armpostgresqlflexibleservers import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // GetPrivateDNSZoneSuffixClient contains the methods for the GetPrivateDNSZoneSuffix group. @@ -26,8 +27,15 @@ type GetPrivateDNSZoneSuffixClient struct { } // NewGetPrivateDNSZoneSuffixClient creates a new instance of GetPrivateDNSZoneSuffixClient with the specified values. -func NewGetPrivateDNSZoneSuffixClient(con *arm.Connection) *GetPrivateDNSZoneSuffixClient { - return &GetPrivateDNSZoneSuffixClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewGetPrivateDNSZoneSuffixClient(credential azcore.TokenCredential, options *arm.ClientOptions) *GetPrivateDNSZoneSuffixClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &GetPrivateDNSZoneSuffixClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Execute - Get private DNS zone suffix in the cloud @@ -65,7 +73,7 @@ func (client *GetPrivateDNSZoneSuffixClient) executeCreateRequest(ctx context.Co func (client *GetPrivateDNSZoneSuffixClient) executeHandleResponse(resp *http.Response) (GetPrivateDNSZoneSuffixExecuteResponse, error) { result := GetPrivateDNSZoneSuffixExecuteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Value); err != nil { - return GetPrivateDNSZoneSuffixExecuteResponse{}, err + return GetPrivateDNSZoneSuffixExecuteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_locationbasedcapabilities_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_locationbasedcapabilities_client.go index fbb31934613e..7c03659b3bdb 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_locationbasedcapabilities_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_locationbasedcapabilities_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LocationBasedCapabilitiesClient contains the methods for the LocationBasedCapabilities group. @@ -30,8 +31,15 @@ type LocationBasedCapabilitiesClient struct { } // NewLocationBasedCapabilitiesClient creates a new instance of LocationBasedCapabilitiesClient with the specified values. -func NewLocationBasedCapabilitiesClient(con *arm.Connection, subscriptionID string) *LocationBasedCapabilitiesClient { - return &LocationBasedCapabilitiesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLocationBasedCapabilitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LocationBasedCapabilitiesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LocationBasedCapabilitiesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Execute - Get capabilities at specified location in a given subscription. @@ -74,7 +82,7 @@ func (client *LocationBasedCapabilitiesClient) executeCreateRequest(ctx context. func (client *LocationBasedCapabilitiesClient) executeHandleResponse(resp *http.Response) (LocationBasedCapabilitiesExecuteResponse, error) { result := LocationBasedCapabilitiesExecuteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CapabilitiesListResult); err != nil { - return LocationBasedCapabilitiesExecuteResponse{}, err + return LocationBasedCapabilitiesExecuteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_models.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_models.go index 25cbd53c65a8..19cf7d14b837 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_models.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_models.go @@ -10,10 +10,9 @@ package armpostgresqlflexibleservers import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // Backup properties of a server @@ -32,7 +31,7 @@ type Backup struct { func (b Backup) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "backupRetentionDays", b.BackupRetentionDays) - populate(objectMap, "earliestRestoreDate", (*timeRFC3339)(b.EarliestRestoreDate)) + populateTimeRFC3339(objectMap, "earliestRestoreDate", b.EarliestRestoreDate) populate(objectMap, "geoRedundantBackup", b.GeoRedundantBackup) return json.Marshal(objectMap) } @@ -50,9 +49,7 @@ func (b *Backup) UnmarshalJSON(data []byte) error { err = unpopulate(val, &b.BackupRetentionDays) delete(rawMsg, key) case "earliestRestoreDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - b.EarliestRestoreDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &b.EarliestRestoreDate) delete(rawMsg, key) case "geoRedundantBackup": err = unpopulate(val, &b.GeoRedundantBackup) @@ -780,7 +777,7 @@ func (s ServerProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "maintenanceWindow", s.MaintenanceWindow) populate(objectMap, "minorVersion", s.MinorVersion) populate(objectMap, "network", s.Network) - populate(objectMap, "pointInTimeUTC", (*timeRFC3339)(s.PointInTimeUTC)) + populateTimeRFC3339(objectMap, "pointInTimeUTC", s.PointInTimeUTC) populate(objectMap, "sourceServerResourceId", s.SourceServerResourceID) populate(objectMap, "state", s.State) populate(objectMap, "storage", s.Storage) @@ -829,9 +826,7 @@ func (s *ServerProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Network) delete(rawMsg, key) case "pointInTimeUTC": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.PointInTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.PointInTimeUTC) delete(rawMsg, key) case "sourceServerResourceId": err = unpopulate(val, &s.SourceServerResourceID) @@ -1009,10 +1004,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -1028,9 +1023,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -1039,9 +1032,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_operations_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_operations_client.go index bb3ace543670..96a46f16527a 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_operations_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armpostgresqlflexibleservers import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available REST API operations. @@ -65,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_pagers.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_pagers.go index c772acd66151..49efb2c8545b 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_pagers.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armpostgresqlflexibleservers import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // ConfigurationsListByServerPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_pollers.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_pollers.go index ef2650e34cbb..62558ce4cce4 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_pollers.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armpostgresqlflexibleservers import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // ConfigurationsPutPoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_response_types.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_response_types.go index b00cf434a795..d4a41eacd112 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_response_types.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armpostgresqlflexibleservers import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // CheckNameAvailabilityExecuteResponse contains the response from method CheckNameAvailability.Execute. @@ -62,6 +61,8 @@ type ConfigurationsPutPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ConfigurationsPutPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ConfigurationsPutResponse, error) { respType := ConfigurationsPutResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Configuration) @@ -112,6 +113,8 @@ type ConfigurationsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ConfigurationsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ConfigurationsUpdateResponse, error) { respType := ConfigurationsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Configuration) @@ -162,6 +165,8 @@ type DatabasesCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabasesCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesCreateResponse, error) { respType := DatabasesCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Database) @@ -212,6 +217,8 @@ type DatabasesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabasesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesDeleteResponse, error) { respType := DatabasesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -280,6 +287,8 @@ type FirewallRulesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FirewallRulesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FirewallRulesCreateOrUpdateResponse, error) { respType := FirewallRulesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.FirewallRule) @@ -330,6 +339,8 @@ type FirewallRulesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FirewallRulesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FirewallRulesDeleteResponse, error) { respType := FirewallRulesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -435,6 +446,8 @@ type ServersCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersCreateResponse, error) { respType := ServersCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Server) @@ -485,6 +498,8 @@ type ServersDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersDeleteResponse, error) { respType := ServersDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -565,6 +580,8 @@ type ServersRestartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersRestartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersRestartResponse, error) { respType := ServersRestartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -609,6 +626,8 @@ type ServersStartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersStartResponse, error) { respType := ServersStartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -653,6 +672,8 @@ type ServersStopPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersStopResponse, error) { respType := ServersStopResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -697,6 +718,8 @@ type ServersUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersUpdateResponse, error) { respType := ServersUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Server) diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_servers_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_servers_client.go index 2949eb27147c..316d6f9d3269 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_servers_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_servers_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServersClient contains the methods for the Servers group. @@ -31,8 +31,15 @@ type ServersClient struct { } // NewServersClient creates a new instance of ServersClient with the specified values. -func NewServersClient(con *arm.Connection, subscriptionID string) *ServersClient { - return &ServersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a new server. @@ -234,7 +241,7 @@ func (client *ServersClient) getCreateRequest(ctx context.Context, resourceGroup func (client *ServersClient) getHandleResponse(resp *http.Response) (ServersGetResponse, error) { result := ServersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Server); err != nil { - return ServersGetResponse{}, err + return ServersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -288,7 +295,7 @@ func (client *ServersClient) listCreateRequest(ctx context.Context, options *Ser func (client *ServersClient) listHandleResponse(resp *http.Response) (ServersListResponse, error) { result := ServersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerListResult); err != nil { - return ServersListResponse{}, err + return ServersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -346,7 +353,7 @@ func (client *ServersClient) listByResourceGroupCreateRequest(ctx context.Contex func (client *ServersClient) listByResourceGroupHandleResponse(resp *http.Response) (ServersListByResourceGroupResponse, error) { result := ServersListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerListResult); err != nil { - return ServersListByResourceGroupResponse{}, err + return ServersListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_time_rfc3339.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_time_rfc3339.go index b4953a85594a..e0a6a69fa266 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armpostgresqlflexibleservers import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_virtualnetworksubnetusage_client.go b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_virtualnetworksubnetusage_client.go index 40d1c65bca6c..0031d8a09c69 100644 --- a/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_virtualnetworksubnetusage_client.go +++ b/sdk/resourcemanager/postgresql/armpostgresqlflexibleservers/zz_generated_virtualnetworksubnetusage_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualNetworkSubnetUsageClient contains the methods for the VirtualNetworkSubnetUsage group. @@ -30,8 +31,15 @@ type VirtualNetworkSubnetUsageClient struct { } // NewVirtualNetworkSubnetUsageClient creates a new instance of VirtualNetworkSubnetUsageClient with the specified values. -func NewVirtualNetworkSubnetUsageClient(con *arm.Connection, subscriptionID string) *VirtualNetworkSubnetUsageClient { - return &VirtualNetworkSubnetUsageClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualNetworkSubnetUsageClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualNetworkSubnetUsageClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualNetworkSubnetUsageClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Execute - Get virtual network subnet usage for a given vNet resource id. @@ -77,7 +85,7 @@ func (client *VirtualNetworkSubnetUsageClient) executeCreateRequest(ctx context. func (client *VirtualNetworkSubnetUsageClient) executeHandleResponse(resp *http.Response) (VirtualNetworkSubnetUsageExecuteResponse, error) { result := VirtualNetworkSubnetUsageExecuteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkSubnetUsageResult); err != nil { - return VirtualNetworkSubnetUsageExecuteResponse{}, err + return VirtualNetworkSubnetUsageExecuteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/privatedns/armprivatedns/CHANGELOG.md b/sdk/resourcemanager/privatedns/armprivatedns/CHANGELOG.md index bbb91d894a9c..b3d6bf5b7b22 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/CHANGELOG.md +++ b/sdk/resourcemanager/privatedns/armprivatedns/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-10-08) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armprivatedns". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/privatedns/armprivatedns") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/privatedns/armprivatedns/README.md b/sdk/resourcemanager/privatedns/armprivatedns/README.md index 23e401471964..6f74614afbf5 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/README.md +++ b/sdk/resourcemanager/privatedns/armprivatedns/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Private DNS +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Private DNS modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armprivatedns.NewPrivateZonesClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Private DNS modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armprivatedns.NewPrivateZonesClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armprivatedns.NewPrivateZonesClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/privatedns/armprivatedns/autorest.md b/sdk/resourcemanager/privatedns/armprivatedns/autorest.md index 67b3cfafc8a2..a264f03211c0 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/autorest.md +++ b/sdk/resourcemanager/privatedns/armprivatedns/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/privatedns/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/privatedns/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/privatedns/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/privatedns/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/privatedns/armprivatedns/go.mod b/sdk/resourcemanager/privatedns/armprivatedns/go.mod index a4da0663d416..8a8aefcbf799 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/go.mod +++ b/sdk/resourcemanager/privatedns/armprivatedns/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/privatedns/armpriva go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/privatedns/armprivatedns/go.sum b/sdk/resourcemanager/privatedns/armprivatedns/go.sum index 4f0fb709cf31..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/go.sum +++ b/sdk/resourcemanager/privatedns/armprivatedns/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible h1:Cw16jiP4dI+CK761aq44ol4RV5dUiIIXky1+EKpoiVM= -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_constants.go b/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_constants.go index 7c92b4da5f3e..433f2d4f5bd2 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_constants.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_constants.go @@ -10,7 +10,7 @@ package armprivatedns const ( module = "armprivatedns" - version = "v0.1.0" + version = "v0.2.0" ) // ProvisioningState - The provisioning state of the resource. This is a read-only property and any attempt to set this value will be ignored. diff --git a/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_models.go b/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_models.go index 81c0d2a02fe4..cb5b668e217f 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_models.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_models.go @@ -10,9 +10,8 @@ package armprivatedns import ( "encoding/json" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" ) // ARecord - An A record. diff --git a/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_pagers.go b/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_pagers.go index d7fecf0405dc..4d5f6a0da85f 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_pagers.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armprivatedns import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // PrivateZonesListByResourceGroupPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_pollers.go b/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_pollers.go index 9481eb4e6bf4..ae0e1d1b04c3 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_pollers.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armprivatedns import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // PrivateZonesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_privatezones_client.go b/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_privatezones_client.go index 8cdd4772f1d2..09c5c3d462b1 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_privatezones_client.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_privatezones_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // PrivateZonesClient contains the methods for the PrivateZones group. @@ -32,8 +32,15 @@ type PrivateZonesClient struct { } // NewPrivateZonesClient creates a new instance of PrivateZonesClient with the specified values. -func NewPrivateZonesClient(con *arm.Connection, subscriptionID string) *PrivateZonesClient { - return &PrivateZonesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateZonesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateZonesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateZonesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a Private DNS zone. Does not modify Links to virtual networks or DNS records within the zone. @@ -248,7 +255,7 @@ func (client *PrivateZonesClient) getCreateRequest(ctx context.Context, resource func (client *PrivateZonesClient) getHandleResponse(resp *http.Response) (PrivateZonesGetResponse, error) { result := PrivateZonesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateZone); err != nil { - return PrivateZonesGetResponse{}, err + return PrivateZonesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -305,7 +312,7 @@ func (client *PrivateZonesClient) listCreateRequest(ctx context.Context, options func (client *PrivateZonesClient) listHandleResponse(resp *http.Response) (PrivateZonesListResponse, error) { result := PrivateZonesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateZoneListResult); err != nil { - return PrivateZonesListResponse{}, err + return PrivateZonesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -366,7 +373,7 @@ func (client *PrivateZonesClient) listByResourceGroupCreateRequest(ctx context.C func (client *PrivateZonesClient) listByResourceGroupHandleResponse(resp *http.Response) (PrivateZonesListByResourceGroupResponse, error) { result := PrivateZonesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateZoneListResult); err != nil { - return PrivateZonesListByResourceGroupResponse{}, err + return PrivateZonesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_recordsets_client.go b/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_recordsets_client.go index 85a632abb043..6b228479da68 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_recordsets_client.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_recordsets_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // RecordSetsClient contains the methods for the RecordSets group. @@ -31,8 +32,15 @@ type RecordSetsClient struct { } // NewRecordSetsClient creates a new instance of RecordSetsClient with the specified values. -func NewRecordSetsClient(con *arm.Connection, subscriptionID string) *RecordSetsClient { - return &RecordSetsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRecordSetsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RecordSetsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RecordSetsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a record set within a Private DNS zone. @@ -67,9 +75,6 @@ func (client *RecordSetsClient) createOrUpdateCreateRequest(ctx context.Context, return nil, errors.New("parameter recordType cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recordType}", url.PathEscape(string(recordType))) - if relativeRecordSetName == "" { - return nil, errors.New("parameter relativeRecordSetName cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{relativeRecordSetName}", relativeRecordSetName) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -96,7 +101,7 @@ func (client *RecordSetsClient) createOrUpdateCreateRequest(ctx context.Context, func (client *RecordSetsClient) createOrUpdateHandleResponse(resp *http.Response) (RecordSetsCreateOrUpdateResponse, error) { result := RecordSetsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecordSet); err != nil { - return RecordSetsCreateOrUpdateResponse{}, err + return RecordSetsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -146,9 +151,6 @@ func (client *RecordSetsClient) deleteCreateRequest(ctx context.Context, resourc return nil, errors.New("parameter recordType cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recordType}", url.PathEscape(string(recordType))) - if relativeRecordSetName == "" { - return nil, errors.New("parameter relativeRecordSetName cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{relativeRecordSetName}", relativeRecordSetName) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -213,9 +215,6 @@ func (client *RecordSetsClient) getCreateRequest(ctx context.Context, resourceGr return nil, errors.New("parameter recordType cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recordType}", url.PathEscape(string(recordType))) - if relativeRecordSetName == "" { - return nil, errors.New("parameter relativeRecordSetName cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{relativeRecordSetName}", relativeRecordSetName) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -236,7 +235,7 @@ func (client *RecordSetsClient) getCreateRequest(ctx context.Context, resourceGr func (client *RecordSetsClient) getHandleResponse(resp *http.Response) (RecordSetsGetResponse, error) { result := RecordSetsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecordSet); err != nil { - return RecordSetsGetResponse{}, err + return RecordSetsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -304,7 +303,7 @@ func (client *RecordSetsClient) listCreateRequest(ctx context.Context, resourceG func (client *RecordSetsClient) listHandleResponse(resp *http.Response) (RecordSetsListResponse, error) { result := RecordSetsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecordSetListResult); err != nil { - return RecordSetsListResponse{}, err + return RecordSetsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -376,7 +375,7 @@ func (client *RecordSetsClient) listByTypeCreateRequest(ctx context.Context, res func (client *RecordSetsClient) listByTypeHandleResponse(resp *http.Response) (RecordSetsListByTypeResponse, error) { result := RecordSetsListByTypeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecordSetListResult); err != nil { - return RecordSetsListByTypeResponse{}, err + return RecordSetsListByTypeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -426,9 +425,6 @@ func (client *RecordSetsClient) updateCreateRequest(ctx context.Context, resourc return nil, errors.New("parameter recordType cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{recordType}", url.PathEscape(string(recordType))) - if relativeRecordSetName == "" { - return nil, errors.New("parameter relativeRecordSetName cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{relativeRecordSetName}", relativeRecordSetName) if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -452,7 +448,7 @@ func (client *RecordSetsClient) updateCreateRequest(ctx context.Context, resourc func (client *RecordSetsClient) updateHandleResponse(resp *http.Response) (RecordSetsUpdateResponse, error) { result := RecordSetsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecordSet); err != nil { - return RecordSetsUpdateResponse{}, err + return RecordSetsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_response_types.go b/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_response_types.go index b520c50ad0dc..50ba9db120ac 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_response_types.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armprivatedns import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // PrivateZonesCreateOrUpdatePollerResponse contains the response from method PrivateZones.CreateOrUpdate. @@ -26,6 +25,8 @@ type PrivateZonesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateZonesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateZonesCreateOrUpdateResponse, error) { respType := PrivateZonesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateZone) @@ -76,6 +77,8 @@ type PrivateZonesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateZonesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateZonesDeleteResponse, error) { respType := PrivateZonesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -156,6 +159,8 @@ type PrivateZonesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateZonesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateZonesUpdateResponse, error) { respType := PrivateZonesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateZone) @@ -272,6 +277,8 @@ type VirtualNetworkLinksCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkLinksCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkLinksCreateOrUpdateResponse, error) { respType := VirtualNetworkLinksCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualNetworkLink) @@ -322,6 +329,8 @@ type VirtualNetworkLinksDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkLinksDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkLinksDeleteResponse, error) { respType := VirtualNetworkLinksDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -390,6 +399,8 @@ type VirtualNetworkLinksUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkLinksUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkLinksUpdateResponse, error) { respType := VirtualNetworkLinksUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualNetworkLink) diff --git a/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_virtualnetworklinks_client.go b/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_virtualnetworklinks_client.go index ca1eca1c394f..4ba174bc5121 100644 --- a/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_virtualnetworklinks_client.go +++ b/sdk/resourcemanager/privatedns/armprivatedns/zz_generated_virtualnetworklinks_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // VirtualNetworkLinksClient contains the methods for the VirtualNetworkLinks group. @@ -32,8 +32,15 @@ type VirtualNetworkLinksClient struct { } // NewVirtualNetworkLinksClient creates a new instance of VirtualNetworkLinksClient with the specified values. -func NewVirtualNetworkLinksClient(con *arm.Connection, subscriptionID string) *VirtualNetworkLinksClient { - return &VirtualNetworkLinksClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualNetworkLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualNetworkLinksClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualNetworkLinksClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a virtual network link to the specified Private DNS zone. @@ -260,7 +267,7 @@ func (client *VirtualNetworkLinksClient) getCreateRequest(ctx context.Context, r func (client *VirtualNetworkLinksClient) getHandleResponse(resp *http.Response) (VirtualNetworkLinksGetResponse, error) { result := VirtualNetworkLinksGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkLink); err != nil { - return VirtualNetworkLinksGetResponse{}, err + return VirtualNetworkLinksGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -325,7 +332,7 @@ func (client *VirtualNetworkLinksClient) listCreateRequest(ctx context.Context, func (client *VirtualNetworkLinksClient) listHandleResponse(resp *http.Response) (VirtualNetworkLinksListResponse, error) { result := VirtualNetworkLinksListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkLinkListResult); err != nil { - return VirtualNetworkLinksListResponse{}, err + return VirtualNetworkLinksListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/CHANGELOG.md b/sdk/resourcemanager/recoveryservices/armrecoveryservices/CHANGELOG.md index 2276a757fdd8..626bf7231e27 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/CHANGELOG.md +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-20) diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/README.md b/sdk/resourcemanager/recoveryservices/armrecoveryservices/README.md index aca1ef8d2fdf..3b982f9a41a5 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/README.md +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Recovery Services +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Recovery Services modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armrecoveryservices.NewVaultCertificatesClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Recovery Services modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armrecoveryservices.NewVaultCertificatesClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armrecoveryservices.NewVaultCertificatesClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/autorest.md b/sdk/resourcemanager/recoveryservices/armrecoveryservices/autorest.md index de7c8fa41378..b72223d112d3 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/autorest.md +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/autorest.md @@ -5,10 +5,10 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/314f28163917b9cfc527f7776b5e4a1dea69d295/specification/recoveryservices/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/314f28163917b9cfc527f7776b5e4a1dea69d295/specification/recoveryservices/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/recoveryservices/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/recoveryservices/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 directive: - from: vaults.json where: '$.paths["/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.RecoveryServices/vaults/{vaultName}/operationStatus/{operationId}"].get' diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/go.mod b/sdk/resourcemanager/recoveryservices/armrecoveryservices/go.mod index 4cd0def017eb..ccce1cd797a2 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/go.mod +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/recoveryservices/ar go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.1.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/go.sum b/sdk/resourcemanager/recoveryservices/armrecoveryservices/go.sum index f37ba2aef08b..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/go.sum +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible h1:WFsr3Efy7uweykOAEfOHO3ACtuwIv+rrFmSn9K48VnA= -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_constants.go b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_constants.go index 0450b6142300..f2ac4e16f74b 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_constants.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_constants.go @@ -10,7 +10,7 @@ package armrecoveryservices const ( module = "armrecoveryservices" - version = "v0.1.1" + version = "v0.2.0" ) // AuthType - Specifies the authentication type. diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_models.go b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_models.go index a6ac472b2191..e076c0bdb46f 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_models.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_models.go @@ -10,11 +10,10 @@ package armrecoveryservices import ( "encoding/json" - "reflect" - "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "reflect" + "time" ) // CertificateRequest - Details of the certificate to be uploaded to the vault. @@ -278,11 +277,11 @@ type OperationResource struct { // MarshalJSON implements the json.Marshaller interface for type OperationResource. func (o OperationResource) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "endTime", (*timeRFC3339)(o.EndTime)) + populateTimeRFC3339(objectMap, "endTime", o.EndTime) populate(objectMap, "error", o.Error) populate(objectMap, "id", o.ID) populate(objectMap, "name", o.Name) - populate(objectMap, "startTime", (*timeRFC3339)(o.StartTime)) + populateTimeRFC3339(objectMap, "startTime", o.StartTime) populate(objectMap, "status", o.Status) return json.Marshal(objectMap) } @@ -297,9 +296,7 @@ func (o *OperationResource) UnmarshalJSON(data []byte) error { var err error switch key { case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - o.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &o.EndTime) delete(rawMsg, key) case "error": err = unpopulate(val, &o.Error) @@ -311,9 +308,7 @@ func (o *OperationResource) UnmarshalJSON(data []byte) error { err = unpopulate(val, &o.Name) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - o.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &o.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &o.Status) @@ -803,8 +798,8 @@ func (r ResourceCertificateDetails) marshalInternal(objectMap map[string]interfa populate(objectMap, "resourceId", r.ResourceID) populate(objectMap, "subject", r.Subject) populate(objectMap, "thumbprint", r.Thumbprint) - populate(objectMap, "validFrom", (*timeRFC3339)(r.ValidFrom)) - populate(objectMap, "validTo", (*timeRFC3339)(r.ValidTo)) + populateTimeRFC3339(objectMap, "validFrom", r.ValidFrom) + populateTimeRFC3339(objectMap, "validTo", r.ValidTo) } func (r *ResourceCertificateDetails) unmarshalInternal(rawMsg map[string]json.RawMessage) error { @@ -833,14 +828,10 @@ func (r *ResourceCertificateDetails) unmarshalInternal(rawMsg map[string]json.Ra err = unpopulate(val, &r.Thumbprint) delete(rawMsg, key) case "validFrom": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.ValidFrom = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.ValidFrom) delete(rawMsg, key) case "validTo": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.ValidTo = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.ValidTo) delete(rawMsg, key) } if err != nil { @@ -892,10 +883,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -911,9 +902,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -922,9 +911,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) @@ -996,12 +983,12 @@ type UpgradeDetails struct { // MarshalJSON implements the json.Marshaller interface for type UpgradeDetails. func (u UpgradeDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "endTimeUtc", (*timeRFC3339)(u.EndTimeUTC)) - populate(objectMap, "lastUpdatedTimeUtc", (*timeRFC3339)(u.LastUpdatedTimeUTC)) + populateTimeRFC3339(objectMap, "endTimeUtc", u.EndTimeUTC) + populateTimeRFC3339(objectMap, "lastUpdatedTimeUtc", u.LastUpdatedTimeUTC) populate(objectMap, "message", u.Message) populate(objectMap, "operationId", u.OperationID) populate(objectMap, "previousResourceId", u.PreviousResourceID) - populate(objectMap, "startTimeUtc", (*timeRFC3339)(u.StartTimeUTC)) + populateTimeRFC3339(objectMap, "startTimeUtc", u.StartTimeUTC) populate(objectMap, "status", u.Status) populate(objectMap, "triggerType", u.TriggerType) populate(objectMap, "upgradedResourceId", u.UpgradedResourceID) @@ -1018,14 +1005,10 @@ func (u *UpgradeDetails) UnmarshalJSON(data []byte) error { var err error switch key { case "endTimeUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - u.EndTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &u.EndTimeUTC) delete(rawMsg, key) case "lastUpdatedTimeUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - u.LastUpdatedTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &u.LastUpdatedTimeUTC) delete(rawMsg, key) case "message": err = unpopulate(val, &u.Message) @@ -1037,9 +1020,7 @@ func (u *UpgradeDetails) UnmarshalJSON(data []byte) error { err = unpopulate(val, &u.PreviousResourceID) delete(rawMsg, key) case "startTimeUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - u.StartTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &u.StartTimeUTC) delete(rawMsg, key) case "status": err = unpopulate(val, &u.Status) @@ -1293,10 +1274,10 @@ type VaultPropertiesMoveDetails struct { // MarshalJSON implements the json.Marshaller interface for type VaultPropertiesMoveDetails. func (v VaultPropertiesMoveDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "completionTimeUtc", (*timeRFC3339)(v.CompletionTimeUTC)) + populateTimeRFC3339(objectMap, "completionTimeUtc", v.CompletionTimeUTC) populate(objectMap, "operationId", v.OperationID) populate(objectMap, "sourceResourceId", v.SourceResourceID) - populate(objectMap, "startTimeUtc", (*timeRFC3339)(v.StartTimeUTC)) + populateTimeRFC3339(objectMap, "startTimeUtc", v.StartTimeUTC) populate(objectMap, "targetResourceId", v.TargetResourceID) return json.Marshal(objectMap) } @@ -1311,9 +1292,7 @@ func (v *VaultPropertiesMoveDetails) UnmarshalJSON(data []byte) error { var err error switch key { case "completionTimeUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - v.CompletionTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &v.CompletionTimeUTC) delete(rawMsg, key) case "operationId": err = unpopulate(val, &v.OperationID) @@ -1322,9 +1301,7 @@ func (v *VaultPropertiesMoveDetails) UnmarshalJSON(data []byte) error { err = unpopulate(val, &v.SourceResourceID) delete(rawMsg, key) case "startTimeUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - v.StartTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &v.StartTimeUTC) delete(rawMsg, key) case "targetResourceId": err = unpopulate(val, &v.TargetResourceID) @@ -1364,7 +1341,7 @@ func (v VaultUsage) MarshalJSON() ([]byte, error) { populate(objectMap, "currentValue", v.CurrentValue) populate(objectMap, "limit", v.Limit) populate(objectMap, "name", v.Name) - populate(objectMap, "nextResetTime", (*timeRFC3339)(v.NextResetTime)) + populateTimeRFC3339(objectMap, "nextResetTime", v.NextResetTime) populate(objectMap, "quotaPeriod", v.QuotaPeriod) populate(objectMap, "unit", v.Unit) return json.Marshal(objectMap) @@ -1389,9 +1366,7 @@ func (v *VaultUsage) UnmarshalJSON(data []byte) error { err = unpopulate(val, &v.Name) delete(rawMsg, key) case "nextResetTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - v.NextResetTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &v.NextResetTime) delete(rawMsg, key) case "quotaPeriod": err = unpopulate(val, &v.QuotaPeriod) diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_operations_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_operations_client.go index 43082345053e..abe3a2347c9b 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_operations_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_operations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // OperationsClient contains the methods for the Operations group. @@ -30,8 +31,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection, subscriptionID string) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetOperationResult - Gets the operation result for a resource. @@ -85,7 +93,7 @@ func (client *OperationsClient) getOperationResultCreateRequest(ctx context.Cont func (client *OperationsClient) getOperationResultHandleResponse(resp *http.Response) (OperationsGetOperationResultResponse, error) { result := OperationsGetOperationResultResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Vault); err != nil { - return OperationsGetOperationResultResponse{}, err + return OperationsGetOperationResultResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -135,7 +143,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ClientDiscoveryResponse); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -204,7 +212,7 @@ func (client *OperationsClient) operationStatusGetCreateRequest(ctx context.Cont func (client *OperationsClient) operationStatusGetHandleResponse(resp *http.Response) (OperationsOperationStatusGetResponse, error) { result := OperationsOperationStatusGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationResource); err != nil { - return OperationsOperationStatusGetResponse{}, err + return OperationsOperationStatusGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_pagers.go b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_pagers.go index 930afde5d8f2..d5f914b04a11 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_pagers.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armrecoveryservices import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // OperationsListPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_pollers.go b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_pollers.go index 02d04808b55c..3a4c809e02c8 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_pollers.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armrecoveryservices import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // VaultsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_polymorphic_helpers.go index 3e2a592e2645..456b7f2030ed 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_polymorphic_helpers.go @@ -48,3 +48,22 @@ func unmarshalResourceCertificateDetailsClassificationArray(rawMsg json.RawMessa } return fArray, nil } + +func unmarshalResourceCertificateDetailsClassificationMap(rawMsg json.RawMessage) (map[string]ResourceCertificateDetailsClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ResourceCertificateDetailsClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalResourceCertificateDetailsClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_privatelinkresources_client.go index 463510da02bc..daf503a7c006 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_privatelinkresources_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. @@ -30,8 +31,15 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { - return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Returns a specified private link resource that need to be created for Backup and SiteRecovery @@ -85,7 +93,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesGetResponse, error) { result := PrivateLinkResourcesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { - return PrivateLinkResourcesGetResponse{}, err + return PrivateLinkResourcesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -147,7 +155,7 @@ func (client *PrivateLinkResourcesClient) listCreateRequest(ctx context.Context, func (client *PrivateLinkResourcesClient) listHandleResponse(resp *http.Response) (PrivateLinkResourcesListResponse, error) { result := PrivateLinkResourcesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResources); err != nil { - return PrivateLinkResourcesListResponse{}, err + return PrivateLinkResourcesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_recoveryservices_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_recoveryservices_client.go index de2069ad133d..8a241c5dc54a 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_recoveryservices_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_recoveryservices_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RecoveryServicesClient contains the methods for the RecoveryServices group. @@ -30,8 +31,15 @@ type RecoveryServicesClient struct { } // NewRecoveryServicesClient creates a new instance of RecoveryServicesClient with the specified values. -func NewRecoveryServicesClient(con *arm.Connection, subscriptionID string) *RecoveryServicesClient { - return &RecoveryServicesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRecoveryServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RecoveryServicesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RecoveryServicesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNameAvailability - API to check for resource name availability. A name is available if no other resource exists that has the same SubscriptionId, @@ -83,7 +91,7 @@ func (client *RecoveryServicesClient) checkNameAvailabilityCreateRequest(ctx con func (client *RecoveryServicesClient) checkNameAvailabilityHandleResponse(resp *http.Response) (RecoveryServicesCheckNameAvailabilityResponse, error) { result := RecoveryServicesCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResult); err != nil { - return RecoveryServicesCheckNameAvailabilityResponse{}, err + return RecoveryServicesCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_registeredidentities_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_registeredidentities_client.go index f645ffd067e3..9e472a2cb143 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_registeredidentities_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_registeredidentities_client.go @@ -11,13 +11,14 @@ package armrecoveryservices import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RegisteredIdentitiesClient contains the methods for the RegisteredIdentities group. @@ -29,8 +30,15 @@ type RegisteredIdentitiesClient struct { } // NewRegisteredIdentitiesClient creates a new instance of RegisteredIdentitiesClient with the specified values. -func NewRegisteredIdentitiesClient(con *arm.Connection, subscriptionID string) *RegisteredIdentitiesClient { - return &RegisteredIdentitiesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRegisteredIdentitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RegisteredIdentitiesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RegisteredIdentitiesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Delete - Unregisters the given container from your Recovery Services vault. diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_replicationusages_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_replicationusages_client.go index 5ab31475b212..ad6eacef1a93 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_replicationusages_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_replicationusages_client.go @@ -11,13 +11,14 @@ package armrecoveryservices import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ReplicationUsagesClient contains the methods for the ReplicationUsages group. @@ -29,8 +30,15 @@ type ReplicationUsagesClient struct { } // NewReplicationUsagesClient creates a new instance of ReplicationUsagesClient with the specified values. -func NewReplicationUsagesClient(con *arm.Connection, subscriptionID string) *ReplicationUsagesClient { - return &ReplicationUsagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewReplicationUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ReplicationUsagesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ReplicationUsagesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Fetches the replication usages of the vault. @@ -80,7 +88,7 @@ func (client *ReplicationUsagesClient) listCreateRequest(ctx context.Context, re func (client *ReplicationUsagesClient) listHandleResponse(resp *http.Response) (ReplicationUsagesListResponse, error) { result := ReplicationUsagesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReplicationUsageList); err != nil { - return ReplicationUsagesListResponse{}, err + return ReplicationUsagesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_response_types.go b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_response_types.go index 85030504ad6d..b6ec9fb6868a 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_response_types.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armrecoveryservices import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // OperationsGetOperationResultResponse contains the response from method Operations.GetOperationResult. @@ -176,6 +175,8 @@ type VaultsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VaultsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VaultsCreateOrUpdateResponse, error) { respType := VaultsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Vault) @@ -268,6 +269,8 @@ type VaultsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VaultsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VaultsUpdateResponse, error) { respType := VaultsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Vault) diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_time_rfc3339.go b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_time_rfc3339.go index ee896df40de3..4a877e891d2a 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armrecoveryservices import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_usages_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_usages_client.go index 8ef3674fe914..bf6f89c439f9 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_usages_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_usages_client.go @@ -11,13 +11,14 @@ package armrecoveryservices import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // UsagesClient contains the methods for the Usages group. @@ -29,8 +30,15 @@ type UsagesClient struct { } // NewUsagesClient creates a new instance of UsagesClient with the specified values. -func NewUsagesClient(con *arm.Connection, subscriptionID string) *UsagesClient { - return &UsagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UsagesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &UsagesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByVaults - Fetches the usages of the vault. @@ -80,7 +88,7 @@ func (client *UsagesClient) listByVaultsCreateRequest(ctx context.Context, resou func (client *UsagesClient) listByVaultsHandleResponse(resp *http.Response) (UsagesListByVaultsResponse, error) { result := UsagesListByVaultsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VaultUsageList); err != nil { - return UsagesListByVaultsResponse{}, err + return UsagesListByVaultsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_vaultcertificates_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_vaultcertificates_client.go index 84713e4acb30..529f4d5d44b3 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_vaultcertificates_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_vaultcertificates_client.go @@ -11,13 +11,14 @@ package armrecoveryservices import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VaultCertificatesClient contains the methods for the VaultCertificates group. @@ -29,8 +30,15 @@ type VaultCertificatesClient struct { } // NewVaultCertificatesClient creates a new instance of VaultCertificatesClient with the specified values. -func NewVaultCertificatesClient(con *arm.Connection, subscriptionID string) *VaultCertificatesClient { - return &VaultCertificatesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVaultCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VaultCertificatesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VaultCertificatesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Uploads a certificate for a resource. @@ -84,7 +92,7 @@ func (client *VaultCertificatesClient) createCreateRequest(ctx context.Context, func (client *VaultCertificatesClient) createHandleResponse(resp *http.Response) (VaultCertificatesCreateResponse, error) { result := VaultCertificatesCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VaultCertificateResponse); err != nil { - return VaultCertificatesCreateResponse{}, err + return VaultCertificatesCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_vaultextendedinfo_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_vaultextendedinfo_client.go index 372f64aea3f5..96da5f84d05e 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_vaultextendedinfo_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_vaultextendedinfo_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VaultExtendedInfoClient contains the methods for the VaultExtendedInfo group. @@ -30,8 +31,15 @@ type VaultExtendedInfoClient struct { } // NewVaultExtendedInfoClient creates a new instance of VaultExtendedInfoClient with the specified values. -func NewVaultExtendedInfoClient(con *arm.Connection, subscriptionID string) *VaultExtendedInfoClient { - return &VaultExtendedInfoClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVaultExtendedInfoClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VaultExtendedInfoClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VaultExtendedInfoClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create vault extended info. @@ -81,7 +89,7 @@ func (client *VaultExtendedInfoClient) createOrUpdateCreateRequest(ctx context.C func (client *VaultExtendedInfoClient) createOrUpdateHandleResponse(resp *http.Response) (VaultExtendedInfoCreateOrUpdateResponse, error) { result := VaultExtendedInfoCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VaultExtendedInfoResource); err != nil { - return VaultExtendedInfoCreateOrUpdateResponse{}, err + return VaultExtendedInfoCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -146,7 +154,7 @@ func (client *VaultExtendedInfoClient) getCreateRequest(ctx context.Context, res func (client *VaultExtendedInfoClient) getHandleResponse(resp *http.Response) (VaultExtendedInfoGetResponse, error) { result := VaultExtendedInfoGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VaultExtendedInfoResource); err != nil { - return VaultExtendedInfoGetResponse{}, err + return VaultExtendedInfoGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -211,7 +219,7 @@ func (client *VaultExtendedInfoClient) updateCreateRequest(ctx context.Context, func (client *VaultExtendedInfoClient) updateHandleResponse(resp *http.Response) (VaultExtendedInfoUpdateResponse, error) { result := VaultExtendedInfoUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VaultExtendedInfoResource); err != nil { - return VaultExtendedInfoUpdateResponse{}, err + return VaultExtendedInfoUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_vaults_client.go b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_vaults_client.go index 48d1a7565e3b..fe452ad95393 100644 --- a/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_vaults_client.go +++ b/sdk/resourcemanager/recoveryservices/armrecoveryservices/zz_generated_vaults_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VaultsClient contains the methods for the Vaults group. @@ -31,8 +31,15 @@ type VaultsClient struct { } // NewVaultsClient creates a new instance of VaultsClient with the specified values. -func NewVaultsClient(con *arm.Connection, subscriptionID string) *VaultsClient { - return &VaultsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVaultsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VaultsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VaultsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a Recovery Services vault. @@ -214,7 +221,7 @@ func (client *VaultsClient) getCreateRequest(ctx context.Context, resourceGroupN func (client *VaultsClient) getHandleResponse(resp *http.Response) (VaultsGetResponse, error) { result := VaultsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Vault); err != nil { - return VaultsGetResponse{}, err + return VaultsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -272,7 +279,7 @@ func (client *VaultsClient) listByResourceGroupCreateRequest(ctx context.Context func (client *VaultsClient) listByResourceGroupHandleResponse(resp *http.Response) (VaultsListByResourceGroupResponse, error) { result := VaultsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VaultList); err != nil { - return VaultsListByResourceGroupResponse{}, err + return VaultsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -326,7 +333,7 @@ func (client *VaultsClient) listBySubscriptionIDCreateRequest(ctx context.Contex func (client *VaultsClient) listBySubscriptionIDHandleResponse(resp *http.Response) (VaultsListBySubscriptionIDResponse, error) { result := VaultsListBySubscriptionIDResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VaultList); err != nil { - return VaultsListBySubscriptionIDResponse{}, err + return VaultsListBySubscriptionIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/redis/armredis/CHANGELOG.md b/sdk/resourcemanager/redis/armredis/CHANGELOG.md index 7f6040a84709..aad0f4db541d 100644 --- a/sdk/resourcemanager/redis/armredis/CHANGELOG.md +++ b/sdk/resourcemanager/redis/armredis/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-10-08) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redis/armredis". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/redis/armredis") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/redis/armredis/README.md b/sdk/resourcemanager/redis/armredis/README.md index ab03ba9548ae..d97e8b1311a1 100644 --- a/sdk/resourcemanager/redis/armredis/README.md +++ b/sdk/resourcemanager/redis/armredis/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Cache for Redis +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Cache for Redis modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armredis.NewPrivateEndpointConnectionsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Cache for Redis modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armredis.NewPrivateEndpointConnectionsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armredis.NewPrivateEndpointConnectionsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/redis/armredis/autorest.md b/sdk/resourcemanager/redis/armredis/autorest.md index dc9cf8b9bf50..967f42babc12 100644 --- a/sdk/resourcemanager/redis/armredis/autorest.md +++ b/sdk/resourcemanager/redis/armredis/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/redis/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/redis/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/redis/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/redis/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/redis/armredis/go.mod b/sdk/resourcemanager/redis/armredis/go.mod index 7bd37db757be..377d18a219f3 100644 --- a/sdk/resourcemanager/redis/armredis/go.mod +++ b/sdk/resourcemanager/redis/armredis/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/redis/armredis go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/redis/armredis/go.sum b/sdk/resourcemanager/redis/armredis/go.sum index 4f0fb709cf31..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/redis/armredis/go.sum +++ b/sdk/resourcemanager/redis/armredis/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible h1:Cw16jiP4dI+CK761aq44ol4RV5dUiIIXky1+EKpoiVM= -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/redis/armredis/zz_generated_constants.go b/sdk/resourcemanager/redis/armredis/zz_generated_constants.go index 0d880e363a5e..6bd0dbcc558b 100644 --- a/sdk/resourcemanager/redis/armredis/zz_generated_constants.go +++ b/sdk/resourcemanager/redis/armredis/zz_generated_constants.go @@ -10,7 +10,7 @@ package armredis const ( module = "armredis" - version = "v0.1.0" + version = "v0.2.0" ) // DayOfWeek - Day of the week when a cache can be patched. diff --git a/sdk/resourcemanager/redis/armredis/zz_generated_firewallrules_client.go b/sdk/resourcemanager/redis/armredis/zz_generated_firewallrules_client.go index 4820a2c4cd75..d67d2d85a291 100644 --- a/sdk/resourcemanager/redis/armredis/zz_generated_firewallrules_client.go +++ b/sdk/resourcemanager/redis/armredis/zz_generated_firewallrules_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // FirewallRulesClient contains the methods for the FirewallRules group. @@ -30,8 +31,15 @@ type FirewallRulesClient struct { } // NewFirewallRulesClient creates a new instance of FirewallRulesClient with the specified values. -func NewFirewallRulesClient(con *arm.Connection, subscriptionID string) *FirewallRulesClient { - return &FirewallRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FirewallRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FirewallRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update a redis cache firewall rule @@ -85,7 +93,7 @@ func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Conte func (client *FirewallRulesClient) createOrUpdateHandleResponse(resp *http.Response) (FirewallRulesCreateOrUpdateResponse, error) { result := FirewallRulesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RedisFirewallRule); err != nil { - return FirewallRulesCreateOrUpdateResponse{}, err + return FirewallRulesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourc func (client *FirewallRulesClient) getHandleResponse(resp *http.Response) (FirewallRulesGetResponse, error) { result := FirewallRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RedisFirewallRule); err != nil { - return FirewallRulesGetResponse{}, err + return FirewallRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -276,7 +284,7 @@ func (client *FirewallRulesClient) listCreateRequest(ctx context.Context, resour func (client *FirewallRulesClient) listHandleResponse(resp *http.Response) (FirewallRulesListResponse, error) { result := FirewallRulesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RedisFirewallRuleListResult); err != nil { - return FirewallRulesListResponse{}, err + return FirewallRulesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/redis/armredis/zz_generated_linkedserver_client.go b/sdk/resourcemanager/redis/armredis/zz_generated_linkedserver_client.go index 6e10d604bbaf..ebcee67e967b 100644 --- a/sdk/resourcemanager/redis/armredis/zz_generated_linkedserver_client.go +++ b/sdk/resourcemanager/redis/armredis/zz_generated_linkedserver_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LinkedServerClient contains the methods for the LinkedServer group. @@ -31,8 +31,15 @@ type LinkedServerClient struct { } // NewLinkedServerClient creates a new instance of LinkedServerClient with the specified values. -func NewLinkedServerClient(con *arm.Connection, subscriptionID string) *LinkedServerClient { - return &LinkedServerClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLinkedServerClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LinkedServerClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LinkedServerClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Adds a linked server to the Redis cache (requires Premium SKU). @@ -226,7 +233,7 @@ func (client *LinkedServerClient) getCreateRequest(ctx context.Context, resource func (client *LinkedServerClient) getHandleResponse(resp *http.Response) (LinkedServerGetResponse, error) { result := LinkedServerGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RedisLinkedServerWithProperties); err != nil { - return LinkedServerGetResponse{}, err + return LinkedServerGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -288,7 +295,7 @@ func (client *LinkedServerClient) listCreateRequest(ctx context.Context, resourc func (client *LinkedServerClient) listHandleResponse(resp *http.Response) (LinkedServerListResponse, error) { result := LinkedServerListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RedisLinkedServerWithPropertiesList); err != nil { - return LinkedServerListResponse{}, err + return LinkedServerListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/redis/armredis/zz_generated_models.go b/sdk/resourcemanager/redis/armredis/zz_generated_models.go index abdf08e65192..0215d821be4c 100644 --- a/sdk/resourcemanager/redis/armredis/zz_generated_models.go +++ b/sdk/resourcemanager/redis/armredis/zz_generated_models.go @@ -10,10 +10,9 @@ package armredis import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // CheckNameAvailabilityParameters - Parameters body to pass for resource name availability check. @@ -1087,7 +1086,7 @@ type UpgradeNotification struct { func (u UpgradeNotification) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "name", u.Name) - populate(objectMap, "timestamp", (*timeRFC3339)(u.Timestamp)) + populateTimeRFC3339(objectMap, "timestamp", u.Timestamp) populate(objectMap, "upsellNotification", u.UpsellNotification) return json.Marshal(objectMap) } @@ -1105,9 +1104,7 @@ func (u *UpgradeNotification) UnmarshalJSON(data []byte) error { err = unpopulate(val, &u.Name) delete(rawMsg, key) case "timestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - u.Timestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &u.Timestamp) delete(rawMsg, key) case "upsellNotification": err = unpopulate(val, &u.UpsellNotification) diff --git a/sdk/resourcemanager/redis/armredis/zz_generated_operations_client.go b/sdk/resourcemanager/redis/armredis/zz_generated_operations_client.go index f718635af7eb..912aff67a69f 100644 --- a/sdk/resourcemanager/redis/armredis/zz_generated_operations_client.go +++ b/sdk/resourcemanager/redis/armredis/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armredis import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available REST API operations of the Microsoft.Cache provider. @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/redis/armredis/zz_generated_pagers.go b/sdk/resourcemanager/redis/armredis/zz_generated_pagers.go index 46feecd2b47e..51e4885ad5a7 100644 --- a/sdk/resourcemanager/redis/armredis/zz_generated_pagers.go +++ b/sdk/resourcemanager/redis/armredis/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armredis import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // FirewallRulesListPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/redis/armredis/zz_generated_patchschedules_client.go b/sdk/resourcemanager/redis/armredis/zz_generated_patchschedules_client.go index 807ef39b698c..2b44da81397d 100644 --- a/sdk/resourcemanager/redis/armredis/zz_generated_patchschedules_client.go +++ b/sdk/resourcemanager/redis/armredis/zz_generated_patchschedules_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PatchSchedulesClient contains the methods for the PatchSchedules group. @@ -30,8 +31,15 @@ type PatchSchedulesClient struct { } // NewPatchSchedulesClient creates a new instance of PatchSchedulesClient with the specified values. -func NewPatchSchedulesClient(con *arm.Connection, subscriptionID string) *PatchSchedulesClient { - return &PatchSchedulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPatchSchedulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PatchSchedulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PatchSchedulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or replace the patching schedule for Redis cache. @@ -85,7 +93,7 @@ func (client *PatchSchedulesClient) createOrUpdateCreateRequest(ctx context.Cont func (client *PatchSchedulesClient) createOrUpdateHandleResponse(resp *http.Response) (PatchSchedulesCreateOrUpdateResponse, error) { result := PatchSchedulesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RedisPatchSchedule); err != nil { - return PatchSchedulesCreateOrUpdateResponse{}, err + return PatchSchedulesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *PatchSchedulesClient) getCreateRequest(ctx context.Context, resour func (client *PatchSchedulesClient) getHandleResponse(resp *http.Response) (PatchSchedulesGetResponse, error) { result := PatchSchedulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RedisPatchSchedule); err != nil { - return PatchSchedulesGetResponse{}, err + return PatchSchedulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -276,7 +284,7 @@ func (client *PatchSchedulesClient) listByRedisResourceCreateRequest(ctx context func (client *PatchSchedulesClient) listByRedisResourceHandleResponse(resp *http.Response) (PatchSchedulesListByRedisResourceResponse, error) { result := PatchSchedulesListByRedisResourceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RedisPatchScheduleListResult); err != nil { - return PatchSchedulesListByRedisResourceResponse{}, err + return PatchSchedulesListByRedisResourceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/redis/armredis/zz_generated_pollers.go b/sdk/resourcemanager/redis/armredis/zz_generated_pollers.go index a90f34cc92d5..d8740fd6041d 100644 --- a/sdk/resourcemanager/redis/armredis/zz_generated_pollers.go +++ b/sdk/resourcemanager/redis/armredis/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armredis import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // LinkedServerCreatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/redis/armredis/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/redis/armredis/zz_generated_privateendpointconnections_client.go index b00948ced1c8..59f6447e3226 100644 --- a/sdk/resourcemanager/redis/armredis/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/redis/armredis/zz_generated_privateendpointconnections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. @@ -31,8 +31,15 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { - return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Delete - Deletes the specified private endpoint connection associated with the redis cache. @@ -146,7 +153,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsGetResponse{}, err + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -211,7 +218,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListResponse, error) { result := PrivateEndpointConnectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionsListResponse{}, err + return PrivateEndpointConnectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/redis/armredis/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/redis/armredis/zz_generated_privatelinkresources_client.go index b5e8dabde974..a80b40861d1b 100644 --- a/sdk/resourcemanager/redis/armredis/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/redis/armredis/zz_generated_privatelinkresources_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. @@ -30,8 +31,15 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { - return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByRedisCache - Gets the private link resources that need to be created for a redis cache. @@ -81,7 +89,7 @@ func (client *PrivateLinkResourcesClient) listByRedisCacheCreateRequest(ctx cont func (client *PrivateLinkResourcesClient) listByRedisCacheHandleResponse(resp *http.Response) (PrivateLinkResourcesListByRedisCacheResponse, error) { result := PrivateLinkResourcesListByRedisCacheResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { - return PrivateLinkResourcesListByRedisCacheResponse{}, err + return PrivateLinkResourcesListByRedisCacheResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/redis/armredis/zz_generated_redis_client.go b/sdk/resourcemanager/redis/armredis/zz_generated_redis_client.go index 37690a4a54f2..27c6e83d5fb9 100644 --- a/sdk/resourcemanager/redis/armredis/zz_generated_redis_client.go +++ b/sdk/resourcemanager/redis/armredis/zz_generated_redis_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // RedisClient contains the methods for the Redis group. @@ -32,8 +32,15 @@ type RedisClient struct { } // NewRedisClient creates a new instance of RedisClient with the specified values. -func NewRedisClient(con *arm.Connection, subscriptionID string) *RedisClient { - return &RedisClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRedisClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RedisClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RedisClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNameAvailability - Checks that the redis cache name is valid and is not already in use. @@ -359,7 +366,7 @@ func (client *RedisClient) forceRebootCreateRequest(ctx context.Context, resourc func (client *RedisClient) forceRebootHandleResponse(resp *http.Response) (RedisForceRebootResponseEnvelope, error) { result := RedisForceRebootResponseEnvelope{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RedisForceRebootResponse); err != nil { - return RedisForceRebootResponseEnvelope{}, err + return RedisForceRebootResponseEnvelope{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -424,7 +431,7 @@ func (client *RedisClient) getCreateRequest(ctx context.Context, resourceGroupNa func (client *RedisClient) getHandleResponse(resp *http.Response) (RedisGetResponse, error) { result := RedisGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RedisResource); err != nil { - return RedisGetResponse{}, err + return RedisGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -558,7 +565,7 @@ func (client *RedisClient) listByResourceGroupCreateRequest(ctx context.Context, func (client *RedisClient) listByResourceGroupHandleResponse(resp *http.Response) (RedisListByResourceGroupResponse, error) { result := RedisListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RedisListResult); err != nil { - return RedisListByResourceGroupResponse{}, err + return RedisListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -612,7 +619,7 @@ func (client *RedisClient) listBySubscriptionCreateRequest(ctx context.Context, func (client *RedisClient) listBySubscriptionHandleResponse(resp *http.Response) (RedisListBySubscriptionResponse, error) { result := RedisListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RedisListResult); err != nil { - return RedisListBySubscriptionResponse{}, err + return RedisListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -677,7 +684,7 @@ func (client *RedisClient) listKeysCreateRequest(ctx context.Context, resourceGr func (client *RedisClient) listKeysHandleResponse(resp *http.Response) (RedisListKeysResponse, error) { result := RedisListKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RedisAccessKeys); err != nil { - return RedisListKeysResponse{}, err + return RedisListKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -740,7 +747,7 @@ func (client *RedisClient) listUpgradeNotificationsCreateRequest(ctx context.Con func (client *RedisClient) listUpgradeNotificationsHandleResponse(resp *http.Response) (RedisListUpgradeNotificationsResponse, error) { result := RedisListUpgradeNotificationsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NotificationListResponse); err != nil { - return RedisListUpgradeNotificationsResponse{}, err + return RedisListUpgradeNotificationsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -805,7 +812,7 @@ func (client *RedisClient) regenerateKeyCreateRequest(ctx context.Context, resou func (client *RedisClient) regenerateKeyHandleResponse(resp *http.Response) (RedisRegenerateKeyResponse, error) { result := RedisRegenerateKeyResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RedisAccessKeys); err != nil { - return RedisRegenerateKeyResponse{}, err + return RedisRegenerateKeyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -870,7 +877,7 @@ func (client *RedisClient) updateCreateRequest(ctx context.Context, resourceGrou func (client *RedisClient) updateHandleResponse(resp *http.Response) (RedisUpdateResponse, error) { result := RedisUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RedisResource); err != nil { - return RedisUpdateResponse{}, err + return RedisUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/redis/armredis/zz_generated_response_types.go b/sdk/resourcemanager/redis/armredis/zz_generated_response_types.go index 66ee35129e46..c0962a316b99 100644 --- a/sdk/resourcemanager/redis/armredis/zz_generated_response_types.go +++ b/sdk/resourcemanager/redis/armredis/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armredis import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // FirewallRulesCreateOrUpdateResponse contains the response from method FirewallRules.CreateOrUpdate. @@ -68,6 +67,8 @@ type LinkedServerCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LinkedServerCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LinkedServerCreateResponse, error) { respType := LinkedServerCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RedisLinkedServerWithProperties) @@ -232,6 +233,8 @@ type PrivateEndpointConnectionsPutPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsPutPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsPutResponse, error) { respType := PrivateEndpointConnectionsPutResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) @@ -300,6 +303,8 @@ type RedisCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RedisCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RedisCreateResponse, error) { respType := RedisCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RedisResource) @@ -350,6 +355,8 @@ type RedisDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RedisDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RedisDeleteResponse, error) { respType := RedisDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -394,6 +401,8 @@ type RedisExportDataPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RedisExportDataPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RedisExportDataResponse, error) { respType := RedisExportDataResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -462,6 +471,8 @@ type RedisImportDataPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RedisImportDataPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RedisImportDataResponse, error) { respType := RedisImportDataResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/redis/armredis/zz_generated_time_rfc3339.go b/sdk/resourcemanager/redis/armredis/zz_generated_time_rfc3339.go index e4d061b3fae6..62c1b44fba6d 100644 --- a/sdk/resourcemanager/redis/armredis/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/redis/armredis/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armredis import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/relay/armrelay/CHANGELOG.md b/sdk/resourcemanager/relay/armrelay/CHANGELOG.md index e4f3d9f035c1..6ee9f3587c1a 100644 --- a/sdk/resourcemanager/relay/armrelay/CHANGELOG.md +++ b/sdk/resourcemanager/relay/armrelay/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-26) diff --git a/sdk/resourcemanager/relay/armrelay/README.md b/sdk/resourcemanager/relay/armrelay/README.md index 670dba642153..6b773abc7aa3 100644 --- a/sdk/resourcemanager/relay/armrelay/README.md +++ b/sdk/resourcemanager/relay/armrelay/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Relay +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Relay modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armrelay.NewHybridConnectionsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Relay modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armrelay.NewHybridConnectionsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armrelay.NewHybridConnectionsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/relay/armrelay/autorest.md b/sdk/resourcemanager/relay/armrelay/autorest.md index e19e788c1c8b..16f2d454901a 100644 --- a/sdk/resourcemanager/relay/armrelay/autorest.md +++ b/sdk/resourcemanager/relay/armrelay/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/769e09cac92c50b1f9fa6468775b7cb7de16bb06/specification/relay/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/769e09cac92c50b1f9fa6468775b7cb7de16bb06/specification/relay/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/relay/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/relay/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/relay/armrelay/go.mod b/sdk/resourcemanager/relay/armrelay/go.mod index f4423119de30..8250475a28fa 100644 --- a/sdk/resourcemanager/relay/armrelay/go.mod +++ b/sdk/resourcemanager/relay/armrelay/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/relay/armrelay go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.2.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/relay/armrelay/go.sum b/sdk/resourcemanager/relay/armrelay/go.sum index c8ff7a2143ad..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/relay/armrelay/go.sum +++ b/sdk/resourcemanager/relay/armrelay/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible h1:iCb2tuoEm3N7ZpUDOvu1Yxl1B3iOVDmaD6weaRuIPzs= -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/relay/armrelay/zz_generated_constants.go b/sdk/resourcemanager/relay/armrelay/zz_generated_constants.go index d8c7723b7ee1..95a750a12484 100644 --- a/sdk/resourcemanager/relay/armrelay/zz_generated_constants.go +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_constants.go @@ -10,7 +10,7 @@ package armrelay const ( module = "armrelay" - version = "v0.1.1" + version = "v0.2.0" ) type AccessRights string diff --git a/sdk/resourcemanager/relay/armrelay/zz_generated_hybridconnections_client.go b/sdk/resourcemanager/relay/armrelay/zz_generated_hybridconnections_client.go index 2a2517582a44..fa0211eed2a1 100644 --- a/sdk/resourcemanager/relay/armrelay/zz_generated_hybridconnections_client.go +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_hybridconnections_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // HybridConnectionsClient contains the methods for the HybridConnections group. @@ -30,8 +31,15 @@ type HybridConnectionsClient struct { } // NewHybridConnectionsClient creates a new instance of HybridConnectionsClient with the specified values. -func NewHybridConnectionsClient(con *arm.Connection, subscriptionID string) *HybridConnectionsClient { - return &HybridConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewHybridConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *HybridConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &HybridConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a service hybrid connection. This operation is idempotent. @@ -85,7 +93,7 @@ func (client *HybridConnectionsClient) createOrUpdateCreateRequest(ctx context.C func (client *HybridConnectionsClient) createOrUpdateHandleResponse(resp *http.Response) (HybridConnectionsCreateOrUpdateResponse, error) { result := HybridConnectionsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridConnection); err != nil { - return HybridConnectionsCreateOrUpdateResponse{}, err + return HybridConnectionsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -158,7 +166,7 @@ func (client *HybridConnectionsClient) createOrUpdateAuthorizationRuleCreateRequ func (client *HybridConnectionsClient) createOrUpdateAuthorizationRuleHandleResponse(resp *http.Response) (HybridConnectionsCreateOrUpdateAuthorizationRuleResponse, error) { result := HybridConnectionsCreateOrUpdateAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRule); err != nil { - return HybridConnectionsCreateOrUpdateAuthorizationRuleResponse{}, err + return HybridConnectionsCreateOrUpdateAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -351,7 +359,7 @@ func (client *HybridConnectionsClient) getCreateRequest(ctx context.Context, res func (client *HybridConnectionsClient) getHandleResponse(resp *http.Response) (HybridConnectionsGetResponse, error) { result := HybridConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridConnection); err != nil { - return HybridConnectionsGetResponse{}, err + return HybridConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -424,7 +432,7 @@ func (client *HybridConnectionsClient) getAuthorizationRuleCreateRequest(ctx con func (client *HybridConnectionsClient) getAuthorizationRuleHandleResponse(resp *http.Response) (HybridConnectionsGetAuthorizationRuleResponse, error) { result := HybridConnectionsGetAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRule); err != nil { - return HybridConnectionsGetAuthorizationRuleResponse{}, err + return HybridConnectionsGetAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -490,7 +498,7 @@ func (client *HybridConnectionsClient) listAuthorizationRulesCreateRequest(ctx c func (client *HybridConnectionsClient) listAuthorizationRulesHandleResponse(resp *http.Response) (HybridConnectionsListAuthorizationRulesResponse, error) { result := HybridConnectionsListAuthorizationRulesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRuleListResult); err != nil { - return HybridConnectionsListAuthorizationRulesResponse{}, err + return HybridConnectionsListAuthorizationRulesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -552,7 +560,7 @@ func (client *HybridConnectionsClient) listByNamespaceCreateRequest(ctx context. func (client *HybridConnectionsClient) listByNamespaceHandleResponse(resp *http.Response) (HybridConnectionsListByNamespaceResponse, error) { result := HybridConnectionsListByNamespaceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridConnectionListResult); err != nil { - return HybridConnectionsListByNamespaceResponse{}, err + return HybridConnectionsListByNamespaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -625,7 +633,7 @@ func (client *HybridConnectionsClient) listKeysCreateRequest(ctx context.Context func (client *HybridConnectionsClient) listKeysHandleResponse(resp *http.Response) (HybridConnectionsListKeysResponse, error) { result := HybridConnectionsListKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { - return HybridConnectionsListKeysResponse{}, err + return HybridConnectionsListKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -698,7 +706,7 @@ func (client *HybridConnectionsClient) regenerateKeysCreateRequest(ctx context.C func (client *HybridConnectionsClient) regenerateKeysHandleResponse(resp *http.Response) (HybridConnectionsRegenerateKeysResponse, error) { result := HybridConnectionsRegenerateKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { - return HybridConnectionsRegenerateKeysResponse{}, err + return HybridConnectionsRegenerateKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/relay/armrelay/zz_generated_models.go b/sdk/resourcemanager/relay/armrelay/zz_generated_models.go index c03d73147dad..cda2b64f8aa0 100644 --- a/sdk/resourcemanager/relay/armrelay/zz_generated_models.go +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_models.go @@ -10,10 +10,9 @@ package armrelay import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // AccessKeys - Namespace/Relay Connection String @@ -170,10 +169,10 @@ type HybridConnectionProperties struct { // MarshalJSON implements the json.Marshaller interface for type HybridConnectionProperties. func (h HybridConnectionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(h.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", h.CreatedAt) populate(objectMap, "listenerCount", h.ListenerCount) populate(objectMap, "requiresClientAuthorization", h.RequiresClientAuthorization) - populate(objectMap, "updatedAt", (*timeRFC3339)(h.UpdatedAt)) + populateTimeRFC3339(objectMap, "updatedAt", h.UpdatedAt) populate(objectMap, "userMetadata", h.UserMetadata) return json.Marshal(objectMap) } @@ -188,9 +187,7 @@ func (h *HybridConnectionProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - h.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &h.CreatedAt) delete(rawMsg, key) case "listenerCount": err = unpopulate(val, &h.ListenerCount) @@ -199,9 +196,7 @@ func (h *HybridConnectionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &h.RequiresClientAuthorization) delete(rawMsg, key) case "updatedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - h.UpdatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &h.UpdatedAt) delete(rawMsg, key) case "userMetadata": err = unpopulate(val, &h.UserMetadata) @@ -438,11 +433,11 @@ type RelayNamespaceProperties struct { // MarshalJSON implements the json.Marshaller interface for type RelayNamespaceProperties. func (r RelayNamespaceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(r.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", r.CreatedAt) populate(objectMap, "metricId", r.MetricID) populate(objectMap, "provisioningState", r.ProvisioningState) populate(objectMap, "serviceBusEndpoint", r.ServiceBusEndpoint) - populate(objectMap, "updatedAt", (*timeRFC3339)(r.UpdatedAt)) + populateTimeRFC3339(objectMap, "updatedAt", r.UpdatedAt) return json.Marshal(objectMap) } @@ -456,9 +451,7 @@ func (r *RelayNamespaceProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.CreatedAt) delete(rawMsg, key) case "metricId": err = unpopulate(val, &r.MetricID) @@ -470,9 +463,7 @@ func (r *RelayNamespaceProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.ServiceBusEndpoint) delete(rawMsg, key) case "updatedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.UpdatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.UpdatedAt) delete(rawMsg, key) } if err != nil { @@ -674,13 +665,13 @@ type WcfRelayProperties struct { // MarshalJSON implements the json.Marshaller interface for type WcfRelayProperties. func (w WcfRelayProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(w.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", w.CreatedAt) populate(objectMap, "isDynamic", w.IsDynamic) populate(objectMap, "listenerCount", w.ListenerCount) populate(objectMap, "relayType", w.RelayType) populate(objectMap, "requiresClientAuthorization", w.RequiresClientAuthorization) populate(objectMap, "requiresTransportSecurity", w.RequiresTransportSecurity) - populate(objectMap, "updatedAt", (*timeRFC3339)(w.UpdatedAt)) + populateTimeRFC3339(objectMap, "updatedAt", w.UpdatedAt) populate(objectMap, "userMetadata", w.UserMetadata) return json.Marshal(objectMap) } @@ -695,9 +686,7 @@ func (w *WcfRelayProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.CreatedAt) delete(rawMsg, key) case "isDynamic": err = unpopulate(val, &w.IsDynamic) @@ -715,9 +704,7 @@ func (w *WcfRelayProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.RequiresTransportSecurity) delete(rawMsg, key) case "updatedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.UpdatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.UpdatedAt) delete(rawMsg, key) case "userMetadata": err = unpopulate(val, &w.UserMetadata) diff --git a/sdk/resourcemanager/relay/armrelay/zz_generated_namespaces_client.go b/sdk/resourcemanager/relay/armrelay/zz_generated_namespaces_client.go index 486e770852b1..ae322c041078 100644 --- a/sdk/resourcemanager/relay/armrelay/zz_generated_namespaces_client.go +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_namespaces_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NamespacesClient contains the methods for the Namespaces group. @@ -31,8 +31,15 @@ type NamespacesClient struct { } // NewNamespacesClient creates a new instance of NamespacesClient with the specified values. -func NewNamespacesClient(con *arm.Connection, subscriptionID string) *NamespacesClient { - return &NamespacesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNamespacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NamespacesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NamespacesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNameAvailability - Check the specified namespace name availability. @@ -74,7 +81,7 @@ func (client *NamespacesClient) checkNameAvailabilityCreateRequest(ctx context.C func (client *NamespacesClient) checkNameAvailabilityHandleResponse(resp *http.Response) (NamespacesCheckNameAvailabilityResponse, error) { result := NamespacesCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResult); err != nil { - return NamespacesCheckNameAvailabilityResponse{}, err + return NamespacesCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -219,7 +226,7 @@ func (client *NamespacesClient) createOrUpdateAuthorizationRuleCreateRequest(ctx func (client *NamespacesClient) createOrUpdateAuthorizationRuleHandleResponse(resp *http.Response) (NamespacesCreateOrUpdateAuthorizationRuleResponse, error) { result := NamespacesCreateOrUpdateAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRule); err != nil { - return NamespacesCreateOrUpdateAuthorizationRuleResponse{}, err + return NamespacesCreateOrUpdateAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -420,7 +427,7 @@ func (client *NamespacesClient) getCreateRequest(ctx context.Context, resourceGr func (client *NamespacesClient) getHandleResponse(resp *http.Response) (NamespacesGetResponse, error) { result := NamespacesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RelayNamespace); err != nil { - return NamespacesGetResponse{}, err + return NamespacesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -489,7 +496,7 @@ func (client *NamespacesClient) getAuthorizationRuleCreateRequest(ctx context.Co func (client *NamespacesClient) getAuthorizationRuleHandleResponse(resp *http.Response) (NamespacesGetAuthorizationRuleResponse, error) { result := NamespacesGetAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRule); err != nil { - return NamespacesGetAuthorizationRuleResponse{}, err + return NamespacesGetAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -543,7 +550,7 @@ func (client *NamespacesClient) listCreateRequest(ctx context.Context, options * func (client *NamespacesClient) listHandleResponse(resp *http.Response) (NamespacesListResponse, error) { result := NamespacesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RelayNamespaceListResult); err != nil { - return NamespacesListResponse{}, err + return NamespacesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -605,7 +612,7 @@ func (client *NamespacesClient) listAuthorizationRulesCreateRequest(ctx context. func (client *NamespacesClient) listAuthorizationRulesHandleResponse(resp *http.Response) (NamespacesListAuthorizationRulesResponse, error) { result := NamespacesListAuthorizationRulesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRuleListResult); err != nil { - return NamespacesListAuthorizationRulesResponse{}, err + return NamespacesListAuthorizationRulesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -663,7 +670,7 @@ func (client *NamespacesClient) listByResourceGroupCreateRequest(ctx context.Con func (client *NamespacesClient) listByResourceGroupHandleResponse(resp *http.Response) (NamespacesListByResourceGroupResponse, error) { result := NamespacesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RelayNamespaceListResult); err != nil { - return NamespacesListByResourceGroupResponse{}, err + return NamespacesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -732,7 +739,7 @@ func (client *NamespacesClient) listKeysCreateRequest(ctx context.Context, resou func (client *NamespacesClient) listKeysHandleResponse(resp *http.Response) (NamespacesListKeysResponse, error) { result := NamespacesListKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { - return NamespacesListKeysResponse{}, err + return NamespacesListKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -801,7 +808,7 @@ func (client *NamespacesClient) regenerateKeysCreateRequest(ctx context.Context, func (client *NamespacesClient) regenerateKeysHandleResponse(resp *http.Response) (NamespacesRegenerateKeysResponse, error) { result := NamespacesRegenerateKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { - return NamespacesRegenerateKeysResponse{}, err + return NamespacesRegenerateKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -866,7 +873,7 @@ func (client *NamespacesClient) updateCreateRequest(ctx context.Context, resourc func (client *NamespacesClient) updateHandleResponse(resp *http.Response) (NamespacesUpdateResponse, error) { result := NamespacesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RelayNamespace); err != nil { - return NamespacesUpdateResponse{}, err + return NamespacesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/relay/armrelay/zz_generated_operations_client.go b/sdk/resourcemanager/relay/armrelay/zz_generated_operations_client.go index 52e80e8895c3..dc555eab001a 100644 --- a/sdk/resourcemanager/relay/armrelay/zz_generated_operations_client.go +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armrelay import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all available Relay REST API operations. @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/relay/armrelay/zz_generated_pagers.go b/sdk/resourcemanager/relay/armrelay/zz_generated_pagers.go index 4aa502153073..48e4ac80b378 100644 --- a/sdk/resourcemanager/relay/armrelay/zz_generated_pagers.go +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armrelay import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // HybridConnectionsListAuthorizationRulesPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/relay/armrelay/zz_generated_pollers.go b/sdk/resourcemanager/relay/armrelay/zz_generated_pollers.go index 01cf5def6e74..45ad7cfc6818 100644 --- a/sdk/resourcemanager/relay/armrelay/zz_generated_pollers.go +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armrelay import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // NamespacesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/relay/armrelay/zz_generated_response_types.go b/sdk/resourcemanager/relay/armrelay/zz_generated_response_types.go index c9342a41cce7..a0d100a47248 100644 --- a/sdk/resourcemanager/relay/armrelay/zz_generated_response_types.go +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armrelay import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // HybridConnectionsCreateOrUpdateAuthorizationRuleResponse contains the response from method HybridConnections.CreateOrUpdateAuthorizationRule. @@ -158,6 +157,8 @@ type NamespacesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NamespacesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NamespacesCreateOrUpdateResponse, error) { respType := NamespacesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RelayNamespace) @@ -214,6 +215,8 @@ type NamespacesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NamespacesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NamespacesDeleteResponse, error) { respType := NamespacesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/relay/armrelay/zz_generated_time_rfc3339.go b/sdk/resourcemanager/relay/armrelay/zz_generated_time_rfc3339.go index 27842fba2f8c..b1423dc12be9 100644 --- a/sdk/resourcemanager/relay/armrelay/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armrelay import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/relay/armrelay/zz_generated_wcfrelays_client.go b/sdk/resourcemanager/relay/armrelay/zz_generated_wcfrelays_client.go index c7a924f24341..f2005b751a1f 100644 --- a/sdk/resourcemanager/relay/armrelay/zz_generated_wcfrelays_client.go +++ b/sdk/resourcemanager/relay/armrelay/zz_generated_wcfrelays_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // WCFRelaysClient contains the methods for the WCFRelays group. @@ -30,8 +31,15 @@ type WCFRelaysClient struct { } // NewWCFRelaysClient creates a new instance of WCFRelaysClient with the specified values. -func NewWCFRelaysClient(con *arm.Connection, subscriptionID string) *WCFRelaysClient { - return &WCFRelaysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWCFRelaysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WCFRelaysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WCFRelaysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a WCF relay. This operation is idempotent. @@ -85,7 +93,7 @@ func (client *WCFRelaysClient) createOrUpdateCreateRequest(ctx context.Context, func (client *WCFRelaysClient) createOrUpdateHandleResponse(resp *http.Response) (WCFRelaysCreateOrUpdateResponse, error) { result := WCFRelaysCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WcfRelay); err != nil { - return WCFRelaysCreateOrUpdateResponse{}, err + return WCFRelaysCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -158,7 +166,7 @@ func (client *WCFRelaysClient) createOrUpdateAuthorizationRuleCreateRequest(ctx func (client *WCFRelaysClient) createOrUpdateAuthorizationRuleHandleResponse(resp *http.Response) (WCFRelaysCreateOrUpdateAuthorizationRuleResponse, error) { result := WCFRelaysCreateOrUpdateAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRule); err != nil { - return WCFRelaysCreateOrUpdateAuthorizationRuleResponse{}, err + return WCFRelaysCreateOrUpdateAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -351,7 +359,7 @@ func (client *WCFRelaysClient) getCreateRequest(ctx context.Context, resourceGro func (client *WCFRelaysClient) getHandleResponse(resp *http.Response) (WCFRelaysGetResponse, error) { result := WCFRelaysGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WcfRelay); err != nil { - return WCFRelaysGetResponse{}, err + return WCFRelaysGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -424,7 +432,7 @@ func (client *WCFRelaysClient) getAuthorizationRuleCreateRequest(ctx context.Con func (client *WCFRelaysClient) getAuthorizationRuleHandleResponse(resp *http.Response) (WCFRelaysGetAuthorizationRuleResponse, error) { result := WCFRelaysGetAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRule); err != nil { - return WCFRelaysGetAuthorizationRuleResponse{}, err + return WCFRelaysGetAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -490,7 +498,7 @@ func (client *WCFRelaysClient) listAuthorizationRulesCreateRequest(ctx context.C func (client *WCFRelaysClient) listAuthorizationRulesHandleResponse(resp *http.Response) (WCFRelaysListAuthorizationRulesResponse, error) { result := WCFRelaysListAuthorizationRulesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AuthorizationRuleListResult); err != nil { - return WCFRelaysListAuthorizationRulesResponse{}, err + return WCFRelaysListAuthorizationRulesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -551,7 +559,7 @@ func (client *WCFRelaysClient) listByNamespaceCreateRequest(ctx context.Context, func (client *WCFRelaysClient) listByNamespaceHandleResponse(resp *http.Response) (WCFRelaysListByNamespaceResponse, error) { result := WCFRelaysListByNamespaceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WcfRelaysListResult); err != nil { - return WCFRelaysListByNamespaceResponse{}, err + return WCFRelaysListByNamespaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -624,7 +632,7 @@ func (client *WCFRelaysClient) listKeysCreateRequest(ctx context.Context, resour func (client *WCFRelaysClient) listKeysHandleResponse(resp *http.Response) (WCFRelaysListKeysResponse, error) { result := WCFRelaysListKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { - return WCFRelaysListKeysResponse{}, err + return WCFRelaysListKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -697,7 +705,7 @@ func (client *WCFRelaysClient) regenerateKeysCreateRequest(ctx context.Context, func (client *WCFRelaysClient) regenerateKeysHandleResponse(resp *http.Response) (WCFRelaysRegenerateKeysResponse, error) { result := WCFRelaysRegenerateKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { - return WCFRelaysRegenerateKeysResponse{}, err + return WCFRelaysRegenerateKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/CHANGELOG.md b/sdk/resourcemanager/resourcehealth/armresourcehealth/CHANGELOG.md index e4f3d9f035c1..6ee9f3587c1a 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/CHANGELOG.md +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-26) diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/README.md b/sdk/resourcemanager/resourcehealth/armresourcehealth/README.md index 86c018ee9e4d..ad5721902849 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/README.md +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Resource Health +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Resource Health modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armresourcehealth.NewAvailabilityStatusesClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Resource Health modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armresourcehealth.NewAvailabilityStatusesClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armresourcehealth.NewAvailabilityStatusesClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/autorest.md b/sdk/resourcemanager/resourcehealth/armresourcehealth/autorest.md index c794d32758ab..05e34554da61 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/autorest.md +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/4aebac1bd77282ae8efe3dd2886e864537d31762/specification/resourcehealth/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/4aebac1bd77282ae8efe3dd2886e864537d31762/specification/resourcehealth/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/resourcehealth/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/resourcehealth/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/go.mod b/sdk/resourcemanager/resourcehealth/armresourcehealth/go.mod index 0d01c484e8f6..1b8e707da068 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/go.mod +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resourcehealth/armr go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.3.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/go.sum b/sdk/resourcemanager/resourcehealth/armresourcehealth/go.sum index af10d0f1292e..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/go.sum +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.3.0+incompatible h1:lb9OWePNuJMiibdxg9XvdbiOldR0Yifge37L4LoOxIs= -github.com/Azure/azure-sdk-for-go v58.3.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_availabilitystatuses_client.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_availabilitystatuses_client.go index 3b84fa8bb57b..a3b5126dbdaf 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_availabilitystatuses_client.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_availabilitystatuses_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AvailabilityStatusesClient contains the methods for the AvailabilityStatuses group. @@ -30,8 +31,15 @@ type AvailabilityStatusesClient struct { } // NewAvailabilityStatusesClient creates a new instance of AvailabilityStatusesClient with the specified values. -func NewAvailabilityStatusesClient(con *arm.Connection, subscriptionID string) *AvailabilityStatusesClient { - return &AvailabilityStatusesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAvailabilityStatusesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AvailabilityStatusesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AvailabilityStatusesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetByResource - Gets current availability status for a single resource @@ -54,9 +62,6 @@ func (client *AvailabilityStatusesClient) GetByResource(ctx context.Context, res // getByResourceCreateRequest creates the GetByResource request. func (client *AvailabilityStatusesClient) getByResourceCreateRequest(ctx context.Context, resourceURI string, options *AvailabilityStatusesGetByResourceOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses/current" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -79,7 +84,7 @@ func (client *AvailabilityStatusesClient) getByResourceCreateRequest(ctx context func (client *AvailabilityStatusesClient) getByResourceHandleResponse(resp *http.Response) (AvailabilityStatusesGetByResourceResponse, error) { result := AvailabilityStatusesGetByResourceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilityStatus); err != nil { - return AvailabilityStatusesGetByResourceResponse{}, err + return AvailabilityStatusesGetByResourceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -115,9 +120,6 @@ func (client *AvailabilityStatusesClient) List(resourceURI string, options *Avai // listCreateRequest creates the List request. func (client *AvailabilityStatusesClient) listCreateRequest(ctx context.Context, resourceURI string, options *AvailabilityStatusesListOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ResourceHealth/availabilityStatuses" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -140,7 +142,7 @@ func (client *AvailabilityStatusesClient) listCreateRequest(ctx context.Context, func (client *AvailabilityStatusesClient) listHandleResponse(resp *http.Response) (AvailabilityStatusesListResponse, error) { result := AvailabilityStatusesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilityStatusListResult); err != nil { - return AvailabilityStatusesListResponse{}, err + return AvailabilityStatusesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -205,7 +207,7 @@ func (client *AvailabilityStatusesClient) listByResourceGroupCreateRequest(ctx c func (client *AvailabilityStatusesClient) listByResourceGroupHandleResponse(resp *http.Response) (AvailabilityStatusesListByResourceGroupResponse, error) { result := AvailabilityStatusesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilityStatusListResult); err != nil { - return AvailabilityStatusesListByResourceGroupResponse{}, err + return AvailabilityStatusesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -266,7 +268,7 @@ func (client *AvailabilityStatusesClient) listBySubscriptionIDCreateRequest(ctx func (client *AvailabilityStatusesClient) listBySubscriptionIDHandleResponse(resp *http.Response) (AvailabilityStatusesListBySubscriptionIDResponse, error) { result := AvailabilityStatusesListBySubscriptionIDResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilityStatusListResult); err != nil { - return AvailabilityStatusesListBySubscriptionIDResponse{}, err + return AvailabilityStatusesListBySubscriptionIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_childavailabilitystatuses_client.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_childavailabilitystatuses_client.go index 8c4ac18570e8..9bd6aa95e7e6 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_childavailabilitystatuses_client.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_childavailabilitystatuses_client.go @@ -10,14 +10,14 @@ package armresourcehealth import ( "context" - "errors" "fmt" - "net/http" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" ) // ChildAvailabilityStatusesClient contains the methods for the ChildAvailabilityStatuses group. @@ -28,8 +28,15 @@ type ChildAvailabilityStatusesClient struct { } // NewChildAvailabilityStatusesClient creates a new instance of ChildAvailabilityStatusesClient with the specified values. -func NewChildAvailabilityStatusesClient(con *arm.Connection) *ChildAvailabilityStatusesClient { - return &ChildAvailabilityStatusesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewChildAvailabilityStatusesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ChildAvailabilityStatusesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ChildAvailabilityStatusesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetByResource - Gets current availability status for a single resource @@ -52,9 +59,6 @@ func (client *ChildAvailabilityStatusesClient) GetByResource(ctx context.Context // getByResourceCreateRequest creates the GetByResource request. func (client *ChildAvailabilityStatusesClient) getByResourceCreateRequest(ctx context.Context, resourceURI string, options *ChildAvailabilityStatusesGetByResourceOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses/current" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -77,7 +81,7 @@ func (client *ChildAvailabilityStatusesClient) getByResourceCreateRequest(ctx co func (client *ChildAvailabilityStatusesClient) getByResourceHandleResponse(resp *http.Response) (ChildAvailabilityStatusesGetByResourceResponse, error) { result := ChildAvailabilityStatusesGetByResourceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilityStatus); err != nil { - return ChildAvailabilityStatusesGetByResourceResponse{}, err + return ChildAvailabilityStatusesGetByResourceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -113,9 +117,6 @@ func (client *ChildAvailabilityStatusesClient) List(resourceURI string, options // listCreateRequest creates the List request. func (client *ChildAvailabilityStatusesClient) listCreateRequest(ctx context.Context, resourceURI string, options *ChildAvailabilityStatusesListOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ResourceHealth/childAvailabilityStatuses" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -138,7 +139,7 @@ func (client *ChildAvailabilityStatusesClient) listCreateRequest(ctx context.Con func (client *ChildAvailabilityStatusesClient) listHandleResponse(resp *http.Response) (ChildAvailabilityStatusesListResponse, error) { result := ChildAvailabilityStatusesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilityStatusListResult); err != nil { - return ChildAvailabilityStatusesListResponse{}, err + return ChildAvailabilityStatusesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_childresources_client.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_childresources_client.go index 6d5836be0596..177f2d22eea5 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_childresources_client.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_childresources_client.go @@ -10,14 +10,14 @@ package armresourcehealth import ( "context" - "errors" "fmt" - "net/http" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "strings" ) // ChildResourcesClient contains the methods for the ChildResources group. @@ -28,8 +28,15 @@ type ChildResourcesClient struct { } // NewChildResourcesClient creates a new instance of ChildResourcesClient with the specified values. -func NewChildResourcesClient(con *arm.Connection) *ChildResourcesClient { - return &ChildResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewChildResourcesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ChildResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ChildResourcesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists the all the children and its current health status for a parent resource. Use the nextLink property in the response to get the next page @@ -50,9 +57,6 @@ func (client *ChildResourcesClient) List(resourceURI string, options *ChildResou // listCreateRequest creates the List request. func (client *ChildResourcesClient) listCreateRequest(ctx context.Context, resourceURI string, options *ChildResourcesListOptions) (*policy.Request, error) { urlPath := "/{resourceUri}/providers/Microsoft.ResourceHealth/childResources" - if resourceURI == "" { - return nil, errors.New("parameter resourceURI cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceUri}", resourceURI) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -75,7 +79,7 @@ func (client *ChildResourcesClient) listCreateRequest(ctx context.Context, resou func (client *ChildResourcesClient) listHandleResponse(resp *http.Response) (ChildResourcesListResponse, error) { result := ChildResourcesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AvailabilityStatusListResult); err != nil { - return ChildResourcesListResponse{}, err + return ChildResourcesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_constants.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_constants.go index bd690f2e5add..664a20e7668f 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_constants.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_constants.go @@ -10,7 +10,7 @@ package armresourcehealth const ( module = "armresourcehealth" - version = "v0.1.1" + version = "v0.2.0" ) // AvailabilityStateValues - Availability status of the resource. When it is null, this availabilityStatus object represents an availability impacting event diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_emergingissues_client.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_emergingissues_client.go index e9777422c68a..ddaf65b18dc1 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_emergingissues_client.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_emergingissues_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // EmergingIssuesClient contains the methods for the EmergingIssues group. @@ -29,8 +30,15 @@ type EmergingIssuesClient struct { } // NewEmergingIssuesClient creates a new instance of EmergingIssuesClient with the specified values. -func NewEmergingIssuesClient(con *arm.Connection) *EmergingIssuesClient { - return &EmergingIssuesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewEmergingIssuesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *EmergingIssuesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &EmergingIssuesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets Azure services' emerging issues. @@ -72,7 +80,7 @@ func (client *EmergingIssuesClient) getCreateRequest(ctx context.Context, issueN func (client *EmergingIssuesClient) getHandleResponse(resp *http.Response) (EmergingIssuesGetResponse, error) { result := EmergingIssuesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EmergingIssuesGetResult); err != nil { - return EmergingIssuesGetResponse{}, err + return EmergingIssuesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -122,7 +130,7 @@ func (client *EmergingIssuesClient) listCreateRequest(ctx context.Context, optio func (client *EmergingIssuesClient) listHandleResponse(resp *http.Response) (EmergingIssuesListResponse, error) { result := EmergingIssuesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EmergingIssueListResult); err != nil { - return EmergingIssuesListResponse{}, err + return EmergingIssuesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_models.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_models.go index 20766eeadbe3..890cbbd6a565 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_models.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_models.go @@ -10,10 +10,9 @@ package armresourcehealth import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // AvailabilityStatus - availabilityStatus of a resource. @@ -116,14 +115,14 @@ func (a AvailabilityStatusProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "healthEventCause", a.HealthEventCause) populate(objectMap, "healthEventId", a.HealthEventID) populate(objectMap, "healthEventType", a.HealthEventType) - populate(objectMap, "occuredTime", (*timeRFC3339)(a.OccuredTime)) + populateTimeRFC3339(objectMap, "occuredTime", a.OccuredTime) populate(objectMap, "reasonChronicity", a.ReasonChronicity) populate(objectMap, "reasonType", a.ReasonType) populate(objectMap, "recentlyResolvedState", a.RecentlyResolvedState) populate(objectMap, "recommendedActions", a.RecommendedActions) - populate(objectMap, "reportedTime", (*timeRFC3339)(a.ReportedTime)) - populate(objectMap, "resolutionETA", (*timeRFC3339)(a.ResolutionETA)) - populate(objectMap, "rootCauseAttributionTime", (*timeRFC3339)(a.RootCauseAttributionTime)) + populateTimeRFC3339(objectMap, "reportedTime", a.ReportedTime) + populateTimeRFC3339(objectMap, "resolutionETA", a.ResolutionETA) + populateTimeRFC3339(objectMap, "rootCauseAttributionTime", a.RootCauseAttributionTime) populate(objectMap, "serviceImpactingEvents", a.ServiceImpactingEvents) populate(objectMap, "summary", a.Summary) return json.Marshal(objectMap) @@ -157,9 +156,7 @@ func (a *AvailabilityStatusProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.HealthEventType) delete(rawMsg, key) case "occuredTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.OccuredTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.OccuredTime) delete(rawMsg, key) case "reasonChronicity": err = unpopulate(val, &a.ReasonChronicity) @@ -174,19 +171,13 @@ func (a *AvailabilityStatusProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.RecommendedActions) delete(rawMsg, key) case "reportedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.ReportedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.ReportedTime) delete(rawMsg, key) case "resolutionETA": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.ResolutionETA = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.ResolutionETA) delete(rawMsg, key) case "rootCauseAttributionTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.RootCauseAttributionTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.RootCauseAttributionTime) delete(rawMsg, key) case "serviceImpactingEvents": err = unpopulate(val, &a.ServiceImpactingEvents) @@ -218,9 +209,9 @@ type AvailabilityStatusPropertiesRecentlyResolvedState struct { // MarshalJSON implements the json.Marshaller interface for type AvailabilityStatusPropertiesRecentlyResolvedState. func (a AvailabilityStatusPropertiesRecentlyResolvedState) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "resolvedTime", (*timeRFC3339)(a.ResolvedTime)) + populateTimeRFC3339(objectMap, "resolvedTime", a.ResolvedTime) populate(objectMap, "unavailabilitySummary", a.UnavailabilitySummary) - populate(objectMap, "unavailableOccurredTime", (*timeRFC3339)(a.UnavailableOccurredTime)) + populateTimeRFC3339(objectMap, "unavailableOccurredTime", a.UnavailableOccurredTime) return json.Marshal(objectMap) } @@ -234,17 +225,13 @@ func (a *AvailabilityStatusPropertiesRecentlyResolvedState) UnmarshalJSON(data [ var err error switch key { case "resolvedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.ResolvedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.ResolvedTime) delete(rawMsg, key) case "unavailabilitySummary": err = unpopulate(val, &a.UnavailabilitySummary) delete(rawMsg, key) case "unavailableOccurredTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.UnavailableOccurredTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.UnavailableOccurredTime) delete(rawMsg, key) } if err != nil { @@ -325,7 +312,7 @@ type EmergingIssue struct { // MarshalJSON implements the json.Marshaller interface for type EmergingIssue. func (e EmergingIssue) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "refreshTimestamp", (*timeRFC3339)(e.RefreshTimestamp)) + populateTimeRFC3339(objectMap, "refreshTimestamp", e.RefreshTimestamp) populate(objectMap, "statusActiveEvents", e.StatusActiveEvents) populate(objectMap, "statusBanners", e.StatusBanners) return json.Marshal(objectMap) @@ -341,9 +328,7 @@ func (e *EmergingIssue) UnmarshalJSON(data []byte) error { var err error switch key { case "refreshTimestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.RefreshTimestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.RefreshTimestamp) delete(rawMsg, key) case "statusActiveEvents": err = unpopulate(val, &e.StatusActiveEvents) @@ -531,8 +516,8 @@ type ServiceImpactingEvent struct { func (s ServiceImpactingEvent) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "correlationId", s.CorrelationID) - populate(objectMap, "eventStartTime", (*timeRFC3339)(s.EventStartTime)) - populate(objectMap, "eventStatusLastModifiedTime", (*timeRFC3339)(s.EventStatusLastModifiedTime)) + populateTimeRFC3339(objectMap, "eventStartTime", s.EventStartTime) + populateTimeRFC3339(objectMap, "eventStatusLastModifiedTime", s.EventStatusLastModifiedTime) populate(objectMap, "incidentProperties", s.IncidentProperties) populate(objectMap, "status", s.Status) return json.Marshal(objectMap) @@ -551,14 +536,10 @@ func (s *ServiceImpactingEvent) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CorrelationID) delete(rawMsg, key) case "eventStartTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.EventStartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.EventStartTime) delete(rawMsg, key) case "eventStatusLastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.EventStatusLastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.EventStatusLastModifiedTime) delete(rawMsg, key) case "incidentProperties": err = unpopulate(val, &s.IncidentProperties) @@ -634,11 +615,11 @@ func (s StatusActiveEvent) MarshalJSON() ([]byte, error) { populate(objectMap, "cloud", s.Cloud) populate(objectMap, "description", s.Description) populate(objectMap, "impacts", s.Impacts) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(s.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", s.LastModifiedTime) populate(objectMap, "published", s.Published) populate(objectMap, "severity", s.Severity) populate(objectMap, "stage", s.Stage) - populate(objectMap, "startTime", (*timeRFC3339)(s.StartTime)) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) populate(objectMap, "title", s.Title) populate(objectMap, "trackingId", s.TrackingID) return json.Marshal(objectMap) @@ -663,9 +644,7 @@ func (s *StatusActiveEvent) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Impacts) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedTime) delete(rawMsg, key) case "published": err = unpopulate(val, &s.Published) @@ -677,9 +656,7 @@ func (s *StatusActiveEvent) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Stage) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.StartTime) delete(rawMsg, key) case "title": err = unpopulate(val, &s.Title) @@ -714,7 +691,7 @@ type StatusBanner struct { func (s StatusBanner) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "cloud", s.Cloud) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(s.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", s.LastModifiedTime) populate(objectMap, "message", s.Message) populate(objectMap, "title", s.Title) return json.Marshal(objectMap) @@ -733,9 +710,7 @@ func (s *StatusBanner) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Cloud) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedTime) delete(rawMsg, key) case "message": err = unpopulate(val, &s.Message) diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_operations_client.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_operations_client.go index dbee200bf524..3733a2233dab 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_operations_client.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armresourcehealth import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists available operations for the resourcehealth resource provider @@ -65,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_pagers.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_pagers.go index 6be3c50497ca..857e6faa73aa 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_pagers.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armresourcehealth import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // AvailabilityStatusesListByResourceGroupPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_time_rfc3339.go b/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_time_rfc3339.go index 935a5d0bcb49..6adc4e9b08da 100644 --- a/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/resourcehealth/armresourcehealth/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armresourcehealth import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/resources/armresources/CHANGELOG.md b/sdk/resourcemanager/resources/armresources/CHANGELOG.md index 6c4db6407868..70ea57aa862a 100644 --- a/sdk/resourcemanager/resources/armresources/CHANGELOG.md +++ b/sdk/resourcemanager/resources/armresources/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-09-30) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/resources/armresources") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/resources/armresources/README.md b/sdk/resourcemanager/resources/armresources/README.md index e9d6f49bed97..239c053ccafc 100644 --- a/sdk/resourcemanager/resources/armresources/README.md +++ b/sdk/resourcemanager/resources/armresources/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Resources +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Resources modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armresources.NewResourcesClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Resources modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armresources.{{NewClientMethod}} +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armresources.NewResourcesClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/resources/armresources/autorest.md b/sdk/resourcemanager/resources/armresources/autorest.md index 08d0ddac62a5..88bf2dae7af8 100644 --- a/sdk/resourcemanager/resources/armresources/autorest.md +++ b/sdk/resourcemanager/resources/armresources/autorest.md @@ -5,9 +5,9 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/3be99a2eef14243a60ee518243b258022c0fee28/specification/resources/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/3be99a2eef14243a60ee518243b258022c0fee28/specification/resources/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/resources/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/resources/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 package-resources: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/resources/armresources/examples_providers_test.go b/sdk/resourcemanager/resources/armresources/examples_providers_test.go index 01822ede619f..92dbd6cb06fb 100644 --- a/sdk/resourcemanager/resources/armresources/examples_providers_test.go +++ b/sdk/resourcemanager/resources/armresources/examples_providers_test.go @@ -10,7 +10,6 @@ import ( "context" "log" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" ) @@ -20,7 +19,7 @@ func ExampleProvidersClient_Register() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armresources.NewProvidersClient(arm.NewDefaultConnection(cred, nil), "") + client := armresources.NewProvidersClient("", cred, nil) resp, err := client.Register(context.Background(), "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) diff --git a/sdk/resourcemanager/resources/armresources/examples_resourcegroups_test.go b/sdk/resourcemanager/resources/armresources/examples_resourcegroups_test.go index 610f0a6fb222..e7ab57d1e5f0 100644 --- a/sdk/resourcemanager/resources/armresources/examples_resourcegroups_test.go +++ b/sdk/resourcemanager/resources/armresources/examples_resourcegroups_test.go @@ -11,7 +11,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" @@ -22,7 +21,7 @@ func ExampleResourceGroupsClient_CheckExistence() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armresources.NewResourceGroupsClient(arm.NewDefaultConnection(cred, nil), "") + client := armresources.NewResourceGroupsClient("", cred, nil) resp, err := client.CheckExistence(context.Background(), "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) @@ -35,7 +34,7 @@ func ExampleResourceGroupsClient_CreateOrUpdate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armresources.NewResourceGroupsClient(arm.NewDefaultConnection(cred, nil), "") + client := armresources.NewResourceGroupsClient("", cred, nil) resp, err := client.CreateOrUpdate(context.Background(), "", armresources.ResourceGroup{ Location: to.StringPtr(""), }, nil) @@ -50,7 +49,7 @@ func ExampleResourceGroupsClient_Update() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armresources.NewResourceGroupsClient(arm.NewDefaultConnection(cred, nil), "") + client := armresources.NewResourceGroupsClient("", cred, nil) resp, err := client.Update( context.Background(), "", @@ -70,7 +69,7 @@ func ExampleResourceGroupsClient_List() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armresources.NewResourceGroupsClient(arm.NewDefaultConnection(cred, nil), "") + client := armresources.NewResourceGroupsClient("", cred, nil) pager := client.List(nil) for pager.NextPage(context.Background()) { if err := pager.Err(); err != nil { @@ -87,7 +86,7 @@ func ExampleResourceGroupsClient_BeginDelete() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armresources.NewResourceGroupsClient(arm.NewDefaultConnection(cred, nil), "") + client := armresources.NewResourceGroupsClient("", cred, nil) poller, err := client.BeginDelete(context.Background(), "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) @@ -103,7 +102,7 @@ func ExampleResourceGroupsClient_Get() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armresources.NewResourceGroupsClient(arm.NewDefaultConnection(cred, nil), "") + client := armresources.NewResourceGroupsClient("", cred, nil) rg, err := client.Get(context.Background(), "", nil) if err != nil { log.Fatalf("failed to get resource group: %v", err) diff --git a/sdk/resourcemanager/resources/armresources/examples_resources_test.go b/sdk/resourcemanager/resources/armresources/examples_resources_test.go index b0d8721b678e..74c007a2b779 100644 --- a/sdk/resourcemanager/resources/armresources/examples_resources_test.go +++ b/sdk/resourcemanager/resources/armresources/examples_resources_test.go @@ -10,7 +10,6 @@ import ( "context" "log" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresources" ) @@ -20,7 +19,7 @@ func ExampleResourcesClient_GetByID() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armresources.NewResourcesClient(arm.NewDefaultConnection(cred, nil), "") + client := armresources.NewResourcesClient("", cred, nil) resp, err := client.GetByID(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to obtain a response: %v", err) @@ -33,7 +32,7 @@ func ExampleResourcesClient_ListByResourceGroup() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armresources.NewResourcesClient(arm.NewDefaultConnection(cred, nil), "") + client := armresources.NewResourcesClient("", cred, nil) page := client.ListByResourceGroup("", nil) for page.NextPage(context.Background()) { resp := page.PageResponse() diff --git a/sdk/resourcemanager/resources/armresources/go.mod b/sdk/resourcemanager/resources/armresources/go.mod index 13e7960f65c5..e4f6a5247750 100644 --- a/sdk/resourcemanager/resources/armresources/go.mod +++ b/sdk/resourcemanager/resources/armresources/go.mod @@ -3,7 +3,9 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/resources/armresour go 1.16 require ( - github.com/Azure/azure-sdk-for-go v57.4.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0 ) + +replace github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0 => ../../../azidentity diff --git a/sdk/resourcemanager/resources/armresources/go.sum b/sdk/resourcemanager/resources/armresources/go.sum index ffc329a511d0..0a36ef05b718 100644 --- a/sdk/resourcemanager/resources/armresources/go.sum +++ b/sdk/resourcemanager/resources/armresources/go.sum @@ -1,15 +1,13 @@ -github.com/Azure/azure-sdk-for-go v57.4.0+incompatible h1:uzhy/mTwu4rq6Be/fJJnE82PRx2A2vjGjzsA3aQ6Qu0= -github.com/Azure/azure-sdk-for-go v57.4.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0 h1:OYa9vmRX2XC5GXRAzeggG12sF/z5D9Ahtdm9EJ00WN4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= @@ -19,22 +17,26 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= diff --git a/sdk/resourcemanager/resources/armresources/zz_generated_constants.go b/sdk/resourcemanager/resources/armresources/zz_generated_constants.go index 1193d5678a2c..610a3d5f721d 100644 --- a/sdk/resourcemanager/resources/armresources/zz_generated_constants.go +++ b/sdk/resourcemanager/resources/armresources/zz_generated_constants.go @@ -10,7 +10,7 @@ package armresources const ( module = "armresources" - version = "v0.1.0" + version = "v0.2.0" ) // AliasPathAttributes - The attributes of the token that the alias path is referring to. diff --git a/sdk/resourcemanager/resources/armresources/zz_generated_deploymentoperations_client.go b/sdk/resourcemanager/resources/armresources/zz_generated_deploymentoperations_client.go index 7b7c297a6517..1c36024ef04a 100644 --- a/sdk/resourcemanager/resources/armresources/zz_generated_deploymentoperations_client.go +++ b/sdk/resourcemanager/resources/armresources/zz_generated_deploymentoperations_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -30,8 +32,15 @@ type DeploymentOperationsClient struct { } // NewDeploymentOperationsClient creates a new instance of DeploymentOperationsClient with the specified values. -func NewDeploymentOperationsClient(con *arm.Connection, subscriptionID string) *DeploymentOperationsClient { - return &DeploymentOperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDeploymentOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DeploymentOperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DeploymentOperationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a deployments operation. @@ -85,7 +94,7 @@ func (client *DeploymentOperationsClient) getCreateRequest(ctx context.Context, func (client *DeploymentOperationsClient) getHandleResponse(resp *http.Response) (DeploymentOperationsGetResponse, error) { result := DeploymentOperationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperation); err != nil { - return DeploymentOperationsGetResponse{}, err + return DeploymentOperationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -150,7 +159,7 @@ func (client *DeploymentOperationsClient) getAtManagementGroupScopeCreateRequest func (client *DeploymentOperationsClient) getAtManagementGroupScopeHandleResponse(resp *http.Response) (DeploymentOperationsGetAtManagementGroupScopeResponse, error) { result := DeploymentOperationsGetAtManagementGroupScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperation); err != nil { - return DeploymentOperationsGetAtManagementGroupScopeResponse{}, err + return DeploymentOperationsGetAtManagementGroupScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -188,9 +197,6 @@ func (client *DeploymentOperationsClient) GetAtScope(ctx context.Context, scope // getAtScopeCreateRequest creates the GetAtScope request. func (client *DeploymentOperationsClient) getAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, operationID string, options *DeploymentOperationsGetAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations/{operationId}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") @@ -215,7 +221,7 @@ func (client *DeploymentOperationsClient) getAtScopeCreateRequest(ctx context.Co func (client *DeploymentOperationsClient) getAtScopeHandleResponse(resp *http.Response) (DeploymentOperationsGetAtScopeResponse, error) { result := DeploymentOperationsGetAtScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperation); err != nil { - return DeploymentOperationsGetAtScopeResponse{}, err + return DeploymentOperationsGetAtScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -280,7 +286,7 @@ func (client *DeploymentOperationsClient) getAtSubscriptionScopeCreateRequest(ct func (client *DeploymentOperationsClient) getAtSubscriptionScopeHandleResponse(resp *http.Response) (DeploymentOperationsGetAtSubscriptionScopeResponse, error) { result := DeploymentOperationsGetAtSubscriptionScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperation); err != nil { - return DeploymentOperationsGetAtSubscriptionScopeResponse{}, err + return DeploymentOperationsGetAtSubscriptionScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -341,7 +347,7 @@ func (client *DeploymentOperationsClient) getAtTenantScopeCreateRequest(ctx cont func (client *DeploymentOperationsClient) getAtTenantScopeHandleResponse(resp *http.Response) (DeploymentOperationsGetAtTenantScopeResponse, error) { result := DeploymentOperationsGetAtTenantScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperation); err != nil { - return DeploymentOperationsGetAtTenantScopeResponse{}, err + return DeploymentOperationsGetAtTenantScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -406,7 +412,7 @@ func (client *DeploymentOperationsClient) listCreateRequest(ctx context.Context, func (client *DeploymentOperationsClient) listHandleResponse(resp *http.Response) (DeploymentOperationsListResponse, error) { result := DeploymentOperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperationsListResult); err != nil { - return DeploymentOperationsListResponse{}, err + return DeploymentOperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -467,7 +473,7 @@ func (client *DeploymentOperationsClient) listAtManagementGroupScopeCreateReques func (client *DeploymentOperationsClient) listAtManagementGroupScopeHandleResponse(resp *http.Response) (DeploymentOperationsListAtManagementGroupScopeResponse, error) { result := DeploymentOperationsListAtManagementGroupScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperationsListResult); err != nil { - return DeploymentOperationsListAtManagementGroupScopeResponse{}, err + return DeploymentOperationsListAtManagementGroupScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -502,9 +508,6 @@ func (client *DeploymentOperationsClient) ListAtScope(scope string, deploymentNa // listAtScopeCreateRequest creates the ListAtScope request. func (client *DeploymentOperationsClient) listAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, options *DeploymentOperationsListAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/operations" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") @@ -528,7 +531,7 @@ func (client *DeploymentOperationsClient) listAtScopeCreateRequest(ctx context.C func (client *DeploymentOperationsClient) listAtScopeHandleResponse(resp *http.Response) (DeploymentOperationsListAtScopeResponse, error) { result := DeploymentOperationsListAtScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperationsListResult); err != nil { - return DeploymentOperationsListAtScopeResponse{}, err + return DeploymentOperationsListAtScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -589,7 +592,7 @@ func (client *DeploymentOperationsClient) listAtSubscriptionScopeCreateRequest(c func (client *DeploymentOperationsClient) listAtSubscriptionScopeHandleResponse(resp *http.Response) (DeploymentOperationsListAtSubscriptionScopeResponse, error) { result := DeploymentOperationsListAtSubscriptionScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperationsListResult); err != nil { - return DeploymentOperationsListAtSubscriptionScopeResponse{}, err + return DeploymentOperationsListAtSubscriptionScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -646,7 +649,7 @@ func (client *DeploymentOperationsClient) listAtTenantScopeCreateRequest(ctx con func (client *DeploymentOperationsClient) listAtTenantScopeHandleResponse(resp *http.Response) (DeploymentOperationsListAtTenantScopeResponse, error) { result := DeploymentOperationsListAtTenantScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentOperationsListResult); err != nil { - return DeploymentOperationsListAtTenantScopeResponse{}, err + return DeploymentOperationsListAtTenantScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/resources/armresources/zz_generated_deployments_client.go b/sdk/resourcemanager/resources/armresources/zz_generated_deployments_client.go index e4bb6431a523..130211bd5fbb 100644 --- a/sdk/resourcemanager/resources/armresources/zz_generated_deployments_client.go +++ b/sdk/resourcemanager/resources/armresources/zz_generated_deployments_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -31,8 +32,15 @@ type DeploymentsClient struct { } // NewDeploymentsClient creates a new instance of DeploymentsClient with the specified values. -func NewDeploymentsClient(con *arm.Connection, subscriptionID string) *DeploymentsClient { - return &DeploymentsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDeploymentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DeploymentsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DeploymentsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CalculateTemplateHash - Calculate the hash of the given template. @@ -70,7 +78,7 @@ func (client *DeploymentsClient) calculateTemplateHashCreateRequest(ctx context. func (client *DeploymentsClient) calculateTemplateHashHandleResponse(resp *http.Response) (DeploymentsCalculateTemplateHashResponse, error) { result := DeploymentsCalculateTemplateHashResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TemplateHashResult); err != nil { - return DeploymentsCalculateTemplateHashResponse{}, err + return DeploymentsCalculateTemplateHashResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -222,9 +230,6 @@ func (client *DeploymentsClient) CancelAtScope(ctx context.Context, scope string // cancelAtScopeCreateRequest creates the CancelAtScope request. func (client *DeploymentsClient) cancelAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, options *DeploymentsCancelAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/cancel" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") @@ -463,9 +468,6 @@ func (client *DeploymentsClient) CheckExistenceAtScope(ctx context.Context, scop // checkExistenceAtScopeCreateRequest creates the CheckExistenceAtScope request. func (client *DeploymentsClient) checkExistenceAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, options *DeploymentsCheckExistenceAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") @@ -746,9 +748,6 @@ func (client *DeploymentsClient) createOrUpdateAtScope(ctx context.Context, scop // createOrUpdateAtScopeCreateRequest creates the CreateOrUpdateAtScope request. func (client *DeploymentsClient) createOrUpdateAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, parameters Deployment, options *DeploymentsBeginCreateOrUpdateAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") @@ -1142,9 +1141,6 @@ func (client *DeploymentsClient) deleteAtScope(ctx context.Context, scope string // deleteAtScopeCreateRequest creates the DeleteAtScope request. func (client *DeploymentsClient) deleteAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, options *DeploymentsBeginDeleteAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") @@ -1385,7 +1381,7 @@ func (client *DeploymentsClient) exportTemplateCreateRequest(ctx context.Context func (client *DeploymentsClient) exportTemplateHandleResponse(resp *http.Response) (DeploymentsExportTemplateResponse, error) { result := DeploymentsExportTemplateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExportResult); err != nil { - return DeploymentsExportTemplateResponse{}, err + return DeploymentsExportTemplateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1446,7 +1442,7 @@ func (client *DeploymentsClient) exportTemplateAtManagementGroupScopeCreateReque func (client *DeploymentsClient) exportTemplateAtManagementGroupScopeHandleResponse(resp *http.Response) (DeploymentsExportTemplateAtManagementGroupScopeResponse, error) { result := DeploymentsExportTemplateAtManagementGroupScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExportResult); err != nil { - return DeploymentsExportTemplateAtManagementGroupScopeResponse{}, err + return DeploymentsExportTemplateAtManagementGroupScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1484,9 +1480,6 @@ func (client *DeploymentsClient) ExportTemplateAtScope(ctx context.Context, scop // exportTemplateAtScopeCreateRequest creates the ExportTemplateAtScope request. func (client *DeploymentsClient) exportTemplateAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, options *DeploymentsExportTemplateAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/exportTemplate" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") @@ -1507,7 +1500,7 @@ func (client *DeploymentsClient) exportTemplateAtScopeCreateRequest(ctx context. func (client *DeploymentsClient) exportTemplateAtScopeHandleResponse(resp *http.Response) (DeploymentsExportTemplateAtScopeResponse, error) { result := DeploymentsExportTemplateAtScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExportResult); err != nil { - return DeploymentsExportTemplateAtScopeResponse{}, err + return DeploymentsExportTemplateAtScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1568,7 +1561,7 @@ func (client *DeploymentsClient) exportTemplateAtSubscriptionScopeCreateRequest( func (client *DeploymentsClient) exportTemplateAtSubscriptionScopeHandleResponse(resp *http.Response) (DeploymentsExportTemplateAtSubscriptionScopeResponse, error) { result := DeploymentsExportTemplateAtSubscriptionScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExportResult); err != nil { - return DeploymentsExportTemplateAtSubscriptionScopeResponse{}, err + return DeploymentsExportTemplateAtSubscriptionScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1625,7 +1618,7 @@ func (client *DeploymentsClient) exportTemplateAtTenantScopeCreateRequest(ctx co func (client *DeploymentsClient) exportTemplateAtTenantScopeHandleResponse(resp *http.Response) (DeploymentsExportTemplateAtTenantScopeResponse, error) { result := DeploymentsExportTemplateAtTenantScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExportResult); err != nil { - return DeploymentsExportTemplateAtTenantScopeResponse{}, err + return DeploymentsExportTemplateAtTenantScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1690,7 +1683,7 @@ func (client *DeploymentsClient) getCreateRequest(ctx context.Context, resourceG func (client *DeploymentsClient) getHandleResponse(resp *http.Response) (DeploymentsGetResponse, error) { result := DeploymentsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExtended); err != nil { - return DeploymentsGetResponse{}, err + return DeploymentsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1751,7 +1744,7 @@ func (client *DeploymentsClient) getAtManagementGroupScopeCreateRequest(ctx cont func (client *DeploymentsClient) getAtManagementGroupScopeHandleResponse(resp *http.Response) (DeploymentsGetAtManagementGroupScopeResponse, error) { result := DeploymentsGetAtManagementGroupScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExtended); err != nil { - return DeploymentsGetAtManagementGroupScopeResponse{}, err + return DeploymentsGetAtManagementGroupScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1789,9 +1782,6 @@ func (client *DeploymentsClient) GetAtScope(ctx context.Context, scope string, d // getAtScopeCreateRequest creates the GetAtScope request. func (client *DeploymentsClient) getAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, options *DeploymentsGetAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") @@ -1812,7 +1802,7 @@ func (client *DeploymentsClient) getAtScopeCreateRequest(ctx context.Context, sc func (client *DeploymentsClient) getAtScopeHandleResponse(resp *http.Response) (DeploymentsGetAtScopeResponse, error) { result := DeploymentsGetAtScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExtended); err != nil { - return DeploymentsGetAtScopeResponse{}, err + return DeploymentsGetAtScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1873,7 +1863,7 @@ func (client *DeploymentsClient) getAtSubscriptionScopeCreateRequest(ctx context func (client *DeploymentsClient) getAtSubscriptionScopeHandleResponse(resp *http.Response) (DeploymentsGetAtSubscriptionScopeResponse, error) { result := DeploymentsGetAtSubscriptionScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExtended); err != nil { - return DeploymentsGetAtSubscriptionScopeResponse{}, err + return DeploymentsGetAtSubscriptionScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1930,7 +1920,7 @@ func (client *DeploymentsClient) getAtTenantScopeCreateRequest(ctx context.Conte func (client *DeploymentsClient) getAtTenantScopeHandleResponse(resp *http.Response) (DeploymentsGetAtTenantScopeResponse, error) { result := DeploymentsGetAtTenantScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentExtended); err != nil { - return DeploymentsGetAtTenantScopeResponse{}, err + return DeploymentsGetAtTenantScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1990,7 +1980,7 @@ func (client *DeploymentsClient) listAtManagementGroupScopeCreateRequest(ctx con func (client *DeploymentsClient) listAtManagementGroupScopeHandleResponse(resp *http.Response) (DeploymentsListAtManagementGroupScopeResponse, error) { result := DeploymentsListAtManagementGroupScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentListResult); err != nil { - return DeploymentsListAtManagementGroupScopeResponse{}, err + return DeploymentsListAtManagementGroupScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2025,9 +2015,6 @@ func (client *DeploymentsClient) ListAtScope(scope string, options *DeploymentsL // listAtScopeCreateRequest creates the ListAtScope request. func (client *DeploymentsClient) listAtScopeCreateRequest(ctx context.Context, scope string, options *DeploymentsListAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/deployments/" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -2050,7 +2037,7 @@ func (client *DeploymentsClient) listAtScopeCreateRequest(ctx context.Context, s func (client *DeploymentsClient) listAtScopeHandleResponse(resp *http.Response) (DeploymentsListAtScopeResponse, error) { result := DeploymentsListAtScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentListResult); err != nil { - return DeploymentsListAtScopeResponse{}, err + return DeploymentsListAtScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2110,7 +2097,7 @@ func (client *DeploymentsClient) listAtSubscriptionScopeCreateRequest(ctx contex func (client *DeploymentsClient) listAtSubscriptionScopeHandleResponse(resp *http.Response) (DeploymentsListAtSubscriptionScopeResponse, error) { result := DeploymentsListAtSubscriptionScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentListResult); err != nil { - return DeploymentsListAtSubscriptionScopeResponse{}, err + return DeploymentsListAtSubscriptionScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2166,7 +2153,7 @@ func (client *DeploymentsClient) listAtTenantScopeCreateRequest(ctx context.Cont func (client *DeploymentsClient) listAtTenantScopeHandleResponse(resp *http.Response) (DeploymentsListAtTenantScopeResponse, error) { result := DeploymentsListAtTenantScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentListResult); err != nil { - return DeploymentsListAtTenantScopeResponse{}, err + return DeploymentsListAtTenantScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2230,7 +2217,7 @@ func (client *DeploymentsClient) listByResourceGroupCreateRequest(ctx context.Co func (client *DeploymentsClient) listByResourceGroupHandleResponse(resp *http.Response) (DeploymentsListByResourceGroupResponse, error) { result := DeploymentsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentListResult); err != nil { - return DeploymentsListByResourceGroupResponse{}, err + return DeploymentsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2436,9 +2423,6 @@ func (client *DeploymentsClient) validateAtScope(ctx context.Context, scope stri // validateAtScopeCreateRequest creates the ValidateAtScope request. func (client *DeploymentsClient) validateAtScopeCreateRequest(ctx context.Context, scope string, deploymentName string, parameters Deployment, options *DeploymentsBeginValidateAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/deployments/{deploymentName}/validate" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if deploymentName == "" { return nil, errors.New("parameter deploymentName cannot be empty") diff --git a/sdk/resourcemanager/resources/armresources/zz_generated_models.go b/sdk/resourcemanager/resources/armresources/zz_generated_models.go index 42e3d2e0a13c..76ce0c6c4e1f 100644 --- a/sdk/resourcemanager/resources/armresources/zz_generated_models.go +++ b/sdk/resourcemanager/resources/armresources/zz_generated_models.go @@ -304,7 +304,7 @@ func (d DeploymentOperationProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "statusCode", d.StatusCode) populate(objectMap, "statusMessage", d.StatusMessage) populate(objectMap, "targetResource", d.TargetResource) - populate(objectMap, "timestamp", (*timeRFC3339)(d.Timestamp)) + populateTimeRFC3339(objectMap, "timestamp", d.Timestamp) return json.Marshal(objectMap) } @@ -345,9 +345,7 @@ func (d *DeploymentOperationProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.TargetResource) delete(rawMsg, key) case "timestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.Timestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.Timestamp) delete(rawMsg, key) } if err != nil { @@ -538,7 +536,7 @@ func (d DeploymentPropertiesExtended) MarshalJSON() ([]byte, error) { populate(objectMap, "provisioningState", d.ProvisioningState) populate(objectMap, "templateHash", d.TemplateHash) populate(objectMap, "templateLink", d.TemplateLink) - populate(objectMap, "timestamp", (*timeRFC3339)(d.Timestamp)) + populateTimeRFC3339(objectMap, "timestamp", d.Timestamp) populate(objectMap, "validatedResources", d.ValidatedResources) return json.Marshal(objectMap) } @@ -598,9 +596,7 @@ func (d *DeploymentPropertiesExtended) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.TemplateLink) delete(rawMsg, key) case "timestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.Timestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.Timestamp) delete(rawMsg, key) case "validatedResources": err = unpopulate(val, &d.ValidatedResources) @@ -1056,8 +1052,8 @@ type GenericResourceExpanded struct { func (g GenericResourceExpanded) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) g.GenericResource.marshalInternal(objectMap) - populate(objectMap, "changedTime", (*timeRFC3339)(g.ChangedTime)) - populate(objectMap, "createdTime", (*timeRFC3339)(g.CreatedTime)) + populateTimeRFC3339(objectMap, "changedTime", g.ChangedTime) + populateTimeRFC3339(objectMap, "createdTime", g.CreatedTime) populate(objectMap, "provisioningState", g.ProvisioningState) return json.Marshal(objectMap) } @@ -1072,14 +1068,10 @@ func (g *GenericResourceExpanded) UnmarshalJSON(data []byte) error { var err error switch key { case "changedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - g.ChangedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &g.ChangedTime) delete(rawMsg, key) case "createdTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - g.CreatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &g.CreatedTime) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, &g.ProvisioningState) @@ -1831,7 +1823,7 @@ type ResourcesListByResourceGroupOptions struct { // resource are not returned in the results.

You can use some properties together when filtering. The combinations you can use are: substringof and/or // resourceType, plan and plan/publisher and plan/name, identity and identity/principalId. Filter *string - // The maximum number of results to return. If null is passed, returns all resources. + // The number of results to return. If null is passed, returns all resources. Top *int32 } @@ -1845,15 +1837,15 @@ type ResourcesListOptions struct { // `plan/version`, and `plan/promotionCode`.

For example, to filter by a resource type, use `$filter=resourceType eq 'Microsoft.Network/virtualNetworks'`


`substringof(value, // property)` can be used to filter for substrings of the following currently-supported properties: `name` and `resourceGroup`

For example, to get // all resources with 'demo' anywhere in the resource name, use `$filter=substringof('demo', name)`

Multiple substring operations can also be combined - // using `and`/`or` operators.


Resources can be filtered by tag names and values. For example, to filter for a tag name and value, use `$filter=tagName - // eq 'tag1' and tagValue eq 'Value1'`. Note that when resources are filtered by tag name and value, the original tags for each resource will not be - // returned in the results. Any list of additional properties queried via `$expand` may also not be compatible when filtering by tag names/values.

For - // tag names only, resources can be filtered by prefix using the following syntax: `$filter=startswith(tagName, 'depart')`. This query will return all resources - // with a tag name prefixed by the phrase `depart` (i.e.`department`, `departureDate`, `departureTime`, etc.)


Note that some properties can be - // combined when filtering resources, which include the following: `substringof() and/or resourceType`, `plan and plan/publisher and plan/name`, and `identity - // and identity/principalId`. + // using `and`/`or` operators.

Note that any truncated number of results queried via `$top` may also not be compatible when using a filter.


Resources + // can be filtered by tag names and values. For example, to filter for a tag name and value, use `$filter=tagName eq 'tag1' and tagValue eq 'Value1'`. Note + // that when resources are filtered by tag name and value, the original tags for each resource will not be returned in the results. Any list of additional + // properties queried via `$expand` may also not be compatible when filtering by tag names/values.

For tag names only, resources can be filtered + // by prefix using the following syntax: `$filter=startswith(tagName, 'depart')`. This query will return all resources with a tag name prefixed by the phrase + // `depart` (i.e.`department`, `departureDate`, `departureTime`, etc.)


Note that some properties can be combined when filtering resources, which + // include the following: `substringof() and/or resourceType`, `plan and plan/publisher and plan/name`, and `identity and identity/principalId`. Filter *string - // The maximum number of results to return. If null is passed, returns all resources. + // The number of results to return. If null is passed, returns all resources. Top *int32 } diff --git a/sdk/resourcemanager/resources/armresources/zz_generated_operations_client.go b/sdk/resourcemanager/resources/armresources/zz_generated_operations_client.go index 1301fbc58009..9829fcbaff01 100644 --- a/sdk/resourcemanager/resources/armresources/zz_generated_operations_client.go +++ b/sdk/resourcemanager/resources/armresources/zz_generated_operations_client.go @@ -11,7 +11,9 @@ package armresources import ( "context" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -25,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available Microsoft.Resources REST API operations. @@ -61,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/resources/armresources/zz_generated_providerresourcetypes_client.go b/sdk/resourcemanager/resources/armresources/zz_generated_providerresourcetypes_client.go index 6f3e15db0924..4464a0375f92 100644 --- a/sdk/resourcemanager/resources/armresources/zz_generated_providerresourcetypes_client.go +++ b/sdk/resourcemanager/resources/armresources/zz_generated_providerresourcetypes_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -29,8 +31,15 @@ type ProviderResourceTypesClient struct { } // NewProviderResourceTypesClient creates a new instance of ProviderResourceTypesClient with the specified values. -func NewProviderResourceTypesClient(con *arm.Connection, subscriptionID string) *ProviderResourceTypesClient { - return &ProviderResourceTypesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewProviderResourceTypesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ProviderResourceTypesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ProviderResourceTypesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - List the resource types for a specified resource provider. @@ -79,7 +88,7 @@ func (client *ProviderResourceTypesClient) listCreateRequest(ctx context.Context func (client *ProviderResourceTypesClient) listHandleResponse(resp *http.Response) (ProviderResourceTypesListResponse, error) { result := ProviderResourceTypesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProviderResourceTypeListResult); err != nil { - return ProviderResourceTypesListResponse{}, err + return ProviderResourceTypesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/resources/armresources/zz_generated_providers_client.go b/sdk/resourcemanager/resources/armresources/zz_generated_providers_client.go index 59ae6249917e..55f75493887d 100644 --- a/sdk/resourcemanager/resources/armresources/zz_generated_providers_client.go +++ b/sdk/resourcemanager/resources/armresources/zz_generated_providers_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -29,8 +31,15 @@ type ProvidersClient struct { } // NewProvidersClient creates a new instance of ProvidersClient with the specified values. -func NewProvidersClient(con *arm.Connection, subscriptionID string) *ProvidersClient { - return &ProvidersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewProvidersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ProvidersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ProvidersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the specified resource provider. @@ -79,7 +88,7 @@ func (client *ProvidersClient) getCreateRequest(ctx context.Context, resourcePro func (client *ProvidersClient) getHandleResponse(resp *http.Response) (ProvidersGetResponse, error) { result := ProvidersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Provider); err != nil { - return ProvidersGetResponse{}, err + return ProvidersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -139,7 +148,7 @@ func (client *ProvidersClient) getAtTenantScopeCreateRequest(ctx context.Context func (client *ProvidersClient) getAtTenantScopeHandleResponse(resp *http.Response) (ProvidersGetAtTenantScopeResponse, error) { result := ProvidersGetAtTenantScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Provider); err != nil { - return ProvidersGetAtTenantScopeResponse{}, err + return ProvidersGetAtTenantScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -196,7 +205,7 @@ func (client *ProvidersClient) listCreateRequest(ctx context.Context, options *P func (client *ProvidersClient) listHandleResponse(resp *http.Response) (ProvidersListResponse, error) { result := ProvidersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProviderListResult); err != nil { - return ProvidersListResponse{}, err + return ProvidersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -249,7 +258,7 @@ func (client *ProvidersClient) listAtTenantScopeCreateRequest(ctx context.Contex func (client *ProvidersClient) listAtTenantScopeHandleResponse(resp *http.Response) (ProvidersListAtTenantScopeResponse, error) { result := ProvidersListAtTenantScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProviderListResult); err != nil { - return ProvidersListAtTenantScopeResponse{}, err + return ProvidersListAtTenantScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -310,7 +319,7 @@ func (client *ProvidersClient) providerPermissionsCreateRequest(ctx context.Cont func (client *ProvidersClient) providerPermissionsHandleResponse(resp *http.Response) (ProvidersProviderPermissionsResponse, error) { result := ProvidersProviderPermissionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProviderPermissionListResult); err != nil { - return ProvidersProviderPermissionsResponse{}, err + return ProvidersProviderPermissionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -374,7 +383,7 @@ func (client *ProvidersClient) registerCreateRequest(ctx context.Context, resour func (client *ProvidersClient) registerHandleResponse(resp *http.Response) (ProvidersRegisterResponse, error) { result := ProvidersRegisterResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Provider); err != nil { - return ProvidersRegisterResponse{}, err + return ProvidersRegisterResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -487,7 +496,7 @@ func (client *ProvidersClient) unregisterCreateRequest(ctx context.Context, reso func (client *ProvidersClient) unregisterHandleResponse(resp *http.Response) (ProvidersUnregisterResponse, error) { result := ProvidersUnregisterResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Provider); err != nil { - return ProvidersUnregisterResponse{}, err + return ProvidersUnregisterResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/resources/armresources/zz_generated_resourcegroups_client.go b/sdk/resourcemanager/resources/armresources/zz_generated_resourcegroups_client.go index 4872d7677f4f..eb32e08ecb1c 100644 --- a/sdk/resourcemanager/resources/armresources/zz_generated_resourcegroups_client.go +++ b/sdk/resourcemanager/resources/armresources/zz_generated_resourcegroups_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -31,8 +32,15 @@ type ResourceGroupsClient struct { } // NewResourceGroupsClient creates a new instance of ResourceGroupsClient with the specified values. -func NewResourceGroupsClient(con *arm.Connection, subscriptionID string) *ResourceGroupsClient { - return &ResourceGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewResourceGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ResourceGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ResourceGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckExistence - Checks whether a resource group exists. @@ -118,7 +126,7 @@ func (client *ResourceGroupsClient) createOrUpdateCreateRequest(ctx context.Cont func (client *ResourceGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (ResourceGroupsCreateOrUpdateResponse, error) { result := ResourceGroupsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGroup); err != nil { - return ResourceGroupsCreateOrUpdateResponse{}, err + return ResourceGroupsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -328,7 +336,7 @@ func (client *ResourceGroupsClient) getCreateRequest(ctx context.Context, resour func (client *ResourceGroupsClient) getHandleResponse(resp *http.Response) (ResourceGroupsGetResponse, error) { result := ResourceGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGroup); err != nil { - return ResourceGroupsGetResponse{}, err + return ResourceGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -388,7 +396,7 @@ func (client *ResourceGroupsClient) listCreateRequest(ctx context.Context, optio func (client *ResourceGroupsClient) listHandleResponse(resp *http.Response) (ResourceGroupsListResponse, error) { result := ResourceGroupsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGroupListResult); err != nil { - return ResourceGroupsListResponse{}, err + return ResourceGroupsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -451,7 +459,7 @@ func (client *ResourceGroupsClient) updateCreateRequest(ctx context.Context, res func (client *ResourceGroupsClient) updateHandleResponse(resp *http.Response) (ResourceGroupsUpdateResponse, error) { result := ResourceGroupsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceGroup); err != nil { - return ResourceGroupsUpdateResponse{}, err + return ResourceGroupsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/resources/armresources/zz_generated_resources_client.go b/sdk/resourcemanager/resources/armresources/zz_generated_resources_client.go index 45912375da1b..d094bca091bd 100644 --- a/sdk/resourcemanager/resources/armresources/zz_generated_resources_client.go +++ b/sdk/resourcemanager/resources/armresources/zz_generated_resources_client.go @@ -12,6 +12,7 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" @@ -31,8 +32,15 @@ type ResourcesClient struct { } // NewResourcesClient creates a new instance of ResourcesClient with the specified values. -func NewResourcesClient(con *arm.Connection, subscriptionID string) *ResourcesClient { - return &ResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckExistence - Checks whether a resource exists. @@ -64,13 +72,7 @@ func (client *ResourcesClient) checkExistenceCreateRequest(ctx context.Context, return nil, errors.New("parameter resourceProviderNamespace cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", url.PathEscape(resourceProviderNamespace)) - if parentResourcePath == "" { - return nil, errors.New("parameter parentResourcePath cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{parentResourcePath}", parentResourcePath) - if resourceType == "" { - return nil, errors.New("parameter resourceType cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) if resourceName == "" { return nil, errors.New("parameter resourceName cannot be empty") @@ -112,9 +114,6 @@ func (client *ResourcesClient) CheckExistenceByID(ctx context.Context, resourceI // checkExistenceByIDCreateRequest creates the CheckExistenceByID request. func (client *ResourcesClient) checkExistenceByIDCreateRequest(ctx context.Context, resourceID string, apiVersion string, options *ResourcesCheckExistenceByIDOptions) (*policy.Request, error) { urlPath := "/{resourceId}" - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodHead, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -175,13 +174,7 @@ func (client *ResourcesClient) createOrUpdateCreateRequest(ctx context.Context, return nil, errors.New("parameter resourceProviderNamespace cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", url.PathEscape(resourceProviderNamespace)) - if parentResourcePath == "" { - return nil, errors.New("parameter parentResourcePath cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{parentResourcePath}", parentResourcePath) - if resourceType == "" { - return nil, errors.New("parameter resourceType cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) if resourceName == "" { return nil, errors.New("parameter resourceName cannot be empty") @@ -255,9 +248,6 @@ func (client *ResourcesClient) createOrUpdateByID(ctx context.Context, resourceI // createOrUpdateByIDCreateRequest creates the CreateOrUpdateByID request. func (client *ResourcesClient) createOrUpdateByIDCreateRequest(ctx context.Context, resourceID string, apiVersion string, parameters GenericResource, options *ResourcesBeginCreateOrUpdateByIDOptions) (*policy.Request, error) { urlPath := "/{resourceId}" - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -331,13 +321,7 @@ func (client *ResourcesClient) deleteCreateRequest(ctx context.Context, resource return nil, errors.New("parameter resourceProviderNamespace cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", url.PathEscape(resourceProviderNamespace)) - if parentResourcePath == "" { - return nil, errors.New("parameter parentResourcePath cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{parentResourcePath}", parentResourcePath) - if resourceType == "" { - return nil, errors.New("parameter resourceType cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) if resourceName == "" { return nil, errors.New("parameter resourceName cannot be empty") @@ -411,9 +395,6 @@ func (client *ResourcesClient) deleteByID(ctx context.Context, resourceID string // deleteByIDCreateRequest creates the DeleteByID request. func (client *ResourcesClient) deleteByIDCreateRequest(ctx context.Context, resourceID string, apiVersion string, options *ResourcesBeginDeleteByIDOptions) (*policy.Request, error) { urlPath := "/{resourceId}" - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -467,13 +448,7 @@ func (client *ResourcesClient) getCreateRequest(ctx context.Context, resourceGro return nil, errors.New("parameter resourceProviderNamespace cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", url.PathEscape(resourceProviderNamespace)) - if parentResourcePath == "" { - return nil, errors.New("parameter parentResourcePath cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{parentResourcePath}", parentResourcePath) - if resourceType == "" { - return nil, errors.New("parameter resourceType cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) if resourceName == "" { return nil, errors.New("parameter resourceName cannot be empty") @@ -498,7 +473,7 @@ func (client *ResourcesClient) getCreateRequest(ctx context.Context, resourceGro func (client *ResourcesClient) getHandleResponse(resp *http.Response) (ResourcesGetResponse, error) { result := ResourcesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GenericResource); err != nil { - return ResourcesGetResponse{}, err + return ResourcesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -536,9 +511,6 @@ func (client *ResourcesClient) GetByID(ctx context.Context, resourceID string, a // getByIDCreateRequest creates the GetByID request. func (client *ResourcesClient) getByIDCreateRequest(ctx context.Context, resourceID string, apiVersion string, options *ResourcesGetByIDOptions) (*policy.Request, error) { urlPath := "/{resourceId}" - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -555,7 +527,7 @@ func (client *ResourcesClient) getByIDCreateRequest(ctx context.Context, resourc func (client *ResourcesClient) getByIDHandleResponse(resp *http.Response) (ResourcesGetByIDResponse, error) { result := ResourcesGetByIDResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GenericResource); err != nil { - return ResourcesGetByIDResponse{}, err + return ResourcesGetByIDResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -618,7 +590,7 @@ func (client *ResourcesClient) listCreateRequest(ctx context.Context, options *R func (client *ResourcesClient) listHandleResponse(resp *http.Response) (ResourcesListResponse, error) { result := ResourcesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { - return ResourcesListResponse{}, err + return ResourcesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -685,7 +657,7 @@ func (client *ResourcesClient) listByResourceGroupCreateRequest(ctx context.Cont func (client *ResourcesClient) listByResourceGroupHandleResponse(resp *http.Response) (ResourcesListByResourceGroupResponse, error) { result := ResourcesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceListResult); err != nil { - return ResourcesListByResourceGroupResponse{}, err + return ResourcesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -829,13 +801,7 @@ func (client *ResourcesClient) updateCreateRequest(ctx context.Context, resource return nil, errors.New("parameter resourceProviderNamespace cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{resourceProviderNamespace}", url.PathEscape(resourceProviderNamespace)) - if parentResourcePath == "" { - return nil, errors.New("parameter parentResourcePath cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{parentResourcePath}", parentResourcePath) - if resourceType == "" { - return nil, errors.New("parameter resourceType cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceType}", resourceType) if resourceName == "" { return nil, errors.New("parameter resourceName cannot be empty") @@ -909,9 +875,6 @@ func (client *ResourcesClient) updateByID(ctx context.Context, resourceID string // updateByIDCreateRequest creates the UpdateByID request. func (client *ResourcesClient) updateByIDCreateRequest(ctx context.Context, resourceID string, apiVersion string, parameters GenericResource, options *ResourcesBeginUpdateByIDOptions) (*policy.Request, error) { urlPath := "/{resourceId}" - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { diff --git a/sdk/resourcemanager/resources/armresources/zz_generated_response_types.go b/sdk/resourcemanager/resources/armresources/zz_generated_response_types.go index f85ea820fec2..3d682d430eae 100644 --- a/sdk/resourcemanager/resources/armresources/zz_generated_response_types.go +++ b/sdk/resourcemanager/resources/armresources/zz_generated_response_types.go @@ -252,6 +252,8 @@ type DeploymentsCreateOrUpdateAtManagementGroupScopePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsCreateOrUpdateAtManagementGroupScopePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsCreateOrUpdateAtManagementGroupScopeResponse, error) { respType := DeploymentsCreateOrUpdateAtManagementGroupScopeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DeploymentExtended) @@ -302,6 +304,8 @@ type DeploymentsCreateOrUpdateAtScopePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsCreateOrUpdateAtScopePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsCreateOrUpdateAtScopeResponse, error) { respType := DeploymentsCreateOrUpdateAtScopeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DeploymentExtended) @@ -352,6 +356,8 @@ type DeploymentsCreateOrUpdateAtSubscriptionScopePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsCreateOrUpdateAtSubscriptionScopePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsCreateOrUpdateAtSubscriptionScopeResponse, error) { respType := DeploymentsCreateOrUpdateAtSubscriptionScopeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DeploymentExtended) @@ -402,6 +408,8 @@ type DeploymentsCreateOrUpdateAtTenantScopePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsCreateOrUpdateAtTenantScopePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsCreateOrUpdateAtTenantScopeResponse, error) { respType := DeploymentsCreateOrUpdateAtTenantScopeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DeploymentExtended) @@ -452,6 +460,8 @@ type DeploymentsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsCreateOrUpdateResponse, error) { respType := DeploymentsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DeploymentExtended) @@ -502,6 +512,8 @@ type DeploymentsDeleteAtManagementGroupScopePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsDeleteAtManagementGroupScopePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsDeleteAtManagementGroupScopeResponse, error) { respType := DeploymentsDeleteAtManagementGroupScopeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -546,6 +558,8 @@ type DeploymentsDeleteAtScopePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsDeleteAtScopePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsDeleteAtScopeResponse, error) { respType := DeploymentsDeleteAtScopeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -590,6 +604,8 @@ type DeploymentsDeleteAtSubscriptionScopePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsDeleteAtSubscriptionScopePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsDeleteAtSubscriptionScopeResponse, error) { respType := DeploymentsDeleteAtSubscriptionScopeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -634,6 +650,8 @@ type DeploymentsDeleteAtTenantScopePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsDeleteAtTenantScopePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsDeleteAtTenantScopeResponse, error) { respType := DeploymentsDeleteAtTenantScopeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -678,6 +696,8 @@ type DeploymentsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsDeleteResponse, error) { respType := DeploymentsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -902,6 +922,8 @@ type DeploymentsValidateAtManagementGroupScopePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsValidateAtManagementGroupScopePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsValidateAtManagementGroupScopeResponse, error) { respType := DeploymentsValidateAtManagementGroupScopeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DeploymentValidateResult) @@ -952,6 +974,8 @@ type DeploymentsValidateAtScopePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsValidateAtScopePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsValidateAtScopeResponse, error) { respType := DeploymentsValidateAtScopeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DeploymentValidateResult) @@ -1002,6 +1026,8 @@ type DeploymentsValidateAtSubscriptionScopePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsValidateAtSubscriptionScopePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsValidateAtSubscriptionScopeResponse, error) { respType := DeploymentsValidateAtSubscriptionScopeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DeploymentValidateResult) @@ -1052,6 +1078,8 @@ type DeploymentsValidateAtTenantScopePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsValidateAtTenantScopePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsValidateAtTenantScopeResponse, error) { respType := DeploymentsValidateAtTenantScopeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DeploymentValidateResult) @@ -1102,6 +1130,8 @@ type DeploymentsValidatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsValidatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsValidateResponse, error) { respType := DeploymentsValidateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DeploymentValidateResult) @@ -1152,6 +1182,8 @@ type DeploymentsWhatIfAtManagementGroupScopePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsWhatIfAtManagementGroupScopePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsWhatIfAtManagementGroupScopeResponse, error) { respType := DeploymentsWhatIfAtManagementGroupScopeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.WhatIfOperationResult) @@ -1202,6 +1234,8 @@ type DeploymentsWhatIfAtSubscriptionScopePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsWhatIfAtSubscriptionScopePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsWhatIfAtSubscriptionScopeResponse, error) { respType := DeploymentsWhatIfAtSubscriptionScopeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.WhatIfOperationResult) @@ -1252,6 +1286,8 @@ type DeploymentsWhatIfAtTenantScopePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsWhatIfAtTenantScopePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsWhatIfAtTenantScopeResponse, error) { respType := DeploymentsWhatIfAtTenantScopeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.WhatIfOperationResult) @@ -1302,6 +1338,8 @@ type DeploymentsWhatIfPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeploymentsWhatIfPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeploymentsWhatIfResponse, error) { respType := DeploymentsWhatIfResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.WhatIfOperationResult) @@ -1491,6 +1529,8 @@ type ResourceGroupsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ResourceGroupsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ResourceGroupsDeleteResponse, error) { respType := ResourceGroupsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1535,6 +1575,8 @@ type ResourceGroupsExportTemplatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ResourceGroupsExportTemplatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ResourceGroupsExportTemplateResponse, error) { respType := ResourceGroupsExportTemplateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ResourceGroupExportResult) @@ -1647,6 +1689,8 @@ type ResourcesCreateOrUpdateByIDPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ResourcesCreateOrUpdateByIDPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ResourcesCreateOrUpdateByIDResponse, error) { respType := ResourcesCreateOrUpdateByIDResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GenericResource) @@ -1697,6 +1741,8 @@ type ResourcesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ResourcesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ResourcesCreateOrUpdateResponse, error) { respType := ResourcesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GenericResource) @@ -1747,6 +1793,8 @@ type ResourcesDeleteByIDPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ResourcesDeleteByIDPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ResourcesDeleteByIDResponse, error) { respType := ResourcesDeleteByIDResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1791,6 +1839,8 @@ type ResourcesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ResourcesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ResourcesDeleteResponse, error) { respType := ResourcesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1883,6 +1933,8 @@ type ResourcesMoveResourcesPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ResourcesMoveResourcesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ResourcesMoveResourcesResponse, error) { respType := ResourcesMoveResourcesResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1927,6 +1979,8 @@ type ResourcesUpdateByIDPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ResourcesUpdateByIDPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ResourcesUpdateByIDResponse, error) { respType := ResourcesUpdateByIDResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GenericResource) @@ -1977,6 +2031,8 @@ type ResourcesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ResourcesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ResourcesUpdateResponse, error) { respType := ResourcesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.GenericResource) @@ -2027,6 +2083,8 @@ type ResourcesValidateMoveResourcesPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ResourcesValidateMoveResourcesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ResourcesValidateMoveResourcesResponse, error) { respType := ResourcesValidateMoveResourcesResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/resources/armresources/zz_generated_tags_client.go b/sdk/resourcemanager/resources/armresources/zz_generated_tags_client.go index 46d0f582ab81..129397238709 100644 --- a/sdk/resourcemanager/resources/armresources/zz_generated_tags_client.go +++ b/sdk/resourcemanager/resources/armresources/zz_generated_tags_client.go @@ -12,7 +12,9 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" @@ -29,8 +31,15 @@ type TagsClient struct { } // NewTagsClient creates a new instance of TagsClient with the specified values. -func NewTagsClient(con *arm.Connection, subscriptionID string) *TagsClient { - return &TagsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTagsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TagsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TagsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - This operation allows adding a name to the list of predefined tag names for the given subscription. A tag name can have a maximum of @@ -78,7 +87,7 @@ func (client *TagsClient) createOrUpdateCreateRequest(ctx context.Context, tagNa func (client *TagsClient) createOrUpdateHandleResponse(resp *http.Response) (TagsCreateOrUpdateResponse, error) { result := TagsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TagDetails); err != nil { - return TagsCreateOrUpdateResponse{}, err + return TagsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -117,9 +126,6 @@ func (client *TagsClient) CreateOrUpdateAtScope(ctx context.Context, scope strin // createOrUpdateAtScopeCreateRequest creates the CreateOrUpdateAtScope request. func (client *TagsClient) createOrUpdateAtScopeCreateRequest(ctx context.Context, scope string, parameters TagsResource, options *TagsCreateOrUpdateAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/tags/default" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -136,7 +142,7 @@ func (client *TagsClient) createOrUpdateAtScopeCreateRequest(ctx context.Context func (client *TagsClient) createOrUpdateAtScopeHandleResponse(resp *http.Response) (TagsCreateOrUpdateAtScopeResponse, error) { result := TagsCreateOrUpdateAtScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TagsResource); err != nil { - return TagsCreateOrUpdateAtScopeResponse{}, err + return TagsCreateOrUpdateAtScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -202,7 +208,7 @@ func (client *TagsClient) createOrUpdateValueCreateRequest(ctx context.Context, func (client *TagsClient) createOrUpdateValueHandleResponse(resp *http.Response) (TagsCreateOrUpdateValueResponse, error) { result := TagsCreateOrUpdateValueResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TagValue); err != nil { - return TagsCreateOrUpdateValueResponse{}, err + return TagsCreateOrUpdateValueResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -294,9 +300,6 @@ func (client *TagsClient) DeleteAtScope(ctx context.Context, scope string, optio // deleteAtScopeCreateRequest creates the DeleteAtScope request. func (client *TagsClient) deleteAtScopeCreateRequest(ctx context.Context, scope string, options *TagsDeleteAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/tags/default" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -400,9 +403,6 @@ func (client *TagsClient) GetAtScope(ctx context.Context, scope string, options // getAtScopeCreateRequest creates the GetAtScope request. func (client *TagsClient) getAtScopeCreateRequest(ctx context.Context, scope string, options *TagsGetAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/tags/default" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -419,7 +419,7 @@ func (client *TagsClient) getAtScopeCreateRequest(ctx context.Context, scope str func (client *TagsClient) getAtScopeHandleResponse(resp *http.Response) (TagsGetAtScopeResponse, error) { result := TagsGetAtScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TagsResource); err != nil { - return TagsGetAtScopeResponse{}, err + return TagsGetAtScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -475,7 +475,7 @@ func (client *TagsClient) listCreateRequest(ctx context.Context, options *TagsLi func (client *TagsClient) listHandleResponse(resp *http.Response) (TagsListResponse, error) { result := TagsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TagsListResult); err != nil { - return TagsListResponse{}, err + return TagsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -517,9 +517,6 @@ func (client *TagsClient) UpdateAtScope(ctx context.Context, scope string, param // updateAtScopeCreateRequest creates the UpdateAtScope request. func (client *TagsClient) updateAtScopeCreateRequest(ctx context.Context, scope string, parameters TagsPatchResource, options *TagsUpdateAtScopeOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Resources/tags/default" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -536,7 +533,7 @@ func (client *TagsClient) updateAtScopeCreateRequest(ctx context.Context, scope func (client *TagsClient) updateAtScopeHandleResponse(resp *http.Response) (TagsUpdateAtScopeResponse, error) { result := TagsUpdateAtScopeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TagsResource); err != nil { - return TagsUpdateAtScopeResponse{}, err + return TagsUpdateAtScopeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/resources/armresources/zz_generated_time_rfc3339.go b/sdk/resourcemanager/resources/armresources/zz_generated_time_rfc3339.go index 7b4385737e6d..8c4e1eb3d24c 100644 --- a/sdk/resourcemanager/resources/armresources/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/resources/armresources/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armresources import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/scheduler/armscheduler/CHANGELOG.md b/sdk/resourcemanager/scheduler/armscheduler/CHANGELOG.md index e4f3d9f035c1..6ee9f3587c1a 100644 --- a/sdk/resourcemanager/scheduler/armscheduler/CHANGELOG.md +++ b/sdk/resourcemanager/scheduler/armscheduler/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-26) diff --git a/sdk/resourcemanager/scheduler/armscheduler/README.md b/sdk/resourcemanager/scheduler/armscheduler/README.md index faffae7cd5a4..76634820aa76 100644 --- a/sdk/resourcemanager/scheduler/armscheduler/README.md +++ b/sdk/resourcemanager/scheduler/armscheduler/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Scheduler +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Scheduler modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armscheduler.NewJobCollectionsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Scheduler modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armscheduler.NewJobCollectionsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armscheduler.NewJobCollectionsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/scheduler/armscheduler/autorest.md b/sdk/resourcemanager/scheduler/armscheduler/autorest.md index 56b016db82cb..e65b5e303e0f 100644 --- a/sdk/resourcemanager/scheduler/armscheduler/autorest.md +++ b/sdk/resourcemanager/scheduler/armscheduler/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/3c16aae50c7110e1aad241ac93995621d4093d46/specification/scheduler/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/3c16aae50c7110e1aad241ac93995621d4093d46/specification/scheduler/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/scheduler/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/scheduler/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/scheduler/armscheduler/go.mod b/sdk/resourcemanager/scheduler/armscheduler/go.mod index 12696170eaf6..089280de2a2a 100644 --- a/sdk/resourcemanager/scheduler/armscheduler/go.mod +++ b/sdk/resourcemanager/scheduler/armscheduler/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/scheduler/armschedu go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.2.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/scheduler/armscheduler/go.sum b/sdk/resourcemanager/scheduler/armscheduler/go.sum index c8ff7a2143ad..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/scheduler/armscheduler/go.sum +++ b/sdk/resourcemanager/scheduler/armscheduler/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible h1:iCb2tuoEm3N7ZpUDOvu1Yxl1B3iOVDmaD6weaRuIPzs= -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/scheduler/armscheduler/zz_generated_constants.go b/sdk/resourcemanager/scheduler/armscheduler/zz_generated_constants.go index 1c23d84df41d..54dda23c67e1 100644 --- a/sdk/resourcemanager/scheduler/armscheduler/zz_generated_constants.go +++ b/sdk/resourcemanager/scheduler/armscheduler/zz_generated_constants.go @@ -10,7 +10,7 @@ package armscheduler const ( module = "armscheduler" - version = "v0.1.1" + version = "v0.2.0" ) type DayOfWeek string diff --git a/sdk/resourcemanager/scheduler/armscheduler/zz_generated_jobcollections_client.go b/sdk/resourcemanager/scheduler/armscheduler/zz_generated_jobcollections_client.go index 298ea82dd6a7..1950c9e65f0c 100644 --- a/sdk/resourcemanager/scheduler/armscheduler/zz_generated_jobcollections_client.go +++ b/sdk/resourcemanager/scheduler/armscheduler/zz_generated_jobcollections_client.go @@ -11,14 +11,14 @@ package armscheduler import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // JobCollectionsClient contains the methods for the JobCollections group. @@ -30,8 +30,15 @@ type JobCollectionsClient struct { } // NewJobCollectionsClient creates a new instance of JobCollectionsClient with the specified values. -func NewJobCollectionsClient(con *arm.Connection, subscriptionID string) *JobCollectionsClient { - return &JobCollectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewJobCollectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *JobCollectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &JobCollectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Provisions a new job collection or updates an existing job collection. @@ -81,7 +88,7 @@ func (client *JobCollectionsClient) createOrUpdateCreateRequest(ctx context.Cont func (client *JobCollectionsClient) createOrUpdateHandleResponse(resp *http.Response) (JobCollectionsCreateOrUpdateResponse, error) { result := JobCollectionsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobCollectionDefinition); err != nil { - return JobCollectionsCreateOrUpdateResponse{}, err + return JobCollectionsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -367,7 +374,7 @@ func (client *JobCollectionsClient) getCreateRequest(ctx context.Context, resour func (client *JobCollectionsClient) getHandleResponse(resp *http.Response) (JobCollectionsGetResponse, error) { result := JobCollectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobCollectionDefinition); err != nil { - return JobCollectionsGetResponse{}, err + return JobCollectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -424,7 +431,7 @@ func (client *JobCollectionsClient) listByResourceGroupCreateRequest(ctx context func (client *JobCollectionsClient) listByResourceGroupHandleResponse(resp *http.Response) (JobCollectionsListByResourceGroupResponse, error) { result := JobCollectionsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobCollectionListResult); err != nil { - return JobCollectionsListByResourceGroupResponse{}, err + return JobCollectionsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -477,7 +484,7 @@ func (client *JobCollectionsClient) listBySubscriptionCreateRequest(ctx context. func (client *JobCollectionsClient) listBySubscriptionHandleResponse(resp *http.Response) (JobCollectionsListBySubscriptionResponse, error) { result := JobCollectionsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobCollectionListResult); err != nil { - return JobCollectionsListBySubscriptionResponse{}, err + return JobCollectionsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -541,7 +548,7 @@ func (client *JobCollectionsClient) patchCreateRequest(ctx context.Context, reso func (client *JobCollectionsClient) patchHandleResponse(resp *http.Response) (JobCollectionsPatchResponse, error) { result := JobCollectionsPatchResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobCollectionDefinition); err != nil { - return JobCollectionsPatchResponse{}, err + return JobCollectionsPatchResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/scheduler/armscheduler/zz_generated_jobs_client.go b/sdk/resourcemanager/scheduler/armscheduler/zz_generated_jobs_client.go index b891fa1593b1..ef028ee7fb7f 100644 --- a/sdk/resourcemanager/scheduler/armscheduler/zz_generated_jobs_client.go +++ b/sdk/resourcemanager/scheduler/armscheduler/zz_generated_jobs_client.go @@ -11,14 +11,15 @@ package armscheduler import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // JobsClient contains the methods for the Jobs group. @@ -30,8 +31,15 @@ type JobsClient struct { } // NewJobsClient creates a new instance of JobsClient with the specified values. -func NewJobsClient(con *arm.Connection, subscriptionID string) *JobsClient { - return &JobsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *JobsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &JobsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Provisions a new job or updates an existing job. @@ -85,7 +93,7 @@ func (client *JobsClient) createOrUpdateCreateRequest(ctx context.Context, resou func (client *JobsClient) createOrUpdateHandleResponse(resp *http.Response) (JobsCreateOrUpdateResponse, error) { result := JobsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobDefinition); err != nil { - return JobsCreateOrUpdateResponse{}, err + return JobsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -211,7 +219,7 @@ func (client *JobsClient) getCreateRequest(ctx context.Context, resourceGroupNam func (client *JobsClient) getHandleResponse(resp *http.Response) (JobsGetResponse, error) { result := JobsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobDefinition); err != nil { - return JobsGetResponse{}, err + return JobsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -281,7 +289,7 @@ func (client *JobsClient) listCreateRequest(ctx context.Context, resourceGroupNa func (client *JobsClient) listHandleResponse(resp *http.Response) (JobsListResponse, error) { result := JobsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobListResult); err != nil { - return JobsListResponse{}, err + return JobsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -355,7 +363,7 @@ func (client *JobsClient) listJobHistoryCreateRequest(ctx context.Context, resou func (client *JobsClient) listJobHistoryHandleResponse(resp *http.Response) (JobsListJobHistoryResponse, error) { result := JobsListJobHistoryResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobHistoryListResult); err != nil { - return JobsListJobHistoryResponse{}, err + return JobsListJobHistoryResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -423,7 +431,7 @@ func (client *JobsClient) patchCreateRequest(ctx context.Context, resourceGroupN func (client *JobsClient) patchHandleResponse(resp *http.Response) (JobsPatchResponse, error) { result := JobsPatchResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobDefinition); err != nil { - return JobsPatchResponse{}, err + return JobsPatchResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/scheduler/armscheduler/zz_generated_models.go b/sdk/resourcemanager/scheduler/armscheduler/zz_generated_models.go index 611b482b2427..e9bad759258e 100644 --- a/sdk/resourcemanager/scheduler/armscheduler/zz_generated_models.go +++ b/sdk/resourcemanager/scheduler/armscheduler/zz_generated_models.go @@ -10,10 +10,9 @@ package armscheduler import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) type BasicAuthentication struct { @@ -82,7 +81,7 @@ type ClientCertAuthentication struct { func (c ClientCertAuthentication) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) c.HTTPAuthentication.marshalInternal(objectMap, HTTPAuthenticationTypeClientCertificate) - populate(objectMap, "certificateExpirationDate", (*timeRFC3339)(c.CertificateExpirationDate)) + populateTimeRFC3339(objectMap, "certificateExpirationDate", c.CertificateExpirationDate) populate(objectMap, "certificateSubjectName", c.CertificateSubjectName) populate(objectMap, "certificateThumbprint", c.CertificateThumbprint) populate(objectMap, "password", c.Password) @@ -100,9 +99,7 @@ func (c *ClientCertAuthentication) UnmarshalJSON(data []byte) error { var err error switch key { case "certificateExpirationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.CertificateExpirationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.CertificateExpirationDate) delete(rawMsg, key) case "certificateSubjectName": err = unpopulate(val, &c.CertificateSubjectName) @@ -454,12 +451,12 @@ type JobHistoryDefinitionProperties struct { func (j JobHistoryDefinitionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "actionName", j.ActionName) - populate(objectMap, "endTime", (*timeRFC3339)(j.EndTime)) - populate(objectMap, "expectedExecutionTime", (*timeRFC3339)(j.ExpectedExecutionTime)) + populateTimeRFC3339(objectMap, "endTime", j.EndTime) + populateTimeRFC3339(objectMap, "expectedExecutionTime", j.ExpectedExecutionTime) populate(objectMap, "message", j.Message) populate(objectMap, "repeatCount", j.RepeatCount) populate(objectMap, "retryCount", j.RetryCount) - populate(objectMap, "startTime", (*timeRFC3339)(j.StartTime)) + populateTimeRFC3339(objectMap, "startTime", j.StartTime) populate(objectMap, "status", j.Status) return json.Marshal(objectMap) } @@ -477,14 +474,10 @@ func (j *JobHistoryDefinitionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &j.ActionName) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.EndTime) delete(rawMsg, key) case "expectedExecutionTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.ExpectedExecutionTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.ExpectedExecutionTime) delete(rawMsg, key) case "message": err = unpopulate(val, &j.Message) @@ -496,9 +489,7 @@ func (j *JobHistoryDefinitionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &j.RetryCount) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &j.Status) @@ -578,7 +569,7 @@ func (j JobProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "action", j.Action) populate(objectMap, "recurrence", j.Recurrence) - populate(objectMap, "startTime", (*timeRFC3339)(j.StartTime)) + populateTimeRFC3339(objectMap, "startTime", j.StartTime) populate(objectMap, "state", j.State) populate(objectMap, "status", j.Status) return json.Marshal(objectMap) @@ -600,9 +591,7 @@ func (j *JobProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &j.Recurrence) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.StartTime) delete(rawMsg, key) case "state": err = unpopulate(val, &j.State) @@ -637,7 +626,7 @@ type JobRecurrence struct { func (j JobRecurrence) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "count", j.Count) - populate(objectMap, "endTime", (*timeRFC3339)(j.EndTime)) + populateTimeRFC3339(objectMap, "endTime", j.EndTime) populate(objectMap, "frequency", j.Frequency) populate(objectMap, "interval", j.Interval) populate(objectMap, "schedule", j.Schedule) @@ -657,9 +646,7 @@ func (j *JobRecurrence) UnmarshalJSON(data []byte) error { err = unpopulate(val, &j.Count) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.EndTime) delete(rawMsg, key) case "frequency": err = unpopulate(val, &j.Frequency) @@ -742,8 +729,8 @@ func (j JobStatus) MarshalJSON() ([]byte, error) { populate(objectMap, "executionCount", j.ExecutionCount) populate(objectMap, "failureCount", j.FailureCount) populate(objectMap, "faultedCount", j.FaultedCount) - populate(objectMap, "lastExecutionTime", (*timeRFC3339)(j.LastExecutionTime)) - populate(objectMap, "nextExecutionTime", (*timeRFC3339)(j.NextExecutionTime)) + populateTimeRFC3339(objectMap, "lastExecutionTime", j.LastExecutionTime) + populateTimeRFC3339(objectMap, "nextExecutionTime", j.NextExecutionTime) return json.Marshal(objectMap) } @@ -766,14 +753,10 @@ func (j *JobStatus) UnmarshalJSON(data []byte) error { err = unpopulate(val, &j.FaultedCount) delete(rawMsg, key) case "lastExecutionTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.LastExecutionTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.LastExecutionTime) delete(rawMsg, key) case "nextExecutionTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.NextExecutionTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.NextExecutionTime) delete(rawMsg, key) } if err != nil { @@ -965,7 +948,7 @@ func (s ServiceBusBrokeredMessageProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "partitionKey", s.PartitionKey) populate(objectMap, "replyTo", s.ReplyTo) populate(objectMap, "replyToSessionId", s.ReplyToSessionID) - populate(objectMap, "scheduledEnqueueTimeUtc", (*timeRFC3339)(s.ScheduledEnqueueTimeUTC)) + populateTimeRFC3339(objectMap, "scheduledEnqueueTimeUtc", s.ScheduledEnqueueTimeUTC) populate(objectMap, "sessionId", s.SessionID) populate(objectMap, "timeToLive", s.TimeToLive) populate(objectMap, "to", s.To) @@ -1007,9 +990,7 @@ func (s *ServiceBusBrokeredMessageProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.ReplyToSessionID) delete(rawMsg, key) case "scheduledEnqueueTimeUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.ScheduledEnqueueTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.ScheduledEnqueueTimeUTC) delete(rawMsg, key) case "sessionId": err = unpopulate(val, &s.SessionID) diff --git a/sdk/resourcemanager/scheduler/armscheduler/zz_generated_pagers.go b/sdk/resourcemanager/scheduler/armscheduler/zz_generated_pagers.go index 26d06fea06aa..567d271de484 100644 --- a/sdk/resourcemanager/scheduler/armscheduler/zz_generated_pagers.go +++ b/sdk/resourcemanager/scheduler/armscheduler/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armscheduler import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // JobCollectionsListByResourceGroupPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/scheduler/armscheduler/zz_generated_pollers.go b/sdk/resourcemanager/scheduler/armscheduler/zz_generated_pollers.go index c309bc6d2385..3685a26e930e 100644 --- a/sdk/resourcemanager/scheduler/armscheduler/zz_generated_pollers.go +++ b/sdk/resourcemanager/scheduler/armscheduler/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armscheduler import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // JobCollectionsDeletePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/scheduler/armscheduler/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/scheduler/armscheduler/zz_generated_polymorphic_helpers.go index f3c94bd8044f..fe2400248da9 100644 --- a/sdk/resourcemanager/scheduler/armscheduler/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/scheduler/armscheduler/zz_generated_polymorphic_helpers.go @@ -50,3 +50,22 @@ func unmarshalHTTPAuthenticationClassificationArray(rawMsg json.RawMessage) ([]H } return fArray, nil } + +func unmarshalHTTPAuthenticationClassificationMap(rawMsg json.RawMessage) (map[string]HTTPAuthenticationClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]HTTPAuthenticationClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalHTTPAuthenticationClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/scheduler/armscheduler/zz_generated_response_types.go b/sdk/resourcemanager/scheduler/armscheduler/zz_generated_response_types.go index e70272ba2999..4a852477555a 100644 --- a/sdk/resourcemanager/scheduler/armscheduler/zz_generated_response_types.go +++ b/sdk/resourcemanager/scheduler/armscheduler/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armscheduler import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // JobCollectionsCreateOrUpdateResponse contains the response from method JobCollections.CreateOrUpdate. @@ -38,6 +37,8 @@ type JobCollectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l JobCollectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (JobCollectionsDeleteResponse, error) { respType := JobCollectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -82,6 +83,8 @@ type JobCollectionsDisablePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l JobCollectionsDisablePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (JobCollectionsDisableResponse, error) { respType := JobCollectionsDisableResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -126,6 +129,8 @@ type JobCollectionsEnablePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l JobCollectionsEnablePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (JobCollectionsEnableResponse, error) { respType := JobCollectionsEnableResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/scheduler/armscheduler/zz_generated_time_rfc3339.go b/sdk/resourcemanager/scheduler/armscheduler/zz_generated_time_rfc3339.go index 597cad4bd6e3..2464aacdc691 100644 --- a/sdk/resourcemanager/scheduler/armscheduler/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/scheduler/armscheduler/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armscheduler import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/search/armsearch/CHANGELOG.md b/sdk/resourcemanager/search/armsearch/CHANGELOG.md index e4f3d9f035c1..6ee9f3587c1a 100644 --- a/sdk/resourcemanager/search/armsearch/CHANGELOG.md +++ b/sdk/resourcemanager/search/armsearch/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-26) diff --git a/sdk/resourcemanager/search/armsearch/README.md b/sdk/resourcemanager/search/armsearch/README.md index 3a95903edff9..21a5fd2263cb 100644 --- a/sdk/resourcemanager/search/armsearch/README.md +++ b/sdk/resourcemanager/search/armsearch/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Search +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Search modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armsearch.NewQueryKeysClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Search modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armsearch.NewQueryKeysClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armsearch.NewQueryKeysClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/search/armsearch/autorest.md b/sdk/resourcemanager/search/armsearch/autorest.md index 1a19077c5e88..901238030fa0 100644 --- a/sdk/resourcemanager/search/armsearch/autorest.md +++ b/sdk/resourcemanager/search/armsearch/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/2a5304178ab7416e40622808dea5b630fb7854d9/specification/search/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/2a5304178ab7416e40622808dea5b630fb7854d9/specification/search/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/search/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/search/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/search/armsearch/go.mod b/sdk/resourcemanager/search/armsearch/go.mod index 2f901e2d96aa..e381315d9b9e 100644 --- a/sdk/resourcemanager/search/armsearch/go.mod +++ b/sdk/resourcemanager/search/armsearch/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/search/armsearch go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.2.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/search/armsearch/go.sum b/sdk/resourcemanager/search/armsearch/go.sum index c8ff7a2143ad..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/search/armsearch/go.sum +++ b/sdk/resourcemanager/search/armsearch/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible h1:iCb2tuoEm3N7ZpUDOvu1Yxl1B3iOVDmaD6weaRuIPzs= -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_adminkeys_client.go b/sdk/resourcemanager/search/armsearch/zz_generated_adminkeys_client.go index 66b25fd95e55..188b083682d1 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_adminkeys_client.go +++ b/sdk/resourcemanager/search/armsearch/zz_generated_adminkeys_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AdminKeysClient contains the methods for the AdminKeys group. @@ -30,8 +31,15 @@ type AdminKeysClient struct { } // NewAdminKeysClient creates a new instance of AdminKeysClient with the specified values. -func NewAdminKeysClient(con *arm.Connection, subscriptionID string) *AdminKeysClient { - return &AdminKeysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAdminKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AdminKeysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AdminKeysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the primary and secondary admin API keys for the specified Azure Cognitive Search service. @@ -84,7 +92,7 @@ func (client *AdminKeysClient) getCreateRequest(ctx context.Context, resourceGro func (client *AdminKeysClient) getHandleResponse(resp *http.Response) (AdminKeysGetResponse, error) { result := AdminKeysGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AdminKeyResult); err != nil { - return AdminKeysGetResponse{}, err + return AdminKeysGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -156,7 +164,7 @@ func (client *AdminKeysClient) regenerateCreateRequest(ctx context.Context, reso func (client *AdminKeysClient) regenerateHandleResponse(resp *http.Response) (AdminKeysRegenerateResponse, error) { result := AdminKeysRegenerateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AdminKeyResult); err != nil { - return AdminKeysRegenerateResponse{}, err + return AdminKeysRegenerateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_constants.go b/sdk/resourcemanager/search/armsearch/zz_generated_constants.go index 17c3b88ea794..30956d20cdb8 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_constants.go +++ b/sdk/resourcemanager/search/armsearch/zz_generated_constants.go @@ -10,7 +10,7 @@ package armsearch const ( module = "armsearch" - version = "v0.1.1" + version = "v0.2.0" ) type AdminKeyKind string diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_models.go b/sdk/resourcemanager/search/armsearch/zz_generated_models.go index df832c5f57b7..fd98a2585eca 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_models.go +++ b/sdk/resourcemanager/search/armsearch/zz_generated_models.go @@ -10,9 +10,8 @@ package armsearch import ( "encoding/json" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" ) // AdminKeyResult - Response containing the primary and secondary admin API keys for a given Azure Cognitive Search service. diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_operations_client.go b/sdk/resourcemanager/search/armsearch/zz_generated_operations_client.go index 09e8454c38d5..847ed5a54617 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_operations_client.go +++ b/sdk/resourcemanager/search/armsearch/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armsearch import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available REST API operations of the Microsoft.Search provider. @@ -65,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_pagers.go b/sdk/resourcemanager/search/armsearch/zz_generated_pagers.go index 833f0fcbbc74..393490cb21f0 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_pagers.go +++ b/sdk/resourcemanager/search/armsearch/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armsearch import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // PrivateEndpointConnectionsListByServicePager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_pollers.go b/sdk/resourcemanager/search/armsearch/zz_generated_pollers.go index 9c99dff40b55..e584ef596b89 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_pollers.go +++ b/sdk/resourcemanager/search/armsearch/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armsearch import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // ServicesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/search/armsearch/zz_generated_privateendpointconnections_client.go index 8edf658994fe..0563657fff0e 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/search/armsearch/zz_generated_privateendpointconnections_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. @@ -30,8 +31,15 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { - return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Delete - Disconnects the private endpoint connection and deletes it from the search service. @@ -88,7 +96,7 @@ func (client *PrivateEndpointConnectionsClient) deleteCreateRequest(ctx context. func (client *PrivateEndpointConnectionsClient) deleteHandleResponse(resp *http.Response) (PrivateEndpointConnectionsDeleteResponse, error) { result := PrivateEndpointConnectionsDeleteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsDeleteResponse{}, err + return PrivateEndpointConnectionsDeleteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -160,7 +168,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsGetResponse{}, err + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -225,7 +233,7 @@ func (client *PrivateEndpointConnectionsClient) listByServiceCreateRequest(ctx c func (client *PrivateEndpointConnectionsClient) listByServiceHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListByServiceResponse, error) { result := PrivateEndpointConnectionsListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionsListByServiceResponse{}, err + return PrivateEndpointConnectionsListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -297,7 +305,7 @@ func (client *PrivateEndpointConnectionsClient) updateCreateRequest(ctx context. func (client *PrivateEndpointConnectionsClient) updateHandleResponse(resp *http.Response) (PrivateEndpointConnectionsUpdateResponse, error) { result := PrivateEndpointConnectionsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsUpdateResponse{}, err + return PrivateEndpointConnectionsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/search/armsearch/zz_generated_privatelinkresources_client.go index 2b32a78d09a1..12358852a4c3 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/search/armsearch/zz_generated_privatelinkresources_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. @@ -30,8 +31,15 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { - return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListSupported - Gets a list of all supported private link resource types for the given service. @@ -84,7 +92,7 @@ func (client *PrivateLinkResourcesClient) listSupportedCreateRequest(ctx context func (client *PrivateLinkResourcesClient) listSupportedHandleResponse(resp *http.Response) (PrivateLinkResourcesListSupportedResponse, error) { result := PrivateLinkResourcesListSupportedResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourcesResult); err != nil { - return PrivateLinkResourcesListSupportedResponse{}, err + return PrivateLinkResourcesListSupportedResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_querykeys_client.go b/sdk/resourcemanager/search/armsearch/zz_generated_querykeys_client.go index 3e94877a07a4..9aeddc6dbddd 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_querykeys_client.go +++ b/sdk/resourcemanager/search/armsearch/zz_generated_querykeys_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // QueryKeysClient contains the methods for the QueryKeys group. @@ -30,8 +31,15 @@ type QueryKeysClient struct { } // NewQueryKeysClient creates a new instance of QueryKeysClient with the specified values. -func NewQueryKeysClient(con *arm.Connection, subscriptionID string) *QueryKeysClient { - return &QueryKeysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewQueryKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *QueryKeysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &QueryKeysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Generates a new query key for the specified search service. You can create up to 50 query keys per service. @@ -88,7 +96,7 @@ func (client *QueryKeysClient) createCreateRequest(ctx context.Context, resource func (client *QueryKeysClient) createHandleResponse(resp *http.Response) (QueryKeysCreateResponse, error) { result := QueryKeysCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.QueryKey); err != nil { - return QueryKeysCreateResponse{}, err + return QueryKeysCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -217,7 +225,7 @@ func (client *QueryKeysClient) listBySearchServiceCreateRequest(ctx context.Cont func (client *QueryKeysClient) listBySearchServiceHandleResponse(resp *http.Response) (QueryKeysListBySearchServiceResponse, error) { result := QueryKeysListBySearchServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListQueryKeysResult); err != nil { - return QueryKeysListBySearchServiceResponse{}, err + return QueryKeysListBySearchServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_response_types.go b/sdk/resourcemanager/search/armsearch/zz_generated_response_types.go index 1520ec008e8f..76c114c8fb13 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_response_types.go +++ b/sdk/resourcemanager/search/armsearch/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armsearch import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // AdminKeysGetResponse contains the response from method AdminKeys.Get. @@ -164,6 +163,8 @@ type ServicesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServicesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServicesCreateOrUpdateResponse, error) { respType := ServicesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SearchService) @@ -268,6 +269,8 @@ type SharedPrivateLinkResourcesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SharedPrivateLinkResourcesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SharedPrivateLinkResourcesCreateOrUpdateResponse, error) { respType := SharedPrivateLinkResourcesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SharedPrivateLinkResource) @@ -318,6 +321,8 @@ type SharedPrivateLinkResourcesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SharedPrivateLinkResourcesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SharedPrivateLinkResourcesDeleteResponse, error) { respType := SharedPrivateLinkResourcesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_services_client.go b/sdk/resourcemanager/search/armsearch/zz_generated_services_client.go index 939dcfe3e56c..8a4b267397ec 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_services_client.go +++ b/sdk/resourcemanager/search/armsearch/zz_generated_services_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServicesClient contains the methods for the Services group. @@ -31,8 +31,15 @@ type ServicesClient struct { } // NewServicesClient creates a new instance of ServicesClient with the specified values. -func NewServicesClient(con *arm.Connection, subscriptionID string) *ServicesClient { - return &ServicesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServicesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServicesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNameAvailability - Checks whether or not the given search service name is available for use. Search service names must be globally unique since @@ -78,7 +85,7 @@ func (client *ServicesClient) checkNameAvailabilityCreateRequest(ctx context.Con func (client *ServicesClient) checkNameAvailabilityHandleResponse(resp *http.Response) (ServicesCheckNameAvailabilityResponse, error) { result := ServicesCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityOutput); err != nil { - return ServicesCheckNameAvailabilityResponse{}, err + return ServicesCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -286,7 +293,7 @@ func (client *ServicesClient) getCreateRequest(ctx context.Context, resourceGrou func (client *ServicesClient) getHandleResponse(resp *http.Response) (ServicesGetResponse, error) { result := ServicesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SearchService); err != nil { - return ServicesGetResponse{}, err + return ServicesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -347,7 +354,7 @@ func (client *ServicesClient) listByResourceGroupCreateRequest(ctx context.Conte func (client *ServicesClient) listByResourceGroupHandleResponse(resp *http.Response) (ServicesListByResourceGroupResponse, error) { result := ServicesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SearchServiceListResult); err != nil { - return ServicesListByResourceGroupResponse{}, err + return ServicesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -404,7 +411,7 @@ func (client *ServicesClient) listBySubscriptionCreateRequest(ctx context.Contex func (client *ServicesClient) listBySubscriptionHandleResponse(resp *http.Response) (ServicesListBySubscriptionResponse, error) { result := ServicesListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SearchServiceListResult); err != nil { - return ServicesListBySubscriptionResponse{}, err + return ServicesListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -472,7 +479,7 @@ func (client *ServicesClient) updateCreateRequest(ctx context.Context, resourceG func (client *ServicesClient) updateHandleResponse(resp *http.Response) (ServicesUpdateResponse, error) { result := ServicesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SearchService); err != nil { - return ServicesUpdateResponse{}, err + return ServicesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/search/armsearch/zz_generated_sharedprivatelinkresources_client.go b/sdk/resourcemanager/search/armsearch/zz_generated_sharedprivatelinkresources_client.go index f24be6af5a24..8341c1fc21a3 100644 --- a/sdk/resourcemanager/search/armsearch/zz_generated_sharedprivatelinkresources_client.go +++ b/sdk/resourcemanager/search/armsearch/zz_generated_sharedprivatelinkresources_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SharedPrivateLinkResourcesClient contains the methods for the SharedPrivateLinkResources group. @@ -31,8 +31,15 @@ type SharedPrivateLinkResourcesClient struct { } // NewSharedPrivateLinkResourcesClient creates a new instance of SharedPrivateLinkResourcesClient with the specified values. -func NewSharedPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *SharedPrivateLinkResourcesClient { - return &SharedPrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSharedPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SharedPrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SharedPrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Initiates the creation or update of a shared private link resource managed by the search service in the given resource group. @@ -255,7 +262,7 @@ func (client *SharedPrivateLinkResourcesClient) getCreateRequest(ctx context.Con func (client *SharedPrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (SharedPrivateLinkResourcesGetResponse, error) { result := SharedPrivateLinkResourcesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SharedPrivateLinkResource); err != nil { - return SharedPrivateLinkResourcesGetResponse{}, err + return SharedPrivateLinkResourcesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -320,7 +327,7 @@ func (client *SharedPrivateLinkResourcesClient) listByServiceCreateRequest(ctx c func (client *SharedPrivateLinkResourcesClient) listByServiceHandleResponse(resp *http.Response) (SharedPrivateLinkResourcesListByServiceResponse, error) { result := SharedPrivateLinkResourcesListByServiceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SharedPrivateLinkResourceListResult); err != nil { - return SharedPrivateLinkResourcesListByServiceResponse{}, err + return SharedPrivateLinkResourcesListByServiceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/CHANGELOG.md b/sdk/resourcemanager/security/armsecurity/CHANGELOG.md index 34f86d5bb408..bd4524485ca1 100644 --- a/sdk/resourcemanager/security/armsecurity/CHANGELOG.md +++ b/sdk/resourcemanager/security/armsecurity/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-15) diff --git a/sdk/resourcemanager/security/armsecurity/README.md b/sdk/resourcemanager/security/armsecurity/README.md index 6049cc131691..48c9f8e68725 100644 --- a/sdk/resourcemanager/security/armsecurity/README.md +++ b/sdk/resourcemanager/security/armsecurity/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Security +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Security modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armsecurity.NewStandardsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Security modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armsecurity.NewStandardsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armsecurity.NewStandardsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/security/armsecurity/autorest.md b/sdk/resourcemanager/security/armsecurity/autorest.md index 88d1ae198fe8..5d4af2a30739 100644 --- a/sdk/resourcemanager/security/armsecurity/autorest.md +++ b/sdk/resourcemanager/security/armsecurity/autorest.md @@ -6,10 +6,10 @@ azure-arm: true tag: package-composite-v3 require: -- https://github.com/Azure/azure-rest-api-specs/blob/bd64220293a403f70ae8beebd56fb86951007acf/specification/security/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/bd64220293a403f70ae8beebd56fb86951007acf/specification/security/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/security/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/security/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.1 +module-version: 0.2.0 modelerfour: lenient-model-deduplication: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/security/armsecurity/go.mod b/sdk/resourcemanager/security/armsecurity/go.mod index 02b99c3eceb5..dc7a16c6c6d7 100644 --- a/sdk/resourcemanager/security/armsecurity/go.mod +++ b/sdk/resourcemanager/security/armsecurity/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/security/armsecurit go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.2.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/security/armsecurity/go.sum b/sdk/resourcemanager/security/armsecurity/go.sum index c8ff7a2143ad..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/security/armsecurity/go.sum +++ b/sdk/resourcemanager/security/armsecurity/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible h1:iCb2tuoEm3N7ZpUDOvu1Yxl1B3iOVDmaD6weaRuIPzs= -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_adaptiveapplicationcontrols_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_adaptiveapplicationcontrols_client.go index a82319bbfdea..b3623c948127 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_adaptiveapplicationcontrols_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_adaptiveapplicationcontrols_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // AdaptiveApplicationControlsClient contains the methods for the AdaptiveApplicationControls group. @@ -32,8 +33,15 @@ type AdaptiveApplicationControlsClient struct { } // NewAdaptiveApplicationControlsClient creates a new instance of AdaptiveApplicationControlsClient with the specified values. -func NewAdaptiveApplicationControlsClient(con *arm.Connection, subscriptionID string, ascLocation string) *AdaptiveApplicationControlsClient { - return &AdaptiveApplicationControlsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID, ascLocation: ascLocation} +func NewAdaptiveApplicationControlsClient(subscriptionID string, ascLocation string, credential azcore.TokenCredential, options *arm.ClientOptions) *AdaptiveApplicationControlsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AdaptiveApplicationControlsClient{subscriptionID: subscriptionID, ascLocation: ascLocation, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Delete - Delete an application control machine group @@ -139,7 +147,7 @@ func (client *AdaptiveApplicationControlsClient) getCreateRequest(ctx context.Co func (client *AdaptiveApplicationControlsClient) getHandleResponse(resp *http.Response) (AdaptiveApplicationControlsGetResponse, error) { result := AdaptiveApplicationControlsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AdaptiveApplicationControlGroup); err != nil { - return AdaptiveApplicationControlsGetResponse{}, err + return AdaptiveApplicationControlsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -202,7 +210,7 @@ func (client *AdaptiveApplicationControlsClient) listCreateRequest(ctx context.C func (client *AdaptiveApplicationControlsClient) listHandleResponse(resp *http.Response) (AdaptiveApplicationControlsListResponse, error) { result := AdaptiveApplicationControlsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AdaptiveApplicationControlGroups); err != nil { - return AdaptiveApplicationControlsListResponse{}, err + return AdaptiveApplicationControlsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -267,7 +275,7 @@ func (client *AdaptiveApplicationControlsClient) putCreateRequest(ctx context.Co func (client *AdaptiveApplicationControlsClient) putHandleResponse(resp *http.Response) (AdaptiveApplicationControlsPutResponse, error) { result := AdaptiveApplicationControlsPutResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AdaptiveApplicationControlGroup); err != nil { - return AdaptiveApplicationControlsPutResponse{}, err + return AdaptiveApplicationControlsPutResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_adaptivenetworkhardenings_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_adaptivenetworkhardenings_client.go index b22f684cb5f4..ee8e0a4eb76c 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_adaptivenetworkhardenings_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_adaptivenetworkhardenings_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AdaptiveNetworkHardeningsClient contains the methods for the AdaptiveNetworkHardenings group. @@ -31,8 +31,15 @@ type AdaptiveNetworkHardeningsClient struct { } // NewAdaptiveNetworkHardeningsClient creates a new instance of AdaptiveNetworkHardeningsClient with the specified values. -func NewAdaptiveNetworkHardeningsClient(con *arm.Connection, subscriptionID string) *AdaptiveNetworkHardeningsClient { - return &AdaptiveNetworkHardeningsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAdaptiveNetworkHardeningsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AdaptiveNetworkHardeningsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AdaptiveNetworkHardeningsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginEnforce - Enforces the given rules on the NSG(s) listed in the request @@ -186,7 +193,7 @@ func (client *AdaptiveNetworkHardeningsClient) getCreateRequest(ctx context.Cont func (client *AdaptiveNetworkHardeningsClient) getHandleResponse(resp *http.Response) (AdaptiveNetworkHardeningsGetResponse, error) { result := AdaptiveNetworkHardeningsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AdaptiveNetworkHardening); err != nil { - return AdaptiveNetworkHardeningsGetResponse{}, err + return AdaptiveNetworkHardeningsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -256,7 +263,7 @@ func (client *AdaptiveNetworkHardeningsClient) listByExtendedResourceCreateReque func (client *AdaptiveNetworkHardeningsClient) listByExtendedResourceHandleResponse(resp *http.Response) (AdaptiveNetworkHardeningsListByExtendedResourceResponse, error) { result := AdaptiveNetworkHardeningsListByExtendedResourceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AdaptiveNetworkHardeningsList); err != nil { - return AdaptiveNetworkHardeningsListByExtendedResourceResponse{}, err + return AdaptiveNetworkHardeningsListByExtendedResourceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_advancedthreatprotection_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_advancedthreatprotection_client.go index aaf349985c4c..ad2354a62f81 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_advancedthreatprotection_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_advancedthreatprotection_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AdvancedThreatProtectionClient contains the methods for the AdvancedThreatProtection group. @@ -29,13 +30,20 @@ type AdvancedThreatProtectionClient struct { } // NewAdvancedThreatProtectionClient creates a new instance of AdvancedThreatProtectionClient with the specified values. -func NewAdvancedThreatProtectionClient(con *arm.Connection) *AdvancedThreatProtectionClient { - return &AdvancedThreatProtectionClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewAdvancedThreatProtectionClient(credential azcore.TokenCredential, options *arm.ClientOptions) *AdvancedThreatProtectionClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AdvancedThreatProtectionClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Creates or updates the Advanced Threat Protection settings on a specified resource. // If the operation fails it returns the *CloudError error type. -func (client *AdvancedThreatProtectionClient) Create(ctx context.Context, resourceID string, settingName Enum6, advancedThreatProtectionSetting AdvancedThreatProtectionSetting, options *AdvancedThreatProtectionCreateOptions) (AdvancedThreatProtectionCreateResponse, error) { +func (client *AdvancedThreatProtectionClient) Create(ctx context.Context, resourceID string, settingName Enum7, advancedThreatProtectionSetting AdvancedThreatProtectionSetting, options *AdvancedThreatProtectionCreateOptions) (AdvancedThreatProtectionCreateResponse, error) { req, err := client.createCreateRequest(ctx, resourceID, settingName, advancedThreatProtectionSetting, options) if err != nil { return AdvancedThreatProtectionCreateResponse{}, err @@ -51,11 +59,8 @@ func (client *AdvancedThreatProtectionClient) Create(ctx context.Context, resour } // createCreateRequest creates the Create request. -func (client *AdvancedThreatProtectionClient) createCreateRequest(ctx context.Context, resourceID string, settingName Enum6, advancedThreatProtectionSetting AdvancedThreatProtectionSetting, options *AdvancedThreatProtectionCreateOptions) (*policy.Request, error) { +func (client *AdvancedThreatProtectionClient) createCreateRequest(ctx context.Context, resourceID string, settingName Enum7, advancedThreatProtectionSetting AdvancedThreatProtectionSetting, options *AdvancedThreatProtectionCreateOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}" - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if settingName == "" { return nil, errors.New("parameter settingName cannot be empty") @@ -76,7 +81,7 @@ func (client *AdvancedThreatProtectionClient) createCreateRequest(ctx context.Co func (client *AdvancedThreatProtectionClient) createHandleResponse(resp *http.Response) (AdvancedThreatProtectionCreateResponse, error) { result := AdvancedThreatProtectionCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AdvancedThreatProtectionSetting); err != nil { - return AdvancedThreatProtectionCreateResponse{}, err + return AdvancedThreatProtectionCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -96,7 +101,7 @@ func (client *AdvancedThreatProtectionClient) createHandleError(resp *http.Respo // Get - Gets the Advanced Threat Protection settings for the specified resource. // If the operation fails it returns the *CloudError error type. -func (client *AdvancedThreatProtectionClient) Get(ctx context.Context, resourceID string, settingName Enum6, options *AdvancedThreatProtectionGetOptions) (AdvancedThreatProtectionGetResponse, error) { +func (client *AdvancedThreatProtectionClient) Get(ctx context.Context, resourceID string, settingName Enum7, options *AdvancedThreatProtectionGetOptions) (AdvancedThreatProtectionGetResponse, error) { req, err := client.getCreateRequest(ctx, resourceID, settingName, options) if err != nil { return AdvancedThreatProtectionGetResponse{}, err @@ -112,11 +117,8 @@ func (client *AdvancedThreatProtectionClient) Get(ctx context.Context, resourceI } // getCreateRequest creates the Get request. -func (client *AdvancedThreatProtectionClient) getCreateRequest(ctx context.Context, resourceID string, settingName Enum6, options *AdvancedThreatProtectionGetOptions) (*policy.Request, error) { +func (client *AdvancedThreatProtectionClient) getCreateRequest(ctx context.Context, resourceID string, settingName Enum7, options *AdvancedThreatProtectionGetOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/advancedThreatProtectionSettings/{settingName}" - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if settingName == "" { return nil, errors.New("parameter settingName cannot be empty") @@ -137,7 +139,7 @@ func (client *AdvancedThreatProtectionClient) getCreateRequest(ctx context.Conte func (client *AdvancedThreatProtectionClient) getHandleResponse(resp *http.Response) (AdvancedThreatProtectionGetResponse, error) { result := AdvancedThreatProtectionGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AdvancedThreatProtectionSetting); err != nil { - return AdvancedThreatProtectionGetResponse{}, err + return AdvancedThreatProtectionGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_alerts_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_alerts_client.go index 3ce0bc1311a9..17f15e2575e8 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_alerts_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_alerts_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AlertsClient contains the methods for the Alerts group. @@ -32,8 +32,15 @@ type AlertsClient struct { } // NewAlertsClient creates a new instance of AlertsClient with the specified values. -func NewAlertsClient(con *arm.Connection, subscriptionID string, ascLocation string) *AlertsClient { - return &AlertsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID, ascLocation: ascLocation} +func NewAlertsClient(subscriptionID string, ascLocation string, credential azcore.TokenCredential, options *arm.ClientOptions) *AlertsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AlertsClient{subscriptionID: subscriptionID, ascLocation: ascLocation, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetResourceGroupLevel - Get an alert that is associated a resource group or a resource in a resource group @@ -87,7 +94,7 @@ func (client *AlertsClient) getResourceGroupLevelCreateRequest(ctx context.Conte func (client *AlertsClient) getResourceGroupLevelHandleResponse(resp *http.Response) (AlertsGetResourceGroupLevelResponse, error) { result := AlertsGetResourceGroupLevelResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Alert); err != nil { - return AlertsGetResourceGroupLevelResponse{}, err + return AlertsGetResourceGroupLevelResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -152,7 +159,7 @@ func (client *AlertsClient) getSubscriptionLevelCreateRequest(ctx context.Contex func (client *AlertsClient) getSubscriptionLevelHandleResponse(resp *http.Response) (AlertsGetSubscriptionLevelResponse, error) { result := AlertsGetSubscriptionLevelResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Alert); err != nil { - return AlertsGetSubscriptionLevelResponse{}, err + return AlertsGetSubscriptionLevelResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -206,7 +213,7 @@ func (client *AlertsClient) listCreateRequest(ctx context.Context, options *Aler func (client *AlertsClient) listHandleResponse(resp *http.Response) (AlertsListResponse, error) { result := AlertsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertList); err != nil { - return AlertsListResponse{}, err + return AlertsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -264,7 +271,7 @@ func (client *AlertsClient) listByResourceGroupCreateRequest(ctx context.Context func (client *AlertsClient) listByResourceGroupHandleResponse(resp *http.Response) (AlertsListByResourceGroupResponse, error) { result := AlertsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertList); err != nil { - return AlertsListByResourceGroupResponse{}, err + return AlertsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -326,7 +333,7 @@ func (client *AlertsClient) listResourceGroupLevelByRegionCreateRequest(ctx cont func (client *AlertsClient) listResourceGroupLevelByRegionHandleResponse(resp *http.Response) (AlertsListResourceGroupLevelByRegionResponse, error) { result := AlertsListResourceGroupLevelByRegionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertList); err != nil { - return AlertsListResourceGroupLevelByRegionResponse{}, err + return AlertsListResourceGroupLevelByRegionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -384,7 +391,7 @@ func (client *AlertsClient) listSubscriptionLevelByRegionCreateRequest(ctx conte func (client *AlertsClient) listSubscriptionLevelByRegionHandleResponse(resp *http.Response) (AlertsListSubscriptionLevelByRegionResponse, error) { result := AlertsListSubscriptionLevelByRegionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertList); err != nil { - return AlertsListSubscriptionLevelByRegionResponse{}, err + return AlertsListSubscriptionLevelByRegionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_alertssuppressionrules_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_alertssuppressionrules_client.go index b2cb14d95a5c..3c5eac21055d 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_alertssuppressionrules_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_alertssuppressionrules_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AlertsSuppressionRulesClient contains the methods for the AlertsSuppressionRules group. @@ -30,8 +31,15 @@ type AlertsSuppressionRulesClient struct { } // NewAlertsSuppressionRulesClient creates a new instance of AlertsSuppressionRulesClient with the specified values. -func NewAlertsSuppressionRulesClient(con *arm.Connection, subscriptionID string) *AlertsSuppressionRulesClient { - return &AlertsSuppressionRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAlertsSuppressionRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AlertsSuppressionRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AlertsSuppressionRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Delete - Delete dismiss alert rule for this subscription. @@ -129,7 +137,7 @@ func (client *AlertsSuppressionRulesClient) getCreateRequest(ctx context.Context func (client *AlertsSuppressionRulesClient) getHandleResponse(resp *http.Response) (AlertsSuppressionRulesGetResponse, error) { result := AlertsSuppressionRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertsSuppressionRule); err != nil { - return AlertsSuppressionRulesGetResponse{}, err + return AlertsSuppressionRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -186,7 +194,7 @@ func (client *AlertsSuppressionRulesClient) listCreateRequest(ctx context.Contex func (client *AlertsSuppressionRulesClient) listHandleResponse(resp *http.Response) (AlertsSuppressionRulesListResponse, error) { result := AlertsSuppressionRulesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertsSuppressionRulesList); err != nil { - return AlertsSuppressionRulesListResponse{}, err + return AlertsSuppressionRulesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -247,7 +255,7 @@ func (client *AlertsSuppressionRulesClient) updateCreateRequest(ctx context.Cont func (client *AlertsSuppressionRulesClient) updateHandleResponse(resp *http.Response) (AlertsSuppressionRulesUpdateResponse, error) { result := AlertsSuppressionRulesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AlertsSuppressionRule); err != nil { - return AlertsSuppressionRulesUpdateResponse{}, err + return AlertsSuppressionRulesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_allowedconnections_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_allowedconnections_client.go index 2d326e8b53bc..a457e31ac495 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_allowedconnections_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_allowedconnections_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AllowedConnectionsClient contains the methods for the AllowedConnections group. @@ -31,8 +32,15 @@ type AllowedConnectionsClient struct { } // NewAllowedConnectionsClient creates a new instance of AllowedConnectionsClient with the specified values. -func NewAllowedConnectionsClient(con *arm.Connection, subscriptionID string, ascLocation string) *AllowedConnectionsClient { - return &AllowedConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID, ascLocation: ascLocation} +func NewAllowedConnectionsClient(subscriptionID string, ascLocation string, credential azcore.TokenCredential, options *arm.ClientOptions) *AllowedConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AllowedConnectionsClient{subscriptionID: subscriptionID, ascLocation: ascLocation, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the list of all possible traffic between resources for the subscription and location, based on connection type. @@ -86,7 +94,7 @@ func (client *AllowedConnectionsClient) getCreateRequest(ctx context.Context, re func (client *AllowedConnectionsClient) getHandleResponse(resp *http.Response) (AllowedConnectionsGetResponse, error) { result := AllowedConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AllowedConnectionsResource); err != nil { - return AllowedConnectionsGetResponse{}, err + return AllowedConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -140,7 +148,7 @@ func (client *AllowedConnectionsClient) listCreateRequest(ctx context.Context, o func (client *AllowedConnectionsClient) listHandleResponse(resp *http.Response) (AllowedConnectionsListResponse, error) { result := AllowedConnectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AllowedConnectionsList); err != nil { - return AllowedConnectionsListResponse{}, err + return AllowedConnectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -198,7 +206,7 @@ func (client *AllowedConnectionsClient) listByHomeRegionCreateRequest(ctx contex func (client *AllowedConnectionsClient) listByHomeRegionHandleResponse(resp *http.Response) (AllowedConnectionsListByHomeRegionResponse, error) { result := AllowedConnectionsListByHomeRegionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AllowedConnectionsList); err != nil { - return AllowedConnectionsListByHomeRegionResponse{}, err + return AllowedConnectionsListByHomeRegionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_assessments_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_assessments_client.go index 14d359dca5da..7ba75222d30a 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_assessments_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_assessments_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AssessmentsClient contains the methods for the Assessments group. @@ -29,8 +30,15 @@ type AssessmentsClient struct { } // NewAssessmentsClient creates a new instance of AssessmentsClient with the specified values. -func NewAssessmentsClient(con *arm.Connection) *AssessmentsClient { - return &AssessmentsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewAssessmentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *AssessmentsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AssessmentsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create a security assessment on your resource. An assessment metadata that describes this assessment must be predefined with the same @@ -54,9 +62,6 @@ func (client *AssessmentsClient) CreateOrUpdate(ctx context.Context, resourceID // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *AssessmentsClient) createOrUpdateCreateRequest(ctx context.Context, resourceID string, assessmentName string, assessment SecurityAssessment, options *AssessmentsCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}" - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if assessmentName == "" { return nil, errors.New("parameter assessmentName cannot be empty") @@ -77,7 +82,7 @@ func (client *AssessmentsClient) createOrUpdateCreateRequest(ctx context.Context func (client *AssessmentsClient) createOrUpdateHandleResponse(resp *http.Response) (AssessmentsCreateOrUpdateResponse, error) { result := AssessmentsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityAssessmentResponse); err != nil { - return AssessmentsCreateOrUpdateResponse{}, err + return AssessmentsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -116,9 +121,6 @@ func (client *AssessmentsClient) Delete(ctx context.Context, resourceID string, // deleteCreateRequest creates the Delete request. func (client *AssessmentsClient) deleteCreateRequest(ctx context.Context, resourceID string, assessmentName string, options *AssessmentsDeleteOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}" - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if assessmentName == "" { return nil, errors.New("parameter assessmentName cannot be empty") @@ -168,9 +170,6 @@ func (client *AssessmentsClient) Get(ctx context.Context, resourceID string, ass // getCreateRequest creates the Get request. func (client *AssessmentsClient) getCreateRequest(ctx context.Context, resourceID string, assessmentName string, options *AssessmentsGetOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/assessments/{assessmentName}" - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if assessmentName == "" { return nil, errors.New("parameter assessmentName cannot be empty") @@ -194,7 +193,7 @@ func (client *AssessmentsClient) getCreateRequest(ctx context.Context, resourceI func (client *AssessmentsClient) getHandleResponse(resp *http.Response) (AssessmentsGetResponse, error) { result := AssessmentsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityAssessmentResponse); err != nil { - return AssessmentsGetResponse{}, err + return AssessmentsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -229,9 +228,6 @@ func (client *AssessmentsClient) List(scope string, options *AssessmentsListOpti // listCreateRequest creates the List request. func (client *AssessmentsClient) listCreateRequest(ctx context.Context, scope string, options *AssessmentsListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/assessments" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -248,7 +244,7 @@ func (client *AssessmentsClient) listCreateRequest(ctx context.Context, scope st func (client *AssessmentsClient) listHandleResponse(resp *http.Response) (AssessmentsListResponse, error) { result := AssessmentsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityAssessmentList); err != nil { - return AssessmentsListResponse{}, err + return AssessmentsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_assessmentsmetadata_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_assessmentsmetadata_client.go index a40398986fc6..251a093d81f8 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_assessmentsmetadata_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_assessmentsmetadata_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AssessmentsMetadataClient contains the methods for the AssessmentsMetadata group. @@ -30,8 +31,15 @@ type AssessmentsMetadataClient struct { } // NewAssessmentsMetadataClient creates a new instance of AssessmentsMetadataClient with the specified values. -func NewAssessmentsMetadataClient(con *arm.Connection, subscriptionID string) *AssessmentsMetadataClient { - return &AssessmentsMetadataClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAssessmentsMetadataClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AssessmentsMetadataClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AssessmentsMetadataClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateInSubscription - Create metadata information on an assessment type in a specific subscription @@ -77,7 +85,7 @@ func (client *AssessmentsMetadataClient) createInSubscriptionCreateRequest(ctx c func (client *AssessmentsMetadataClient) createInSubscriptionHandleResponse(resp *http.Response) (AssessmentsMetadataCreateInSubscriptionResponse, error) { result := AssessmentsMetadataCreateInSubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityAssessmentMetadataResponse); err != nil { - return AssessmentsMetadataCreateInSubscriptionResponse{}, err + return AssessmentsMetadataCreateInSubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -187,7 +195,7 @@ func (client *AssessmentsMetadataClient) getCreateRequest(ctx context.Context, a func (client *AssessmentsMetadataClient) getHandleResponse(resp *http.Response) (AssessmentsMetadataGetResponse, error) { result := AssessmentsMetadataGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityAssessmentMetadataResponse); err != nil { - return AssessmentsMetadataGetResponse{}, err + return AssessmentsMetadataGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -248,7 +256,7 @@ func (client *AssessmentsMetadataClient) getInSubscriptionCreateRequest(ctx cont func (client *AssessmentsMetadataClient) getInSubscriptionHandleResponse(resp *http.Response) (AssessmentsMetadataGetInSubscriptionResponse, error) { result := AssessmentsMetadataGetInSubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityAssessmentMetadataResponse); err != nil { - return AssessmentsMetadataGetInSubscriptionResponse{}, err + return AssessmentsMetadataGetInSubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +306,7 @@ func (client *AssessmentsMetadataClient) listCreateRequest(ctx context.Context, func (client *AssessmentsMetadataClient) listHandleResponse(resp *http.Response) (AssessmentsMetadataListResponse, error) { result := AssessmentsMetadataListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityAssessmentMetadataResponseList); err != nil { - return AssessmentsMetadataListResponse{}, err + return AssessmentsMetadataListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -352,7 +360,7 @@ func (client *AssessmentsMetadataClient) listBySubscriptionCreateRequest(ctx con func (client *AssessmentsMetadataClient) listBySubscriptionHandleResponse(resp *http.Response) (AssessmentsMetadataListBySubscriptionResponse, error) { result := AssessmentsMetadataListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityAssessmentMetadataResponseList); err != nil { - return AssessmentsMetadataListBySubscriptionResponse{}, err + return AssessmentsMetadataListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_automations_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_automations_client.go index e0615bf20399..6ff5001a6045 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_automations_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_automations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AutomationsClient contains the methods for the Automations group. @@ -30,8 +31,15 @@ type AutomationsClient struct { } // NewAutomationsClient creates a new instance of AutomationsClient with the specified values. -func NewAutomationsClient(con *arm.Connection, subscriptionID string) *AutomationsClient { - return &AutomationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAutomationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AutomationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AutomationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a security automation. If a security automation is already created and a subsequent request is issued for the same @@ -82,7 +90,7 @@ func (client *AutomationsClient) createOrUpdateCreateRequest(ctx context.Context func (client *AutomationsClient) createOrUpdateHandleResponse(resp *http.Response) (AutomationsCreateOrUpdateResponse, error) { result := AutomationsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Automation); err != nil { - return AutomationsCreateOrUpdateResponse{}, err + return AutomationsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -203,7 +211,7 @@ func (client *AutomationsClient) getCreateRequest(ctx context.Context, resourceG func (client *AutomationsClient) getHandleResponse(resp *http.Response) (AutomationsGetResponse, error) { result := AutomationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Automation); err != nil { - return AutomationsGetResponse{}, err + return AutomationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -258,7 +266,7 @@ func (client *AutomationsClient) listCreateRequest(ctx context.Context, options func (client *AutomationsClient) listHandleResponse(resp *http.Response) (AutomationsListResponse, error) { result := AutomationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AutomationList); err != nil { - return AutomationsListResponse{}, err + return AutomationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -317,7 +325,7 @@ func (client *AutomationsClient) listByResourceGroupCreateRequest(ctx context.Co func (client *AutomationsClient) listByResourceGroupHandleResponse(resp *http.Response) (AutomationsListByResourceGroupResponse, error) { result := AutomationsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AutomationList); err != nil { - return AutomationsListByResourceGroupResponse{}, err + return AutomationsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -382,7 +390,7 @@ func (client *AutomationsClient) validateCreateRequest(ctx context.Context, reso func (client *AutomationsClient) validateHandleResponse(resp *http.Response) (AutomationsValidateResponse, error) { result := AutomationsValidateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AutomationValidationStatus); err != nil { - return AutomationsValidateResponse{}, err + return AutomationsValidateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_autoprovisioningsettings_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_autoprovisioningsettings_client.go index 2fd35a4a82c9..a7175aeaf65d 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_autoprovisioningsettings_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_autoprovisioningsettings_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AutoProvisioningSettingsClient contains the methods for the AutoProvisioningSettings group. @@ -30,8 +31,15 @@ type AutoProvisioningSettingsClient struct { } // NewAutoProvisioningSettingsClient creates a new instance of AutoProvisioningSettingsClient with the specified values. -func NewAutoProvisioningSettingsClient(con *arm.Connection, subscriptionID string) *AutoProvisioningSettingsClient { - return &AutoProvisioningSettingsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAutoProvisioningSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AutoProvisioningSettingsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AutoProvisioningSettingsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Details of a specific setting @@ -77,7 +85,7 @@ func (client *AutoProvisioningSettingsClient) createCreateRequest(ctx context.Co func (client *AutoProvisioningSettingsClient) createHandleResponse(resp *http.Response) (AutoProvisioningSettingsCreateResponse, error) { result := AutoProvisioningSettingsCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AutoProvisioningSetting); err != nil { - return AutoProvisioningSettingsCreateResponse{}, err + return AutoProvisioningSettingsCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -138,7 +146,7 @@ func (client *AutoProvisioningSettingsClient) getCreateRequest(ctx context.Conte func (client *AutoProvisioningSettingsClient) getHandleResponse(resp *http.Response) (AutoProvisioningSettingsGetResponse, error) { result := AutoProvisioningSettingsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AutoProvisioningSetting); err != nil { - return AutoProvisioningSettingsGetResponse{}, err + return AutoProvisioningSettingsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -192,7 +200,7 @@ func (client *AutoProvisioningSettingsClient) listCreateRequest(ctx context.Cont func (client *AutoProvisioningSettingsClient) listHandleResponse(resp *http.Response) (AutoProvisioningSettingsListResponse, error) { result := AutoProvisioningSettingsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AutoProvisioningSettingList); err != nil { - return AutoProvisioningSettingsListResponse{}, err + return AutoProvisioningSettingsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_complianceresults_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_complianceresults_client.go index f2342f4d780d..ca049c0f37ca 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_complianceresults_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_complianceresults_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ComplianceResultsClient contains the methods for the ComplianceResults group. @@ -29,8 +30,15 @@ type ComplianceResultsClient struct { } // NewComplianceResultsClient creates a new instance of ComplianceResultsClient with the specified values. -func NewComplianceResultsClient(con *arm.Connection) *ComplianceResultsClient { - return &ComplianceResultsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewComplianceResultsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *ComplianceResultsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ComplianceResultsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Security Compliance Result @@ -53,9 +61,6 @@ func (client *ComplianceResultsClient) Get(ctx context.Context, resourceID strin // getCreateRequest creates the Get request. func (client *ComplianceResultsClient) getCreateRequest(ctx context.Context, resourceID string, complianceResultName string, options *ComplianceResultsGetOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/complianceResults/{complianceResultName}" - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if complianceResultName == "" { return nil, errors.New("parameter complianceResultName cannot be empty") @@ -76,7 +81,7 @@ func (client *ComplianceResultsClient) getCreateRequest(ctx context.Context, res func (client *ComplianceResultsClient) getHandleResponse(resp *http.Response) (ComplianceResultsGetResponse, error) { result := ComplianceResultsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ComplianceResult); err != nil { - return ComplianceResultsGetResponse{}, err + return ComplianceResultsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -111,9 +116,6 @@ func (client *ComplianceResultsClient) List(scope string, options *ComplianceRes // listCreateRequest creates the List request. func (client *ComplianceResultsClient) listCreateRequest(ctx context.Context, scope string, options *ComplianceResultsListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/complianceResults" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -130,7 +132,7 @@ func (client *ComplianceResultsClient) listCreateRequest(ctx context.Context, sc func (client *ComplianceResultsClient) listHandleResponse(resp *http.Response) (ComplianceResultsListResponse, error) { result := ComplianceResultsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ComplianceResultList); err != nil { - return ComplianceResultsListResponse{}, err + return ComplianceResultsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_compliances_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_compliances_client.go index 8edd1dc5c099..311227ba2432 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_compliances_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_compliances_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CompliancesClient contains the methods for the Compliances group. @@ -29,8 +30,15 @@ type CompliancesClient struct { } // NewCompliancesClient creates a new instance of CompliancesClient with the specified values. -func NewCompliancesClient(con *arm.Connection) *CompliancesClient { - return &CompliancesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewCompliancesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *CompliancesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CompliancesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Details of a specific Compliance. @@ -53,9 +61,6 @@ func (client *CompliancesClient) Get(ctx context.Context, scope string, complian // getCreateRequest creates the Get request. func (client *CompliancesClient) getCreateRequest(ctx context.Context, scope string, complianceName string, options *CompliancesGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/compliances/{complianceName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if complianceName == "" { return nil, errors.New("parameter complianceName cannot be empty") @@ -76,7 +81,7 @@ func (client *CompliancesClient) getCreateRequest(ctx context.Context, scope str func (client *CompliancesClient) getHandleResponse(resp *http.Response) (CompliancesGetResponse, error) { result := CompliancesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Compliance); err != nil { - return CompliancesGetResponse{}, err + return CompliancesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -111,9 +116,6 @@ func (client *CompliancesClient) List(scope string, options *CompliancesListOpti // listCreateRequest creates the List request. func (client *CompliancesClient) listCreateRequest(ctx context.Context, scope string, options *CompliancesListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/compliances" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -130,7 +132,7 @@ func (client *CompliancesClient) listCreateRequest(ctx context.Context, scope st func (client *CompliancesClient) listHandleResponse(resp *http.Response) (CompliancesListResponse, error) { result := CompliancesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ComplianceList); err != nil { - return CompliancesListResponse{}, err + return CompliancesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_connectors_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_connectors_client.go index e33d6e54759b..77abdaf1a627 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_connectors_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_connectors_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ConnectorsClient contains the methods for the Connectors group. @@ -30,8 +31,15 @@ type ConnectorsClient struct { } // NewConnectorsClient creates a new instance of ConnectorsClient with the specified values. -func NewConnectorsClient(con *arm.Connection, subscriptionID string) *ConnectorsClient { - return &ConnectorsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewConnectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ConnectorsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ConnectorsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create a cloud account connector or update an existing one. Connect to your cloud account. For AWS, use either account credentials or @@ -79,7 +87,7 @@ func (client *ConnectorsClient) createOrUpdateCreateRequest(ctx context.Context, func (client *ConnectorsClient) createOrUpdateHandleResponse(resp *http.Response) (ConnectorsCreateOrUpdateResponse, error) { result := ConnectorsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConnectorSetting); err != nil { - return ConnectorsCreateOrUpdateResponse{}, err + return ConnectorsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -192,7 +200,7 @@ func (client *ConnectorsClient) getCreateRequest(ctx context.Context, connectorN func (client *ConnectorsClient) getHandleResponse(resp *http.Response) (ConnectorsGetResponse, error) { result := ConnectorsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConnectorSetting); err != nil { - return ConnectorsGetResponse{}, err + return ConnectorsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -246,7 +254,7 @@ func (client *ConnectorsClient) listCreateRequest(ctx context.Context, options * func (client *ConnectorsClient) listHandleResponse(resp *http.Response) (ConnectorsListResponse, error) { result := ConnectorsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConnectorSettingList); err != nil { - return ConnectorsListResponse{}, err + return ConnectorsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_constants.go b/sdk/resourcemanager/security/armsecurity/zz_generated_constants.go index 0c6b97ef99bd..6896aaafc468 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_constants.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_constants.go @@ -10,7 +10,7 @@ package armsecurity const ( module = "armsecurity" - version = "v0.1.1" + version = "v0.2.0" ) // AADConnectivityState - The connectivity state of the external AAD solution @@ -446,6 +446,29 @@ func (c Categories) ToPtr() *Categories { return &c } +// CloudName - The multi cloud resource's cloud name. +type CloudName string + +const ( + CloudNameAWS CloudName = "AWS" + CloudNameAzure CloudName = "Azure" + CloudNameGCP CloudName = "GCP" +) + +// PossibleCloudNameValues returns the possible values for the CloudName const type. +func PossibleCloudNameValues() []CloudName { + return []CloudName{ + CloudNameAWS, + CloudNameAzure, + CloudNameGCP, + } +} + +// ToPtr returns a *CloudName pointing to the current value. +func (c CloudName) ToPtr() *CloudName { + return &c +} + // ConfigurationStatus - The configuration status of the machines group or machine or rule type ConfigurationStatus string @@ -754,21 +777,21 @@ func (c Enum58) ToPtr() *Enum58 { return &c } -type Enum6 string +type Enum7 string const ( - Enum6Current Enum6 = "current" + Enum7Current Enum7 = "current" ) -// PossibleEnum6Values returns the possible values for the Enum6 const type. -func PossibleEnum6Values() []Enum6 { - return []Enum6{ - Enum6Current, +// PossibleEnum7Values returns the possible values for the Enum7 const type. +func PossibleEnum7Values() []Enum7 { + return []Enum7{ + Enum7Current, } } -// ToPtr returns a *Enum6 pointing to the current value. -func (c Enum6) ToPtr() *Enum6 { +// ToPtr returns a *Enum7 pointing to the current value. +func (c Enum7) ToPtr() *Enum7 { return &c } @@ -802,6 +825,7 @@ type EventSource string const ( EventSourceAlerts EventSource = "Alerts" EventSourceAssessments EventSource = "Assessments" + EventSourceAssessmentsSnapshot EventSource = "AssessmentsSnapshot" EventSourceRegulatoryComplianceAssessment EventSource = "RegulatoryComplianceAssessment" EventSourceRegulatoryComplianceAssessmentSnapshot EventSource = "RegulatoryComplianceAssessmentSnapshot" EventSourceSecureScoreControls EventSource = "SecureScoreControls" @@ -809,6 +833,7 @@ const ( EventSourceSecureScores EventSource = "SecureScores" EventSourceSecureScoresSnapshot EventSource = "SecureScoresSnapshot" EventSourceSubAssessments EventSource = "SubAssessments" + EventSourceSubAssessmentsSnapshot EventSource = "SubAssessmentsSnapshot" ) // PossibleEventSourceValues returns the possible values for the EventSource const type. @@ -816,6 +841,7 @@ func PossibleEventSourceValues() []EventSource { return []EventSource{ EventSourceAlerts, EventSourceAssessments, + EventSourceAssessmentsSnapshot, EventSourceRegulatoryComplianceAssessment, EventSourceRegulatoryComplianceAssessmentSnapshot, EventSourceSecureScoreControls, @@ -823,6 +849,7 @@ func PossibleEventSourceValues() []EventSource { EventSourceSecureScores, EventSourceSecureScoresSnapshot, EventSourceSubAssessments, + EventSourceSubAssessmentsSnapshot, } } @@ -1111,6 +1138,29 @@ func (c Kind) ToPtr() *Kind { return &c } +// OfferingType - The type of the security offering. +type OfferingType string + +const ( + OfferingTypeCspmMonitorAws OfferingType = "CspmMonitorAws" + OfferingTypeDefenderForContainersAws OfferingType = "DefenderForContainersAws" + OfferingTypeDefenderForServersAws OfferingType = "DefenderForServersAws" +) + +// PossibleOfferingTypeValues returns the possible values for the OfferingType const type. +func PossibleOfferingTypeValues() []OfferingType { + return []OfferingType{ + OfferingTypeCspmMonitorAws, + OfferingTypeDefenderForContainersAws, + OfferingTypeDefenderForServersAws, + } +} + +// ToPtr returns a *OfferingType pointing to the current value. +func (c OfferingType) ToPtr() *OfferingType { + return &c +} + // Operator - A valid comparer operator to use. A case-insensitive comparison will be applied for String PropertyType. type Operator string @@ -1155,6 +1205,27 @@ func (c Operator) ToPtr() *Operator { return &c } +// OrganizationMembershipType - The multi cloud account's membership type in the organization +type OrganizationMembershipType string + +const ( + OrganizationMembershipTypeMember OrganizationMembershipType = "Member" + OrganizationMembershipTypeOrganization OrganizationMembershipType = "Organization" +) + +// PossibleOrganizationMembershipTypeValues returns the possible values for the OrganizationMembershipType const type. +func PossibleOrganizationMembershipTypeValues() []OrganizationMembershipType { + return []OrganizationMembershipType{ + OrganizationMembershipTypeMember, + OrganizationMembershipTypeOrganization, + } +} + +// ToPtr returns a *OrganizationMembershipType pointing to the current value. +func (c OrganizationMembershipType) ToPtr() *OrganizationMembershipType { + return &c +} + // PermissionProperty - A permission detected in the cloud account. type PermissionProperty string diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_customassessmentautomations_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_customassessmentautomations_client.go index 798225c7af60..4f248600dbc0 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_customassessmentautomations_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_customassessmentautomations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CustomAssessmentAutomationsClient contains the methods for the CustomAssessmentAutomations group. @@ -30,14 +31,21 @@ type CustomAssessmentAutomationsClient struct { } // NewCustomAssessmentAutomationsClient creates a new instance of CustomAssessmentAutomationsClient with the specified values. -func NewCustomAssessmentAutomationsClient(con *arm.Connection, subscriptionID string) *CustomAssessmentAutomationsClient { - return &CustomAssessmentAutomationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCustomAssessmentAutomationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CustomAssessmentAutomationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CustomAssessmentAutomationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Creates or updates a custom assessment automation for the provided subscription. Please note that providing an existing custom assessment automation // will replace the existing record. // If the operation fails it returns the *CloudError error type. -func (client *CustomAssessmentAutomationsClient) Create(ctx context.Context, resourceGroupName string, customAssessmentAutomationName string, customAssessmentAutomationBody CustomAssessmentAutomation, options *CustomAssessmentAutomationsCreateOptions) (CustomAssessmentAutomationsCreateResponse, error) { +func (client *CustomAssessmentAutomationsClient) Create(ctx context.Context, resourceGroupName string, customAssessmentAutomationName string, customAssessmentAutomationBody CustomAssessmentAutomationRequest, options *CustomAssessmentAutomationsCreateOptions) (CustomAssessmentAutomationsCreateResponse, error) { req, err := client.createCreateRequest(ctx, resourceGroupName, customAssessmentAutomationName, customAssessmentAutomationBody, options) if err != nil { return CustomAssessmentAutomationsCreateResponse{}, err @@ -53,7 +61,7 @@ func (client *CustomAssessmentAutomationsClient) Create(ctx context.Context, res } // createCreateRequest creates the Create request. -func (client *CustomAssessmentAutomationsClient) createCreateRequest(ctx context.Context, resourceGroupName string, customAssessmentAutomationName string, customAssessmentAutomationBody CustomAssessmentAutomation, options *CustomAssessmentAutomationsCreateOptions) (*policy.Request, error) { +func (client *CustomAssessmentAutomationsClient) createCreateRequest(ctx context.Context, resourceGroupName string, customAssessmentAutomationName string, customAssessmentAutomationBody CustomAssessmentAutomationRequest, options *CustomAssessmentAutomationsCreateOptions) (*policy.Request, error) { urlPath := "/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/Microsoft.Security/customAssessmentAutomations/{customAssessmentAutomationName}" if client.subscriptionID == "" { return nil, errors.New("parameter client.subscriptionID cannot be empty") @@ -82,7 +90,7 @@ func (client *CustomAssessmentAutomationsClient) createCreateRequest(ctx context func (client *CustomAssessmentAutomationsClient) createHandleResponse(resp *http.Response) (CustomAssessmentAutomationsCreateResponse, error) { result := CustomAssessmentAutomationsCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CustomAssessmentAutomation); err != nil { - return CustomAssessmentAutomationsCreateResponse{}, err + return CustomAssessmentAutomationsCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -203,7 +211,7 @@ func (client *CustomAssessmentAutomationsClient) getCreateRequest(ctx context.Co func (client *CustomAssessmentAutomationsClient) getHandleResponse(resp *http.Response) (CustomAssessmentAutomationsGetResponse, error) { result := CustomAssessmentAutomationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CustomAssessmentAutomation); err != nil { - return CustomAssessmentAutomationsGetResponse{}, err + return CustomAssessmentAutomationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -261,7 +269,7 @@ func (client *CustomAssessmentAutomationsClient) listByResourceGroupCreateReques func (client *CustomAssessmentAutomationsClient) listByResourceGroupHandleResponse(resp *http.Response) (CustomAssessmentAutomationsListByResourceGroupResponse, error) { result := CustomAssessmentAutomationsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CustomAssessmentAutomationsListResult); err != nil { - return CustomAssessmentAutomationsListByResourceGroupResponse{}, err + return CustomAssessmentAutomationsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -315,7 +323,7 @@ func (client *CustomAssessmentAutomationsClient) listBySubscriptionCreateRequest func (client *CustomAssessmentAutomationsClient) listBySubscriptionHandleResponse(resp *http.Response) (CustomAssessmentAutomationsListBySubscriptionResponse, error) { result := CustomAssessmentAutomationsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CustomAssessmentAutomationsListResult); err != nil { - return CustomAssessmentAutomationsListBySubscriptionResponse{}, err + return CustomAssessmentAutomationsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_customentitystoreassignments_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_customentitystoreassignments_client.go index c1354574e83d..9b5f8396f29a 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_customentitystoreassignments_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_customentitystoreassignments_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CustomEntityStoreAssignmentsClient contains the methods for the CustomEntityStoreAssignments group. @@ -30,8 +31,15 @@ type CustomEntityStoreAssignmentsClient struct { } // NewCustomEntityStoreAssignmentsClient creates a new instance of CustomEntityStoreAssignmentsClient with the specified values. -func NewCustomEntityStoreAssignmentsClient(con *arm.Connection, subscriptionID string) *CustomEntityStoreAssignmentsClient { - return &CustomEntityStoreAssignmentsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCustomEntityStoreAssignmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CustomEntityStoreAssignmentsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CustomEntityStoreAssignmentsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Creates a custom entity store assignment for the provided subscription, if not already exists. @@ -81,7 +89,7 @@ func (client *CustomEntityStoreAssignmentsClient) createCreateRequest(ctx contex func (client *CustomEntityStoreAssignmentsClient) createHandleResponse(resp *http.Response) (CustomEntityStoreAssignmentsCreateResponse, error) { result := CustomEntityStoreAssignmentsCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CustomEntityStoreAssignment); err != nil { - return CustomEntityStoreAssignmentsCreateResponse{}, err + return CustomEntityStoreAssignmentsCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -202,7 +210,7 @@ func (client *CustomEntityStoreAssignmentsClient) getCreateRequest(ctx context.C func (client *CustomEntityStoreAssignmentsClient) getHandleResponse(resp *http.Response) (CustomEntityStoreAssignmentsGetResponse, error) { result := CustomEntityStoreAssignmentsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CustomEntityStoreAssignment); err != nil { - return CustomEntityStoreAssignmentsGetResponse{}, err + return CustomEntityStoreAssignmentsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -260,7 +268,7 @@ func (client *CustomEntityStoreAssignmentsClient) listByResourceGroupCreateReque func (client *CustomEntityStoreAssignmentsClient) listByResourceGroupHandleResponse(resp *http.Response) (CustomEntityStoreAssignmentsListByResourceGroupResponse, error) { result := CustomEntityStoreAssignmentsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CustomEntityStoreAssignmentsListResult); err != nil { - return CustomEntityStoreAssignmentsListByResourceGroupResponse{}, err + return CustomEntityStoreAssignmentsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -314,7 +322,7 @@ func (client *CustomEntityStoreAssignmentsClient) listBySubscriptionCreateReques func (client *CustomEntityStoreAssignmentsClient) listBySubscriptionHandleResponse(resp *http.Response) (CustomEntityStoreAssignmentsListBySubscriptionResponse, error) { result := CustomEntityStoreAssignmentsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CustomEntityStoreAssignmentsListResult); err != nil { - return CustomEntityStoreAssignmentsListBySubscriptionResponse{}, err + return CustomEntityStoreAssignmentsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_date_type.go b/sdk/resourcemanager/security/armsecurity/zz_generated_date_type.go index d2ba0f4ba6d0..3d2b53d2318d 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_date_type.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_date_type.go @@ -9,7 +9,11 @@ package armsecurity import ( + "encoding/json" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" + "strings" "time" ) @@ -29,3 +33,27 @@ func (d *dateType) UnmarshalJSON(data []byte) (err error) { *d = (dateType)(t) return err } + +func populateDateType(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*dateType)(t) +} + +func unpopulateDateType(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux dateType + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_devicesecuritygroups_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_devicesecuritygroups_client.go index 82c372ace0e9..56f48d268124 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_devicesecuritygroups_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_devicesecuritygroups_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DeviceSecurityGroupsClient contains the methods for the DeviceSecurityGroups group. @@ -29,8 +30,15 @@ type DeviceSecurityGroupsClient struct { } // NewDeviceSecurityGroupsClient creates a new instance of DeviceSecurityGroupsClient with the specified values. -func NewDeviceSecurityGroupsClient(con *arm.Connection) *DeviceSecurityGroupsClient { - return &DeviceSecurityGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewDeviceSecurityGroupsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *DeviceSecurityGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DeviceSecurityGroupsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Use this method to creates or updates the device security group on a specified IoT Hub resource. @@ -53,9 +61,6 @@ func (client *DeviceSecurityGroupsClient) CreateOrUpdate(ctx context.Context, re // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *DeviceSecurityGroupsClient) createOrUpdateCreateRequest(ctx context.Context, resourceID string, deviceSecurityGroupName string, deviceSecurityGroup DeviceSecurityGroup, options *DeviceSecurityGroupsCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}" - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if deviceSecurityGroupName == "" { return nil, errors.New("parameter deviceSecurityGroupName cannot be empty") @@ -76,7 +81,7 @@ func (client *DeviceSecurityGroupsClient) createOrUpdateCreateRequest(ctx contex func (client *DeviceSecurityGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (DeviceSecurityGroupsCreateOrUpdateResponse, error) { result := DeviceSecurityGroupsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeviceSecurityGroup); err != nil { - return DeviceSecurityGroupsCreateOrUpdateResponse{}, err + return DeviceSecurityGroupsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -114,9 +119,6 @@ func (client *DeviceSecurityGroupsClient) Delete(ctx context.Context, resourceID // deleteCreateRequest creates the Delete request. func (client *DeviceSecurityGroupsClient) deleteCreateRequest(ctx context.Context, resourceID string, deviceSecurityGroupName string, options *DeviceSecurityGroupsDeleteOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}" - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if deviceSecurityGroupName == "" { return nil, errors.New("parameter deviceSecurityGroupName cannot be empty") @@ -166,9 +168,6 @@ func (client *DeviceSecurityGroupsClient) Get(ctx context.Context, resourceID st // getCreateRequest creates the Get request. func (client *DeviceSecurityGroupsClient) getCreateRequest(ctx context.Context, resourceID string, deviceSecurityGroupName string, options *DeviceSecurityGroupsGetOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups/{deviceSecurityGroupName}" - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) if deviceSecurityGroupName == "" { return nil, errors.New("parameter deviceSecurityGroupName cannot be empty") @@ -189,7 +188,7 @@ func (client *DeviceSecurityGroupsClient) getCreateRequest(ctx context.Context, func (client *DeviceSecurityGroupsClient) getHandleResponse(resp *http.Response) (DeviceSecurityGroupsGetResponse, error) { result := DeviceSecurityGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeviceSecurityGroup); err != nil { - return DeviceSecurityGroupsGetResponse{}, err + return DeviceSecurityGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -224,9 +223,6 @@ func (client *DeviceSecurityGroupsClient) List(resourceID string, options *Devic // listCreateRequest creates the List request. func (client *DeviceSecurityGroupsClient) listCreateRequest(ctx context.Context, resourceID string, options *DeviceSecurityGroupsListOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/deviceSecurityGroups" - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -243,7 +239,7 @@ func (client *DeviceSecurityGroupsClient) listCreateRequest(ctx context.Context, func (client *DeviceSecurityGroupsClient) listHandleResponse(resp *http.Response) (DeviceSecurityGroupsListResponse, error) { result := DeviceSecurityGroupsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeviceSecurityGroupList); err != nil { - return DeviceSecurityGroupsListResponse{}, err + return DeviceSecurityGroupsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_discoveredsecuritysolutions_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_discoveredsecuritysolutions_client.go index 77bcf0dfc2c9..deb54cf490e3 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_discoveredsecuritysolutions_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_discoveredsecuritysolutions_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DiscoveredSecuritySolutionsClient contains the methods for the DiscoveredSecuritySolutions group. @@ -31,8 +32,15 @@ type DiscoveredSecuritySolutionsClient struct { } // NewDiscoveredSecuritySolutionsClient creates a new instance of DiscoveredSecuritySolutionsClient with the specified values. -func NewDiscoveredSecuritySolutionsClient(con *arm.Connection, subscriptionID string, ascLocation string) *DiscoveredSecuritySolutionsClient { - return &DiscoveredSecuritySolutionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID, ascLocation: ascLocation} +func NewDiscoveredSecuritySolutionsClient(subscriptionID string, ascLocation string, credential azcore.TokenCredential, options *arm.ClientOptions) *DiscoveredSecuritySolutionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DiscoveredSecuritySolutionsClient{subscriptionID: subscriptionID, ascLocation: ascLocation, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a specific discovered Security Solution. @@ -86,7 +94,7 @@ func (client *DiscoveredSecuritySolutionsClient) getCreateRequest(ctx context.Co func (client *DiscoveredSecuritySolutionsClient) getHandleResponse(resp *http.Response) (DiscoveredSecuritySolutionsGetResponse, error) { result := DiscoveredSecuritySolutionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiscoveredSecuritySolution); err != nil { - return DiscoveredSecuritySolutionsGetResponse{}, err + return DiscoveredSecuritySolutionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -140,7 +148,7 @@ func (client *DiscoveredSecuritySolutionsClient) listCreateRequest(ctx context.C func (client *DiscoveredSecuritySolutionsClient) listHandleResponse(resp *http.Response) (DiscoveredSecuritySolutionsListResponse, error) { result := DiscoveredSecuritySolutionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiscoveredSecuritySolutionList); err != nil { - return DiscoveredSecuritySolutionsListResponse{}, err + return DiscoveredSecuritySolutionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -198,7 +206,7 @@ func (client *DiscoveredSecuritySolutionsClient) listByHomeRegionCreateRequest(c func (client *DiscoveredSecuritySolutionsClient) listByHomeRegionHandleResponse(resp *http.Response) (DiscoveredSecuritySolutionsListByHomeRegionResponse, error) { result := DiscoveredSecuritySolutionsListByHomeRegionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiscoveredSecuritySolutionList); err != nil { - return DiscoveredSecuritySolutionsListByHomeRegionResponse{}, err + return DiscoveredSecuritySolutionsListByHomeRegionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_externalsecuritysolutions_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_externalsecuritysolutions_client.go index 14df43877ea7..e631db6b3b9c 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_externalsecuritysolutions_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_externalsecuritysolutions_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ExternalSecuritySolutionsClient contains the methods for the ExternalSecuritySolutions group. @@ -31,8 +32,15 @@ type ExternalSecuritySolutionsClient struct { } // NewExternalSecuritySolutionsClient creates a new instance of ExternalSecuritySolutionsClient with the specified values. -func NewExternalSecuritySolutionsClient(con *arm.Connection, subscriptionID string, ascLocation string) *ExternalSecuritySolutionsClient { - return &ExternalSecuritySolutionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID, ascLocation: ascLocation} +func NewExternalSecuritySolutionsClient(subscriptionID string, ascLocation string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExternalSecuritySolutionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ExternalSecuritySolutionsClient{subscriptionID: subscriptionID, ascLocation: ascLocation, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a specific external Security Solution. @@ -86,7 +94,7 @@ func (client *ExternalSecuritySolutionsClient) getCreateRequest(ctx context.Cont func (client *ExternalSecuritySolutionsClient) getHandleResponse(resp *http.Response) (ExternalSecuritySolutionsGetResponse, error) { result := ExternalSecuritySolutionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExternalSecuritySolution); err != nil { - return ExternalSecuritySolutionsGetResponse{}, err + return ExternalSecuritySolutionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -140,7 +148,7 @@ func (client *ExternalSecuritySolutionsClient) listCreateRequest(ctx context.Con func (client *ExternalSecuritySolutionsClient) listHandleResponse(resp *http.Response) (ExternalSecuritySolutionsListResponse, error) { result := ExternalSecuritySolutionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExternalSecuritySolutionList); err != nil { - return ExternalSecuritySolutionsListResponse{}, err + return ExternalSecuritySolutionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -198,7 +206,7 @@ func (client *ExternalSecuritySolutionsClient) listByHomeRegionCreateRequest(ctx func (client *ExternalSecuritySolutionsClient) listByHomeRegionHandleResponse(resp *http.Response) (ExternalSecuritySolutionsListByHomeRegionResponse, error) { result := ExternalSecuritySolutionsListByHomeRegionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExternalSecuritySolutionList); err != nil { - return ExternalSecuritySolutionsListByHomeRegionResponse{}, err + return ExternalSecuritySolutionsListByHomeRegionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_informationprotectionpolicies_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_informationprotectionpolicies_client.go index 2c620c7b4a53..5b7bd2cbb564 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_informationprotectionpolicies_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_informationprotectionpolicies_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // InformationProtectionPoliciesClient contains the methods for the InformationProtectionPolicies group. @@ -29,8 +30,15 @@ type InformationProtectionPoliciesClient struct { } // NewInformationProtectionPoliciesClient creates a new instance of InformationProtectionPoliciesClient with the specified values. -func NewInformationProtectionPoliciesClient(con *arm.Connection) *InformationProtectionPoliciesClient { - return &InformationProtectionPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewInformationProtectionPoliciesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *InformationProtectionPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &InformationProtectionPoliciesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Details of the information protection policy. @@ -53,9 +61,6 @@ func (client *InformationProtectionPoliciesClient) CreateOrUpdate(ctx context.Co // createOrUpdateCreateRequest creates the CreateOrUpdate request. func (client *InformationProtectionPoliciesClient) createOrUpdateCreateRequest(ctx context.Context, scope string, informationProtectionPolicyName Enum20, informationProtectionPolicy InformationProtectionPolicy, options *InformationProtectionPoliciesCreateOrUpdateOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if informationProtectionPolicyName == "" { return nil, errors.New("parameter informationProtectionPolicyName cannot be empty") @@ -76,7 +81,7 @@ func (client *InformationProtectionPoliciesClient) createOrUpdateCreateRequest(c func (client *InformationProtectionPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (InformationProtectionPoliciesCreateOrUpdateResponse, error) { result := InformationProtectionPoliciesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.InformationProtectionPolicy); err != nil { - return InformationProtectionPoliciesCreateOrUpdateResponse{}, err + return InformationProtectionPoliciesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -114,9 +119,6 @@ func (client *InformationProtectionPoliciesClient) Get(ctx context.Context, scop // getCreateRequest creates the Get request. func (client *InformationProtectionPoliciesClient) getCreateRequest(ctx context.Context, scope string, informationProtectionPolicyName Enum20, options *InformationProtectionPoliciesGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/informationProtectionPolicies/{informationProtectionPolicyName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if informationProtectionPolicyName == "" { return nil, errors.New("parameter informationProtectionPolicyName cannot be empty") @@ -137,7 +139,7 @@ func (client *InformationProtectionPoliciesClient) getCreateRequest(ctx context. func (client *InformationProtectionPoliciesClient) getHandleResponse(resp *http.Response) (InformationProtectionPoliciesGetResponse, error) { result := InformationProtectionPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.InformationProtectionPolicy); err != nil { - return InformationProtectionPoliciesGetResponse{}, err + return InformationProtectionPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -172,9 +174,6 @@ func (client *InformationProtectionPoliciesClient) List(scope string, options *I // listCreateRequest creates the List request. func (client *InformationProtectionPoliciesClient) listCreateRequest(ctx context.Context, scope string, options *InformationProtectionPoliciesListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/informationProtectionPolicies" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -191,7 +190,7 @@ func (client *InformationProtectionPoliciesClient) listCreateRequest(ctx context func (client *InformationProtectionPoliciesClient) listHandleResponse(resp *http.Response) (InformationProtectionPoliciesListResponse, error) { result := InformationProtectionPoliciesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.InformationProtectionPolicyList); err != nil { - return InformationProtectionPoliciesListResponse{}, err + return InformationProtectionPoliciesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_ingestionsettings_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_ingestionsettings_client.go index ed1b9cf48fda..d35f909f69ee 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_ingestionsettings_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_ingestionsettings_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // IngestionSettingsClient contains the methods for the IngestionSettings group. @@ -30,8 +31,15 @@ type IngestionSettingsClient struct { } // NewIngestionSettingsClient creates a new instance of IngestionSettingsClient with the specified values. -func NewIngestionSettingsClient(con *arm.Connection, subscriptionID string) *IngestionSettingsClient { - return &IngestionSettingsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIngestionSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IngestionSettingsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IngestionSettingsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Create setting for ingesting security data and logs to correlate with resources associated with the subscription. @@ -77,7 +85,7 @@ func (client *IngestionSettingsClient) createCreateRequest(ctx context.Context, func (client *IngestionSettingsClient) createHandleResponse(resp *http.Response) (IngestionSettingsCreateResponse, error) { result := IngestionSettingsCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IngestionSetting); err != nil { - return IngestionSettingsCreateResponse{}, err + return IngestionSettingsCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -190,7 +198,7 @@ func (client *IngestionSettingsClient) getCreateRequest(ctx context.Context, ing func (client *IngestionSettingsClient) getHandleResponse(resp *http.Response) (IngestionSettingsGetResponse, error) { result := IngestionSettingsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IngestionSetting); err != nil { - return IngestionSettingsGetResponse{}, err + return IngestionSettingsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -244,7 +252,7 @@ func (client *IngestionSettingsClient) listCreateRequest(ctx context.Context, op func (client *IngestionSettingsClient) listHandleResponse(resp *http.Response) (IngestionSettingsListResponse, error) { result := IngestionSettingsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IngestionSettingList); err != nil { - return IngestionSettingsListResponse{}, err + return IngestionSettingsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -305,7 +313,7 @@ func (client *IngestionSettingsClient) listConnectionStringsCreateRequest(ctx co func (client *IngestionSettingsClient) listConnectionStringsHandleResponse(resp *http.Response) (IngestionSettingsListConnectionStringsResponse, error) { result := IngestionSettingsListConnectionStringsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionStrings); err != nil { - return IngestionSettingsListConnectionStringsResponse{}, err + return IngestionSettingsListConnectionStringsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -366,7 +374,7 @@ func (client *IngestionSettingsClient) listTokensCreateRequest(ctx context.Conte func (client *IngestionSettingsClient) listTokensHandleResponse(resp *http.Response) (IngestionSettingsListTokensResponse, error) { result := IngestionSettingsListTokensResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IngestionSettingToken); err != nil { - return IngestionSettingsListTokensResponse{}, err + return IngestionSettingsListTokensResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolution_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolution_client.go index 20067dfbcfbb..2c7fef6df1cc 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolution_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolution_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // IotSecuritySolutionClient contains the methods for the IotSecuritySolution group. @@ -30,8 +31,15 @@ type IotSecuritySolutionClient struct { } // NewIotSecuritySolutionClient creates a new instance of IotSecuritySolutionClient with the specified values. -func NewIotSecuritySolutionClient(con *arm.Connection, subscriptionID string) *IotSecuritySolutionClient { - return &IotSecuritySolutionClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIotSecuritySolutionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IotSecuritySolutionClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IotSecuritySolutionClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Use this method to create or update yours IoT Security solution @@ -81,7 +89,7 @@ func (client *IotSecuritySolutionClient) createOrUpdateCreateRequest(ctx context func (client *IotSecuritySolutionClient) createOrUpdateHandleResponse(resp *http.Response) (IotSecuritySolutionCreateOrUpdateResponse, error) { result := IotSecuritySolutionCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecuritySolutionModel); err != nil { - return IotSecuritySolutionCreateOrUpdateResponse{}, err + return IotSecuritySolutionCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -202,7 +210,7 @@ func (client *IotSecuritySolutionClient) getCreateRequest(ctx context.Context, r func (client *IotSecuritySolutionClient) getHandleResponse(resp *http.Response) (IotSecuritySolutionGetResponse, error) { result := IotSecuritySolutionGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecuritySolutionModel); err != nil { - return IotSecuritySolutionGetResponse{}, err + return IotSecuritySolutionGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -263,7 +271,7 @@ func (client *IotSecuritySolutionClient) listByResourceGroupCreateRequest(ctx co func (client *IotSecuritySolutionClient) listByResourceGroupHandleResponse(resp *http.Response) (IotSecuritySolutionListByResourceGroupResponse, error) { result := IotSecuritySolutionListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecuritySolutionsList); err != nil { - return IotSecuritySolutionListByResourceGroupResponse{}, err + return IotSecuritySolutionListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -320,7 +328,7 @@ func (client *IotSecuritySolutionClient) listBySubscriptionCreateRequest(ctx con func (client *IotSecuritySolutionClient) listBySubscriptionHandleResponse(resp *http.Response) (IotSecuritySolutionListBySubscriptionResponse, error) { result := IotSecuritySolutionListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecuritySolutionsList); err != nil { - return IotSecuritySolutionListBySubscriptionResponse{}, err + return IotSecuritySolutionListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -385,7 +393,7 @@ func (client *IotSecuritySolutionClient) updateCreateRequest(ctx context.Context func (client *IotSecuritySolutionClient) updateHandleResponse(resp *http.Response) (IotSecuritySolutionUpdateResponse, error) { result := IotSecuritySolutionUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecuritySolutionModel); err != nil { - return IotSecuritySolutionUpdateResponse{}, err + return IotSecuritySolutionUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionanalytics_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionanalytics_client.go index 12c4022800c8..129ec48d8d57 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionanalytics_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionanalytics_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // IotSecuritySolutionAnalyticsClient contains the methods for the IotSecuritySolutionAnalytics group. @@ -30,8 +31,15 @@ type IotSecuritySolutionAnalyticsClient struct { } // NewIotSecuritySolutionAnalyticsClient creates a new instance of IotSecuritySolutionAnalyticsClient with the specified values. -func NewIotSecuritySolutionAnalyticsClient(con *arm.Connection, subscriptionID string) *IotSecuritySolutionAnalyticsClient { - return &IotSecuritySolutionAnalyticsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIotSecuritySolutionAnalyticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IotSecuritySolutionAnalyticsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IotSecuritySolutionAnalyticsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Use this method to get IoT Security Analytics metrics. @@ -81,7 +89,7 @@ func (client *IotSecuritySolutionAnalyticsClient) getCreateRequest(ctx context.C func (client *IotSecuritySolutionAnalyticsClient) getHandleResponse(resp *http.Response) (IotSecuritySolutionAnalyticsGetResponse, error) { result := IotSecuritySolutionAnalyticsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecuritySolutionAnalyticsModel); err != nil { - return IotSecuritySolutionAnalyticsGetResponse{}, err + return IotSecuritySolutionAnalyticsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -146,7 +154,7 @@ func (client *IotSecuritySolutionAnalyticsClient) listCreateRequest(ctx context. func (client *IotSecuritySolutionAnalyticsClient) listHandleResponse(resp *http.Response) (IotSecuritySolutionAnalyticsListResponse, error) { result := IotSecuritySolutionAnalyticsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecuritySolutionAnalyticsModelList); err != nil { - return IotSecuritySolutionAnalyticsListResponse{}, err + return IotSecuritySolutionAnalyticsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionsanalyticsaggregatedalert_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionsanalyticsaggregatedalert_client.go index f1e7d400d8f3..bcc25816bd46 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionsanalyticsaggregatedalert_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionsanalyticsaggregatedalert_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // IotSecuritySolutionsAnalyticsAggregatedAlertClient contains the methods for the IotSecuritySolutionsAnalyticsAggregatedAlert group. @@ -31,8 +32,15 @@ type IotSecuritySolutionsAnalyticsAggregatedAlertClient struct { } // NewIotSecuritySolutionsAnalyticsAggregatedAlertClient creates a new instance of IotSecuritySolutionsAnalyticsAggregatedAlertClient with the specified values. -func NewIotSecuritySolutionsAnalyticsAggregatedAlertClient(con *arm.Connection, subscriptionID string) *IotSecuritySolutionsAnalyticsAggregatedAlertClient { - return &IotSecuritySolutionsAnalyticsAggregatedAlertClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIotSecuritySolutionsAnalyticsAggregatedAlertClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IotSecuritySolutionsAnalyticsAggregatedAlertClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IotSecuritySolutionsAnalyticsAggregatedAlertClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Dismiss - Use this method to dismiss an aggregated IoT Security Solution Alert. @@ -146,7 +154,7 @@ func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) getCreateReque func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) getHandleResponse(resp *http.Response) (IotSecuritySolutionsAnalyticsAggregatedAlertGetResponse, error) { result := IotSecuritySolutionsAnalyticsAggregatedAlertGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecurityAggregatedAlert); err != nil { - return IotSecuritySolutionsAnalyticsAggregatedAlertGetResponse{}, err + return IotSecuritySolutionsAnalyticsAggregatedAlertGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -211,7 +219,7 @@ func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) listCreateRequ func (client *IotSecuritySolutionsAnalyticsAggregatedAlertClient) listHandleResponse(resp *http.Response) (IotSecuritySolutionsAnalyticsAggregatedAlertListResponse, error) { result := IotSecuritySolutionsAnalyticsAggregatedAlertListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecurityAggregatedAlertList); err != nil { - return IotSecuritySolutionsAnalyticsAggregatedAlertListResponse{}, err + return IotSecuritySolutionsAnalyticsAggregatedAlertListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionsanalyticsrecommendation_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionsanalyticsrecommendation_client.go index 53cc1d8dc70b..b4ee6702d15d 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionsanalyticsrecommendation_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_iotsecuritysolutionsanalyticsrecommendation_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // IotSecuritySolutionsAnalyticsRecommendationClient contains the methods for the IotSecuritySolutionsAnalyticsRecommendation group. @@ -31,8 +32,15 @@ type IotSecuritySolutionsAnalyticsRecommendationClient struct { } // NewIotSecuritySolutionsAnalyticsRecommendationClient creates a new instance of IotSecuritySolutionsAnalyticsRecommendationClient with the specified values. -func NewIotSecuritySolutionsAnalyticsRecommendationClient(con *arm.Connection, subscriptionID string) *IotSecuritySolutionsAnalyticsRecommendationClient { - return &IotSecuritySolutionsAnalyticsRecommendationClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewIotSecuritySolutionsAnalyticsRecommendationClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *IotSecuritySolutionsAnalyticsRecommendationClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &IotSecuritySolutionsAnalyticsRecommendationClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Use this method to get the aggregated security analytics recommendation of yours IoT Security solution. This aggregation is performed by recommendation @@ -87,7 +95,7 @@ func (client *IotSecuritySolutionsAnalyticsRecommendationClient) getCreateReques func (client *IotSecuritySolutionsAnalyticsRecommendationClient) getHandleResponse(resp *http.Response) (IotSecuritySolutionsAnalyticsRecommendationGetResponse, error) { result := IotSecuritySolutionsAnalyticsRecommendationGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecurityAggregatedRecommendation); err != nil { - return IotSecuritySolutionsAnalyticsRecommendationGetResponse{}, err + return IotSecuritySolutionsAnalyticsRecommendationGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -152,7 +160,7 @@ func (client *IotSecuritySolutionsAnalyticsRecommendationClient) listCreateReque func (client *IotSecuritySolutionsAnalyticsRecommendationClient) listHandleResponse(resp *http.Response) (IotSecuritySolutionsAnalyticsRecommendationListResponse, error) { result := IotSecuritySolutionsAnalyticsRecommendationListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IoTSecurityAggregatedRecommendationList); err != nil { - return IotSecuritySolutionsAnalyticsRecommendationListResponse{}, err + return IotSecuritySolutionsAnalyticsRecommendationListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_jitnetworkaccesspolicies_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_jitnetworkaccesspolicies_client.go index 7639943a5813..5ea40cdf57c6 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_jitnetworkaccesspolicies_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_jitnetworkaccesspolicies_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // JitNetworkAccessPoliciesClient contains the methods for the JitNetworkAccessPolicies group. @@ -31,8 +32,15 @@ type JitNetworkAccessPoliciesClient struct { } // NewJitNetworkAccessPoliciesClient creates a new instance of JitNetworkAccessPoliciesClient with the specified values. -func NewJitNetworkAccessPoliciesClient(con *arm.Connection, subscriptionID string, ascLocation string) *JitNetworkAccessPoliciesClient { - return &JitNetworkAccessPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID, ascLocation: ascLocation} +func NewJitNetworkAccessPoliciesClient(subscriptionID string, ascLocation string, credential azcore.TokenCredential, options *arm.ClientOptions) *JitNetworkAccessPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &JitNetworkAccessPoliciesClient{subscriptionID: subscriptionID, ascLocation: ascLocation, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create a policy for protecting resources using Just-in-Time access control @@ -86,7 +94,7 @@ func (client *JitNetworkAccessPoliciesClient) createOrUpdateCreateRequest(ctx co func (client *JitNetworkAccessPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (JitNetworkAccessPoliciesCreateOrUpdateResponse, error) { result := JitNetworkAccessPoliciesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JitNetworkAccessPolicy); err != nil { - return JitNetworkAccessPoliciesCreateOrUpdateResponse{}, err + return JitNetworkAccessPoliciesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -215,7 +223,7 @@ func (client *JitNetworkAccessPoliciesClient) getCreateRequest(ctx context.Conte func (client *JitNetworkAccessPoliciesClient) getHandleResponse(resp *http.Response) (JitNetworkAccessPoliciesGetResponse, error) { result := JitNetworkAccessPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JitNetworkAccessPolicy); err != nil { - return JitNetworkAccessPoliciesGetResponse{}, err + return JitNetworkAccessPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -288,7 +296,7 @@ func (client *JitNetworkAccessPoliciesClient) initiateCreateRequest(ctx context. func (client *JitNetworkAccessPoliciesClient) initiateHandleResponse(resp *http.Response) (JitNetworkAccessPoliciesInitiateResponse, error) { result := JitNetworkAccessPoliciesInitiateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JitNetworkAccessRequest); err != nil { - return JitNetworkAccessPoliciesInitiateResponse{}, err + return JitNetworkAccessPoliciesInitiateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -342,7 +350,7 @@ func (client *JitNetworkAccessPoliciesClient) listCreateRequest(ctx context.Cont func (client *JitNetworkAccessPoliciesClient) listHandleResponse(resp *http.Response) (JitNetworkAccessPoliciesListResponse, error) { result := JitNetworkAccessPoliciesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JitNetworkAccessPoliciesList); err != nil { - return JitNetworkAccessPoliciesListResponse{}, err + return JitNetworkAccessPoliciesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -400,7 +408,7 @@ func (client *JitNetworkAccessPoliciesClient) listByRegionCreateRequest(ctx cont func (client *JitNetworkAccessPoliciesClient) listByRegionHandleResponse(resp *http.Response) (JitNetworkAccessPoliciesListByRegionResponse, error) { result := JitNetworkAccessPoliciesListByRegionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JitNetworkAccessPoliciesList); err != nil { - return JitNetworkAccessPoliciesListByRegionResponse{}, err + return JitNetworkAccessPoliciesListByRegionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -458,7 +466,7 @@ func (client *JitNetworkAccessPoliciesClient) listByResourceGroupCreateRequest(c func (client *JitNetworkAccessPoliciesClient) listByResourceGroupHandleResponse(resp *http.Response) (JitNetworkAccessPoliciesListByResourceGroupResponse, error) { result := JitNetworkAccessPoliciesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JitNetworkAccessPoliciesList); err != nil { - return JitNetworkAccessPoliciesListByResourceGroupResponse{}, err + return JitNetworkAccessPoliciesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -520,7 +528,7 @@ func (client *JitNetworkAccessPoliciesClient) listByResourceGroupAndRegionCreate func (client *JitNetworkAccessPoliciesClient) listByResourceGroupAndRegionHandleResponse(resp *http.Response) (JitNetworkAccessPoliciesListByResourceGroupAndRegionResponse, error) { result := JitNetworkAccessPoliciesListByResourceGroupAndRegionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JitNetworkAccessPoliciesList); err != nil { - return JitNetworkAccessPoliciesListByResourceGroupAndRegionResponse{}, err + return JitNetworkAccessPoliciesListByResourceGroupAndRegionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_locations_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_locations_client.go index 65070f395e6b..ebc6c58e2e9b 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_locations_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_locations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LocationsClient contains the methods for the Locations group. @@ -31,8 +32,15 @@ type LocationsClient struct { } // NewLocationsClient creates a new instance of LocationsClient with the specified values. -func NewLocationsClient(con *arm.Connection, subscriptionID string, ascLocation string) *LocationsClient { - return &LocationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID, ascLocation: ascLocation} +func NewLocationsClient(subscriptionID string, ascLocation string, credential azcore.TokenCredential, options *arm.ClientOptions) *LocationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LocationsClient{subscriptionID: subscriptionID, ascLocation: ascLocation, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Details of a specific location @@ -78,7 +86,7 @@ func (client *LocationsClient) getCreateRequest(ctx context.Context, options *Lo func (client *LocationsClient) getHandleResponse(resp *http.Response) (LocationsGetResponse, error) { result := LocationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AscLocation); err != nil { - return LocationsGetResponse{}, err + return LocationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -134,7 +142,7 @@ func (client *LocationsClient) listCreateRequest(ctx context.Context, options *L func (client *LocationsClient) listHandleResponse(resp *http.Response) (LocationsListResponse, error) { result := LocationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AscLocationList); err != nil { - return LocationsListResponse{}, err + return LocationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_mdeonboardings_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_mdeonboardings_client.go new file mode 100644 index 000000000000..5e61c7170bb3 --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_mdeonboardings_client.go @@ -0,0 +1,157 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armsecurity + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// MdeOnboardingsClient contains the methods for the MdeOnboardings group. +// Don't use this type directly, use NewMdeOnboardingsClient() instead. +type MdeOnboardingsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewMdeOnboardingsClient creates a new instance of MdeOnboardingsClient with the specified values. +func NewMdeOnboardingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *MdeOnboardingsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MdeOnboardingsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// Get - The default configuration or data needed to onboard the machine to MDE +// If the operation fails it returns the *CloudError error type. +func (client *MdeOnboardingsClient) Get(ctx context.Context, options *MdeOnboardingsGetOptions) (MdeOnboardingsGetResponse, error) { + req, err := client.getCreateRequest(ctx, options) + if err != nil { + return MdeOnboardingsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MdeOnboardingsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MdeOnboardingsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *MdeOnboardingsClient) getCreateRequest(ctx context.Context, options *MdeOnboardingsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings/default" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *MdeOnboardingsClient) getHandleResponse(resp *http.Response) (MdeOnboardingsGetResponse, error) { + result := MdeOnboardingsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.MdeOnboardingData); err != nil { + return MdeOnboardingsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *MdeOnboardingsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType.InnerError); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - The configuration or data needed to onboard the machine to MDE +// If the operation fails it returns the *CloudError error type. +func (client *MdeOnboardingsClient) List(ctx context.Context, options *MdeOnboardingsListOptions) (MdeOnboardingsListResponse, error) { + req, err := client.listCreateRequest(ctx, options) + if err != nil { + return MdeOnboardingsListResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return MdeOnboardingsListResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return MdeOnboardingsListResponse{}, client.listHandleError(resp) + } + return client.listHandleResponse(resp) +} + +// listCreateRequest creates the List request. +func (client *MdeOnboardingsClient) listCreateRequest(ctx context.Context, options *MdeOnboardingsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/mdeOnboardings" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-10-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *MdeOnboardingsClient) listHandleResponse(resp *http.Response) (MdeOnboardingsListResponse, error) { + result := MdeOnboardingsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.MdeOnboardingDataList); err != nil { + return MdeOnboardingsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *MdeOnboardingsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType.InnerError); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_models.go b/sdk/resourcemanager/security/armsecurity/zz_generated_models.go index 17e4552d77df..b419cf773ae5 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_models.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_models.go @@ -10,10 +10,10 @@ package armsecurity import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // AADConnectivityStateAutoGenerated - Describes an Azure resource with kind @@ -308,7 +308,7 @@ func (a AdaptiveNetworkHardeningProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "effectiveNetworkSecurityGroups", a.EffectiveNetworkSecurityGroups) populate(objectMap, "rules", a.Rules) - populate(objectMap, "rulesCalculationTime", (*timeRFC3339)(a.RulesCalculationTime)) + populateTimeRFC3339(objectMap, "rulesCalculationTime", a.RulesCalculationTime) return json.Marshal(objectMap) } @@ -328,9 +328,7 @@ func (a *AdaptiveNetworkHardeningProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.Rules) delete(rawMsg, key) case "rulesCalculationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.RulesCalculationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.RulesCalculationTime) delete(rawMsg, key) } if err != nil { @@ -683,22 +681,22 @@ func (a AlertProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "compromisedEntity", a.CompromisedEntity) populate(objectMap, "correlationKey", a.CorrelationKey) populate(objectMap, "description", a.Description) - populate(objectMap, "endTimeUtc", (*timeRFC3339)(a.EndTimeUTC)) + populateTimeRFC3339(objectMap, "endTimeUtc", a.EndTimeUTC) populate(objectMap, "entities", a.Entities) populate(objectMap, "extendedLinks", a.ExtendedLinks) populate(objectMap, "extendedProperties", a.ExtendedProperties) populate(objectMap, "intent", a.Intent) populate(objectMap, "isIncident", a.IsIncident) - populate(objectMap, "processingEndTimeUtc", (*timeRFC3339)(a.ProcessingEndTimeUTC)) + populateTimeRFC3339(objectMap, "processingEndTimeUtc", a.ProcessingEndTimeUTC) populate(objectMap, "productComponentName", a.ProductComponentName) populate(objectMap, "productName", a.ProductName) populate(objectMap, "remediationSteps", a.RemediationSteps) populate(objectMap, "resourceIdentifiers", a.ResourceIdentifiers) populate(objectMap, "severity", a.Severity) - populate(objectMap, "startTimeUtc", (*timeRFC3339)(a.StartTimeUTC)) + populateTimeRFC3339(objectMap, "startTimeUtc", a.StartTimeUTC) populate(objectMap, "status", a.Status) populate(objectMap, "systemAlertId", a.SystemAlertID) - populate(objectMap, "timeGeneratedUtc", (*timeRFC3339)(a.TimeGeneratedUTC)) + populateTimeRFC3339(objectMap, "timeGeneratedUtc", a.TimeGeneratedUTC) populate(objectMap, "vendorName", a.VendorName) return json.Marshal(objectMap) } @@ -731,9 +729,7 @@ func (a *AlertProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.Description) delete(rawMsg, key) case "endTimeUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.EndTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.EndTimeUTC) delete(rawMsg, key) case "entities": err = unpopulate(val, &a.Entities) @@ -751,9 +747,7 @@ func (a *AlertProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.IsIncident) delete(rawMsg, key) case "processingEndTimeUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.ProcessingEndTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.ProcessingEndTimeUTC) delete(rawMsg, key) case "productComponentName": err = unpopulate(val, &a.ProductComponentName) @@ -771,9 +765,7 @@ func (a *AlertProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.Severity) delete(rawMsg, key) case "startTimeUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.StartTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.StartTimeUTC) delete(rawMsg, key) case "status": err = unpopulate(val, &a.Status) @@ -782,9 +774,7 @@ func (a *AlertProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.SystemAlertID) delete(rawMsg, key) case "timeGeneratedUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.TimeGeneratedUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.TimeGeneratedUTC) delete(rawMsg, key) case "vendorName": err = unpopulate(val, &a.VendorName) @@ -1081,8 +1071,8 @@ func (a AlertsSuppressionRuleProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "alertType", a.AlertType) populate(objectMap, "comment", a.Comment) - populate(objectMap, "expirationDateUtc", (*timeRFC3339)(a.ExpirationDateUTC)) - populate(objectMap, "lastModifiedUtc", (*timeRFC3339)(a.LastModifiedUTC)) + populateTimeRFC3339(objectMap, "expirationDateUtc", a.ExpirationDateUTC) + populateTimeRFC3339(objectMap, "lastModifiedUtc", a.LastModifiedUTC) populate(objectMap, "reason", a.Reason) populate(objectMap, "state", a.State) populate(objectMap, "suppressionAlertsScope", a.SuppressionAlertsScope) @@ -1105,14 +1095,10 @@ func (a *AlertsSuppressionRuleProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.Comment) delete(rawMsg, key) case "expirationDateUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.ExpirationDateUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.ExpirationDateUTC) delete(rawMsg, key) case "lastModifiedUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.LastModifiedUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.LastModifiedUTC) delete(rawMsg, key) case "reason": err = unpopulate(val, &a.Reason) @@ -1286,7 +1272,7 @@ type AllowedConnectionsResourceProperties struct { // MarshalJSON implements the json.Marshaller interface for type AllowedConnectionsResourceProperties. func (a AllowedConnectionsResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "calculatedDateTime", (*timeRFC3339)(a.CalculatedDateTime)) + populateTimeRFC3339(objectMap, "calculatedDateTime", a.CalculatedDateTime) populate(objectMap, "connectableResources", a.ConnectableResources) return json.Marshal(objectMap) } @@ -1301,9 +1287,7 @@ func (a *AllowedConnectionsResourceProperties) UnmarshalJSON(data []byte) error var err error switch key { case "calculatedDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.CalculatedDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.CalculatedDateTime) delete(rawMsg, key) case "connectableResources": err = unpopulate(val, &a.ConnectableResources) @@ -1541,8 +1525,8 @@ type AssessmentStatusResponse struct { func (a AssessmentStatusResponse) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) a.AssessmentStatus.marshalInternal(objectMap) - populate(objectMap, "firstEvaluationDate", (*timeRFC3339)(a.FirstEvaluationDate)) - populate(objectMap, "statusChangeDate", (*timeRFC3339)(a.StatusChangeDate)) + populateTimeRFC3339(objectMap, "firstEvaluationDate", a.FirstEvaluationDate) + populateTimeRFC3339(objectMap, "statusChangeDate", a.StatusChangeDate) return json.Marshal(objectMap) } @@ -1556,14 +1540,10 @@ func (a *AssessmentStatusResponse) UnmarshalJSON(data []byte) error { var err error switch key { case "firstEvaluationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.FirstEvaluationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.FirstEvaluationDate) delete(rawMsg, key) case "statusChangeDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.StatusChangeDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.StatusChangeDate) delete(rawMsg, key) } if err != nil { @@ -2453,7 +2433,7 @@ type Baseline struct { func (b Baseline) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "expectedResults", b.ExpectedResults) - populate(objectMap, "updatedTime", (*timeRFC3339)(b.UpdatedTime)) + populateTimeRFC3339(objectMap, "updatedTime", b.UpdatedTime) return json.Marshal(objectMap) } @@ -2470,9 +2450,7 @@ func (b *Baseline) UnmarshalJSON(data []byte) error { err = unpopulate(val, &b.ExpectedResults) delete(rawMsg, key) case "updatedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - b.UpdatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &b.UpdatedTime) delete(rawMsg, key) } if err != nil { @@ -2660,6 +2638,60 @@ func (c CloudErrorBody) MarshalJSON() ([]byte, error) { return json.Marshal(objectMap) } +// CloudOfferingClassification provides polymorphic access to related types. +// Call the interface's GetCloudOffering() method to access the common type. +// Use a type switch to determine the concrete type. The possible types are: +// - *CloudOffering, *CspmMonitorAwsOffering, *DefenderForContainersAwsOffering, *DefenderForServersAwsOffering +type CloudOfferingClassification interface { + // GetCloudOffering returns the CloudOffering content of the underlying type. + GetCloudOffering() *CloudOffering +} + +// CloudOffering - The security offering details +type CloudOffering struct { + // REQUIRED; The type of the security offering. + OfferingType *OfferingType `json:"offeringType,omitempty"` + + // READ-ONLY; The offering description. + Description *string `json:"description,omitempty" azure:"ro"` +} + +// GetCloudOffering implements the CloudOfferingClassification interface for type CloudOffering. +func (c *CloudOffering) GetCloudOffering() *CloudOffering { return c } + +// UnmarshalJSON implements the json.Unmarshaller interface for type CloudOffering. +func (c *CloudOffering) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + return c.unmarshalInternal(rawMsg) +} + +func (c CloudOffering) marshalInternal(objectMap map[string]interface{}, discValue OfferingType) { + populate(objectMap, "description", c.Description) + c.OfferingType = &discValue + objectMap["offeringType"] = c.OfferingType +} + +func (c *CloudOffering) unmarshalInternal(rawMsg map[string]json.RawMessage) error { + for key, val := range rawMsg { + var err error + switch key { + case "description": + err = unpopulate(val, &c.Description) + delete(rawMsg, key) + case "offeringType": + err = unpopulate(val, &c.OfferingType) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + // Compliance of a scope type Compliance struct { Resource @@ -2733,7 +2765,7 @@ type ComplianceProperties struct { func (c ComplianceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "assessmentResult", c.AssessmentResult) - populate(objectMap, "assessmentTimestampUtcDate", (*timeRFC3339)(c.AssessmentTimestampUTCDate)) + populateTimeRFC3339(objectMap, "assessmentTimestampUtcDate", c.AssessmentTimestampUTCDate) populate(objectMap, "resourceCount", c.ResourceCount) return json.Marshal(objectMap) } @@ -2751,9 +2783,7 @@ func (c *ComplianceProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.AssessmentResult) delete(rawMsg, key) case "assessmentTimestampUtcDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.AssessmentTimestampUTCDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.AssessmentTimestampUTCDate) delete(rawMsg, key) case "resourceCount": err = unpopulate(val, &c.ResourceCount) @@ -3083,7 +3113,7 @@ func (c ContainerRegistryVulnerabilityProperties) MarshalJSON() ([]byte, error) populate(objectMap, "cvss", c.Cvss) populate(objectMap, "imageDigest", c.ImageDigest) populate(objectMap, "patchable", c.Patchable) - populate(objectMap, "publishedTime", (*timeRFC3339)(c.PublishedTime)) + populateTimeRFC3339(objectMap, "publishedTime", c.PublishedTime) populate(objectMap, "repositoryName", c.RepositoryName) populate(objectMap, "type", c.Type) populate(objectMap, "vendorReferences", c.VendorReferences) @@ -3112,9 +3142,7 @@ func (c *ContainerRegistryVulnerabilityProperties) UnmarshalJSON(data []byte) er err = unpopulate(val, &c.Patchable) delete(rawMsg, key) case "publishedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.PublishedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.PublishedTime) delete(rawMsg, key) case "repositoryName": err = unpopulate(val, &c.RepositoryName) @@ -3136,6 +3164,50 @@ func (c *ContainerRegistryVulnerabilityProperties) UnmarshalJSON(data []byte) er return nil } +// CspmMonitorAwsOffering - The CSPM monitoring for AWS offering configurations +type CspmMonitorAwsOffering struct { + CloudOffering + // The native cloud connection configuration + NativeCloudConnection *CspmMonitorAwsOfferingNativeCloudConnection `json:"nativeCloudConnection,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CspmMonitorAwsOffering. +func (c CspmMonitorAwsOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.CloudOffering.marshalInternal(objectMap, OfferingTypeCspmMonitorAws) + populate(objectMap, "nativeCloudConnection", c.NativeCloudConnection) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CspmMonitorAwsOffering. +func (c *CspmMonitorAwsOffering) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "nativeCloudConnection": + err = unpopulate(val, &c.NativeCloudConnection) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.CloudOffering.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// CspmMonitorAwsOfferingNativeCloudConnection - The native cloud connection configuration +type CspmMonitorAwsOfferingNativeCloudConnection struct { + // The cloud role ARN in AWS for this feature + CloudRoleArn *string `json:"cloudRoleArn,omitempty"` +} + // CustomAlertRuleClassification provides polymorphic access to related types. // Call the interface's GetCustomAlertRule() method to access the common type. // Use a type switch to determine the concrete type. The possible types are: @@ -3215,6 +3287,9 @@ type CustomAssessmentAutomation struct { Resource // describes Custom Assessment Automation properties. Properties *CustomAssessmentAutomationProperties `json:"properties,omitempty"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` } // MarshalJSON implements the json.Marshaller interface for type CustomAssessmentAutomation. @@ -3222,6 +3297,7 @@ func (c CustomAssessmentAutomation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) c.Resource.marshalInternal(objectMap) populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) return json.Marshal(objectMap) } @@ -3237,6 +3313,9 @@ func (c *CustomAssessmentAutomation) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, &c.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &c.SystemData) + delete(rawMsg, key) } if err != nil { return err @@ -3250,6 +3329,9 @@ func (c *CustomAssessmentAutomation) UnmarshalJSON(data []byte) error { // CustomAssessmentAutomationProperties - describes the Custom Assessment Automation properties type CustomAssessmentAutomationProperties struct { + // The assessment metadata key used when an assessment is generated for this assessment automation. + AssessmentKey *string `json:"assessmentKey,omitempty"` + // GZip encoded KQL query representing the assessment automation results required. CompressedQuery *string `json:"compressedQuery,omitempty"` @@ -3272,6 +3354,68 @@ type CustomAssessmentAutomationProperties struct { UserImpact *UserImpactEnum `json:"userImpact,omitempty"` } +// CustomAssessmentAutomationRequest - Custom Assessment Automation request +type CustomAssessmentAutomationRequest struct { + Resource + // describes Custom Assessment Automation request properties. + Properties *CustomAssessmentAutomationRequestProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type CustomAssessmentAutomationRequest. +func (c CustomAssessmentAutomationRequest) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + c.Resource.marshalInternal(objectMap) + populate(objectMap, "properties", c.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type CustomAssessmentAutomationRequest. +func (c *CustomAssessmentAutomationRequest) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &c.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := c.Resource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// CustomAssessmentAutomationRequestProperties - describes the Custom Assessment Automation properties +type CustomAssessmentAutomationRequestProperties struct { + // Base 64 encoded KQL query representing the assessment automation results required. + CompressedQuery *string `json:"compressedQuery,omitempty"` + + // The description to relate to the assessments generated by this assessment automation. + Description *string `json:"description,omitempty"` + + // The implementation effort to relate to the assessments generated by this assessment automation. + ImplementationEffort *ImplementationEffortEnum `json:"implementationEffort,omitempty"` + + // The remediation description to relate to the assessments generated by this assessment automation. + RemediationDescription *string `json:"remediationDescription,omitempty"` + + // The severity to relate to the assessments generated by this assessment automation. + Severity *SeverityEnum `json:"severity,omitempty"` + + // Relevant cloud for the custom assessment automation. + SupportedCloud *SupportedCloudEnum `json:"supportedCloud,omitempty"` + + // The user impact to relate to the assessments generated by this assessment automation. + UserImpact *UserImpactEnum `json:"userImpact,omitempty"` +} + // CustomAssessmentAutomationsCreateOptions contains the optional parameters for the CustomAssessmentAutomations.Create method. type CustomAssessmentAutomationsCreateOptions struct { // placeholder for future optional parameters @@ -3319,6 +3463,9 @@ type CustomEntityStoreAssignment struct { Resource // describes custom entity store assignment properties. Properties *CustomEntityStoreAssignmentProperties `json:"properties,omitempty"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` } // MarshalJSON implements the json.Marshaller interface for type CustomEntityStoreAssignment. @@ -3326,6 +3473,7 @@ func (c CustomEntityStoreAssignment) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) c.Resource.marshalInternal(objectMap) populate(objectMap, "properties", c.Properties) + populate(objectMap, "systemData", c.SystemData) return json.Marshal(objectMap) } @@ -3341,6 +3489,9 @@ func (c *CustomEntityStoreAssignment) UnmarshalJSON(data []byte) error { case "properties": err = unpopulate(val, &c.Properties) delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &c.SystemData) + delete(rawMsg, key) } if err != nil { return err @@ -3459,6 +3610,161 @@ func (d *DataExportSettings) UnmarshalJSON(data []byte) error { return nil } +// DefenderForContainersAwsOffering - The Defender for Containers AWS offering configurations +type DefenderForContainersAwsOffering struct { + CloudOffering + // The cloudwatch to kinesis connection configuration + CloudWatchToKinesis *DefenderForContainersAwsOfferingCloudWatchToKinesis `json:"cloudWatchToKinesis,omitempty"` + + // The kinesis to s3 connection configuration + KinesisToS3 *DefenderForContainersAwsOfferingKinesisToS3 `json:"kinesisToS3,omitempty"` + + // The kubernetes to scuba connection configuration + KubernetesScubaReader *DefenderForContainersAwsOfferingKubernetesScubaReader `json:"kubernetesScubaReader,omitempty"` + + // The kubernetes service connection configuration + KubernetesService *DefenderForContainersAwsOfferingKubernetesService `json:"kubernetesService,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type DefenderForContainersAwsOffering. +func (d DefenderForContainersAwsOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + d.CloudOffering.marshalInternal(objectMap, OfferingTypeDefenderForContainersAws) + populate(objectMap, "cloudWatchToKinesis", d.CloudWatchToKinesis) + populate(objectMap, "kinesisToS3", d.KinesisToS3) + populate(objectMap, "kubernetesScubaReader", d.KubernetesScubaReader) + populate(objectMap, "kubernetesService", d.KubernetesService) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForContainersAwsOffering. +func (d *DefenderForContainersAwsOffering) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "cloudWatchToKinesis": + err = unpopulate(val, &d.CloudWatchToKinesis) + delete(rawMsg, key) + case "kinesisToS3": + err = unpopulate(val, &d.KinesisToS3) + delete(rawMsg, key) + case "kubernetesScubaReader": + err = unpopulate(val, &d.KubernetesScubaReader) + delete(rawMsg, key) + case "kubernetesService": + err = unpopulate(val, &d.KubernetesService) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := d.CloudOffering.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// DefenderForContainersAwsOfferingCloudWatchToKinesis - The cloudwatch to kinesis connection configuration +type DefenderForContainersAwsOfferingCloudWatchToKinesis struct { + // The cloud role ARN in AWS for this feature + CloudRoleArn *string `json:"cloudRoleArn,omitempty"` +} + +// DefenderForContainersAwsOfferingKinesisToS3 - The kinesis to s3 connection configuration +type DefenderForContainersAwsOfferingKinesisToS3 struct { + // The cloud role ARN in AWS for this feature + CloudRoleArn *string `json:"cloudRoleArn,omitempty"` +} + +// DefenderForContainersAwsOfferingKubernetesScubaReader - The kubernetes to scuba connection configuration +type DefenderForContainersAwsOfferingKubernetesScubaReader struct { + // The cloud role ARN in AWS for this feature + CloudRoleArn *string `json:"cloudRoleArn,omitempty"` +} + +// DefenderForContainersAwsOfferingKubernetesService - The kubernetes service connection configuration +type DefenderForContainersAwsOfferingKubernetesService struct { + // The cloud role ARN in AWS for this feature + CloudRoleArn *string `json:"cloudRoleArn,omitempty"` +} + +// DefenderForServersAwsOffering - The Defender for Servers AWS offering configurations +type DefenderForServersAwsOffering struct { + CloudOffering + // The ARC autoprovisioning configuration + ArcAutoProvisioning *DefenderForServersAwsOfferingArcAutoProvisioning `json:"arcAutoProvisioning,omitempty"` + + // The Defender for servers connection configuration + DefenderForServers *DefenderForServersAwsOfferingDefenderForServers `json:"defenderForServers,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type DefenderForServersAwsOffering. +func (d DefenderForServersAwsOffering) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + d.CloudOffering.marshalInternal(objectMap, "DefenderForServersAWS") + populate(objectMap, "arcAutoProvisioning", d.ArcAutoProvisioning) + populate(objectMap, "defenderForServers", d.DefenderForServers) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type DefenderForServersAwsOffering. +func (d *DefenderForServersAwsOffering) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "arcAutoProvisioning": + err = unpopulate(val, &d.ArcAutoProvisioning) + delete(rawMsg, key) + case "defenderForServers": + err = unpopulate(val, &d.DefenderForServers) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := d.CloudOffering.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// DefenderForServersAwsOfferingArcAutoProvisioning - The ARC autoprovisioning configuration +type DefenderForServersAwsOfferingArcAutoProvisioning struct { + // Is arc auto provisioning enabled + Enabled *bool `json:"enabled,omitempty"` + + // Metadata of Service Principal secret for autoprovisioning + ServicePrincipalSecretMetadata *DefenderForServersAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata `json:"servicePrincipalSecretMetadata,omitempty"` +} + +// DefenderForServersAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata - Metadata of Service Principal secret for autoprovisioning +type DefenderForServersAwsOfferingArcAutoProvisioningServicePrincipalSecretMetadata struct { + // expiration date of service principal secret + ExpiryDate *string `json:"expiryDate,omitempty"` + + // name of secret resource in parameter store + ParameterNameInStore *string `json:"parameterNameInStore,omitempty"` + + // region of parameter store where secret is kept + ParameterStoreRegion *string `json:"parameterStoreRegion,omitempty"` +} + +// DefenderForServersAwsOfferingDefenderForServers - The Defender for servers connection configuration +type DefenderForServersAwsOfferingDefenderForServers struct { + // The cloud role ARN in AWS for this feature + CloudRoleArn *string `json:"cloudRoleArn,omitempty"` +} + // DenylistCustomAlertRule - A custom alert rule that checks if a value (depends on the custom alert type) is denied. type DenylistCustomAlertRule struct { ListCustomAlertRule @@ -4260,7 +4566,7 @@ func (i InformationProtectionPolicyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "informationTypes", i.InformationTypes) populate(objectMap, "labels", i.Labels) - populate(objectMap, "lastModifiedUtc", (*timeRFC3339)(i.LastModifiedUTC)) + populateTimeRFC3339(objectMap, "lastModifiedUtc", i.LastModifiedUTC) populate(objectMap, "version", i.Version) return json.Marshal(objectMap) } @@ -4281,9 +4587,7 @@ func (i *InformationProtectionPolicyProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, &i.Labels) delete(rawMsg, key) case "lastModifiedUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.LastModifiedUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.LastModifiedUTC) delete(rawMsg, key) case "version": err = unpopulate(val, &i.Version) @@ -4539,7 +4843,7 @@ type IoTSecurityAggregatedAlertProperties struct { func (i IoTSecurityAggregatedAlertProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "actionTaken", i.ActionTaken) - populate(objectMap, "aggregatedDateUtc", (*dateType)(i.AggregatedDateUTC)) + populateDateType(objectMap, "aggregatedDateUtc", i.AggregatedDateUTC) populate(objectMap, "alertDisplayName", i.AlertDisplayName) populate(objectMap, "alertType", i.AlertType) populate(objectMap, "count", i.Count) @@ -4567,9 +4871,7 @@ func (i *IoTSecurityAggregatedAlertProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, &i.ActionTaken) delete(rawMsg, key) case "aggregatedDateUtc": - var aux dateType - err = unpopulate(val, &aux) - i.AggregatedDateUTC = (*time.Time)(&aux) + err = unpopulateDateType(val, &i.AggregatedDateUTC) delete(rawMsg, key) case "alertDisplayName": err = unpopulate(val, &i.AlertDisplayName) @@ -4848,7 +5150,7 @@ type IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem struct { // MarshalJSON implements the json.Marshaller interface for type IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem. func (i IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "date", (*timeRFC3339)(i.Date)) + populateTimeRFC3339(objectMap, "date", i.Date) populate(objectMap, "devicesMetrics", i.DevicesMetrics) return json.Marshal(objectMap) } @@ -4863,9 +5165,7 @@ func (i *IoTSecuritySolutionAnalyticsModelPropertiesDevicesMetricsItem) Unmarsha var err error switch key { case "date": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.Date = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.Date) delete(rawMsg, key) case "devicesMetrics": err = unpopulate(val, &i.DevicesMetrics) @@ -5205,7 +5505,7 @@ type JitNetworkAccessPolicyInitiatePort struct { func (j JitNetworkAccessPolicyInitiatePort) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "allowedSourceAddressPrefix", j.AllowedSourceAddressPrefix) - populate(objectMap, "endTimeUtc", (*timeRFC3339)(j.EndTimeUTC)) + populateTimeRFC3339(objectMap, "endTimeUtc", j.EndTimeUTC) populate(objectMap, "number", j.Number) return json.Marshal(objectMap) } @@ -5223,9 +5523,7 @@ func (j *JitNetworkAccessPolicyInitiatePort) UnmarshalJSON(data []byte) error { err = unpopulate(val, &j.AllowedSourceAddressPrefix) delete(rawMsg, key) case "endTimeUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.EndTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.EndTimeUTC) delete(rawMsg, key) case "number": err = unpopulate(val, &j.Number) @@ -5355,7 +5653,7 @@ func (j JitNetworkAccessRequest) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "justification", j.Justification) populate(objectMap, "requestor", j.Requestor) - populate(objectMap, "startTimeUtc", (*timeRFC3339)(j.StartTimeUTC)) + populateTimeRFC3339(objectMap, "startTimeUtc", j.StartTimeUTC) populate(objectMap, "virtualMachines", j.VirtualMachines) return json.Marshal(objectMap) } @@ -5376,9 +5674,7 @@ func (j *JitNetworkAccessRequest) UnmarshalJSON(data []byte) error { err = unpopulate(val, &j.Requestor) delete(rawMsg, key) case "startTimeUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.StartTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.StartTimeUTC) delete(rawMsg, key) case "virtualMachines": err = unpopulate(val, &j.VirtualMachines) @@ -5419,7 +5715,7 @@ func (j JitNetworkAccessRequestPort) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "allowedSourceAddressPrefix", j.AllowedSourceAddressPrefix) populate(objectMap, "allowedSourceAddressPrefixes", j.AllowedSourceAddressPrefixes) - populate(objectMap, "endTimeUtc", (*timeRFC3339)(j.EndTimeUTC)) + populateTimeRFC3339(objectMap, "endTimeUtc", j.EndTimeUTC) populate(objectMap, "mappedPort", j.MappedPort) populate(objectMap, "number", j.Number) populate(objectMap, "status", j.Status) @@ -5443,9 +5739,7 @@ func (j *JitNetworkAccessRequestPort) UnmarshalJSON(data []byte) error { err = unpopulate(val, &j.AllowedSourceAddressPrefixes) delete(rawMsg, key) case "endTimeUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.EndTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.EndTimeUTC) delete(rawMsg, key) case "mappedPort": err = unpopulate(val, &j.MappedPort) @@ -5699,6 +5993,107 @@ func (l *LogAnalyticsIdentifier) UnmarshalJSON(data []byte) error { return nil } +// MdeOnboardingData - The resource of the configuration or data needed to onboard the machine to MDE +type MdeOnboardingData struct { + Resource + // Properties of the MDE configuration or data parameter needed to onboard the machine to MDE + Properties *MdeOnboardingDataProperties `json:"properties,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type MdeOnboardingData. +func (m MdeOnboardingData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + m.Resource.marshalInternal(objectMap) + populate(objectMap, "properties", m.Properties) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MdeOnboardingData. +func (m *MdeOnboardingData) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &m.Properties) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := m.Resource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// MdeOnboardingDataList - List of all MDE onboarding data resources +type MdeOnboardingDataList struct { + // List of the resources of the configuration or data needed to onboard the machine to MDE + Value []*MdeOnboardingData `json:"value,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type MdeOnboardingDataList. +func (m MdeOnboardingDataList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "value", m.Value) + return json.Marshal(objectMap) +} + +// MdeOnboardingDataProperties - Properties of the MDE configuration or data parameter needed to onboard the machine to MDE +type MdeOnboardingDataProperties struct { + // The onboarding package used to onboard Linux machines to MDE, coded in base64. This can also be used for onboarding using the dedicated VM Extension + OnboardingPackageLinux []byte `json:"onboardingPackageLinux,omitempty"` + + // The onboarding package used to onboard Windows machines to MDE, coded in base64. This can also be used for onboarding using the dedicated VM Extension + OnboardingPackageWindows []byte `json:"onboardingPackageWindows,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type MdeOnboardingDataProperties. +func (m MdeOnboardingDataProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populateByteArray(objectMap, "onboardingPackageLinux", m.OnboardingPackageLinux, runtime.Base64StdFormat) + populateByteArray(objectMap, "onboardingPackageWindows", m.OnboardingPackageWindows, runtime.Base64StdFormat) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type MdeOnboardingDataProperties. +func (m *MdeOnboardingDataProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "onboardingPackageLinux": + err = runtime.DecodeByteArray(string(val), &m.OnboardingPackageLinux, runtime.Base64StdFormat) + delete(rawMsg, key) + case "onboardingPackageWindows": + err = runtime.DecodeByteArray(string(val), &m.OnboardingPackageWindows, runtime.Base64StdFormat) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// MdeOnboardingsGetOptions contains the optional parameters for the MdeOnboardings.Get method. +type MdeOnboardingsGetOptions struct { + // placeholder for future optional parameters +} + +// MdeOnboardingsListOptions contains the optional parameters for the MdeOnboardings.List method. +type MdeOnboardingsListOptions struct { + // placeholder for future optional parameters +} + // MqttC2DMessagesNotInAllowedRange - Number of cloud to device messages (MQTT protocol) is not in allowed range. type MqttC2DMessagesNotInAllowedRange struct { TimeWindowCustomAlertRule @@ -6717,14 +7112,14 @@ type ScanProperties struct { func (s ScanProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "database", s.Database) - populate(objectMap, "endTime", (*timeRFC3339)(s.EndTime)) + populateTimeRFC3339(objectMap, "endTime", s.EndTime) populate(objectMap, "highSeverityFailedRulesCount", s.HighSeverityFailedRulesCount) populate(objectMap, "isBaselineApplied", s.IsBaselineApplied) populate(objectMap, "lowSeverityFailedRulesCount", s.LowSeverityFailedRulesCount) populate(objectMap, "mediumSeverityFailedRulesCount", s.MediumSeverityFailedRulesCount) populate(objectMap, "sqlVersion", s.SQLVersion) populate(objectMap, "server", s.Server) - populate(objectMap, "startTime", (*timeRFC3339)(s.StartTime)) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) populate(objectMap, "state", s.State) populate(objectMap, "totalFailedRulesCount", s.TotalFailedRulesCount) populate(objectMap, "totalPassedRulesCount", s.TotalPassedRulesCount) @@ -6746,9 +7141,7 @@ func (s *ScanProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Database) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.EndTime) delete(rawMsg, key) case "highSeverityFailedRulesCount": err = unpopulate(val, &s.HighSeverityFailedRulesCount) @@ -6769,9 +7162,7 @@ func (s *ScanProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Server) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.StartTime) delete(rawMsg, key) case "state": err = unpopulate(val, &s.State) @@ -7683,6 +8074,177 @@ func (s *SecurityAssessmentResponse) UnmarshalJSON(data []byte) error { return nil } +// SecurityConnector - The security connector resource. +type SecurityConnector struct { + TrackedResource + // Security connector data + Properties *SecurityConnectorProperties `json:"properties,omitempty"` + + // READ-ONLY; Azure Resource Manager metadata containing createdBy and modifiedBy information. + SystemData *SystemData `json:"systemData,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityConnector. +func (s SecurityConnector) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + s.TrackedResource.marshalInternal(objectMap) + populate(objectMap, "properties", s.Properties) + populate(objectMap, "systemData", s.SystemData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityConnector. +func (s *SecurityConnector) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "properties": + err = unpopulate(val, &s.Properties) + delete(rawMsg, key) + case "systemData": + err = unpopulate(val, &s.SystemData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + if err := s.TrackedResource.unmarshalInternal(rawMsg); err != nil { + return err + } + return nil +} + +// SecurityConnectorProperties - A set of properties that defines the security connector configuration. +type SecurityConnectorProperties struct { + // The multi cloud resource's cloud name. + CloudName *CloudName `json:"cloudName,omitempty"` + + // The multi cloud resource identifier (account id in case of AWS connector). + HierarchyIdentifier *string `json:"hierarchyIdentifier,omitempty"` + + // A collection of offerings for the security connector. + Offerings []CloudOfferingClassification `json:"offerings,omitempty"` + + // The multi cloud account's organizational data + OrganizationalData *SecurityConnectorPropertiesOrganizationalData `json:"organizationalData,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityConnectorProperties. +func (s SecurityConnectorProperties) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "cloudName", s.CloudName) + populate(objectMap, "hierarchyIdentifier", s.HierarchyIdentifier) + populate(objectMap, "offerings", s.Offerings) + populate(objectMap, "organizationalData", s.OrganizationalData) + return json.Marshal(objectMap) +} + +// UnmarshalJSON implements the json.Unmarshaller interface for type SecurityConnectorProperties. +func (s *SecurityConnectorProperties) UnmarshalJSON(data []byte) error { + var rawMsg map[string]json.RawMessage + if err := json.Unmarshal(data, &rawMsg); err != nil { + return err + } + for key, val := range rawMsg { + var err error + switch key { + case "cloudName": + err = unpopulate(val, &s.CloudName) + delete(rawMsg, key) + case "hierarchyIdentifier": + err = unpopulate(val, &s.HierarchyIdentifier) + delete(rawMsg, key) + case "offerings": + s.Offerings, err = unmarshalCloudOfferingClassificationArray(val) + delete(rawMsg, key) + case "organizationalData": + err = unpopulate(val, &s.OrganizationalData) + delete(rawMsg, key) + } + if err != nil { + return err + } + } + return nil +} + +// SecurityConnectorPropertiesOrganizationalData - The multi cloud account's organizational data +type SecurityConnectorPropertiesOrganizationalData struct { + // If the multi cloud account is of membership type organization, list of accounts excluded from offering + ExcludedAccountIDs []*string `json:"excludedAccountIds,omitempty"` + + // The multi cloud account's membership type in the organization + OrganizationMembershipType *OrganizationMembershipType `json:"organizationMembershipType,omitempty"` + + // If the multi cloud account is not of membership type organization, this will be the ID of the account's parent + ParentHierarchyID *string `json:"parentHierarchyId,omitempty"` + + // If the multi cloud account is of membership type organization, this will be the name of the onboarding stackset + StacksetName *string `json:"stacksetName,omitempty"` +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityConnectorPropertiesOrganizationalData. +func (s SecurityConnectorPropertiesOrganizationalData) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "excludedAccountIds", s.ExcludedAccountIDs) + populate(objectMap, "organizationMembershipType", s.OrganizationMembershipType) + populate(objectMap, "parentHierarchyId", s.ParentHierarchyID) + populate(objectMap, "stacksetName", s.StacksetName) + return json.Marshal(objectMap) +} + +// SecurityConnectorsCreateOrUpdateOptions contains the optional parameters for the SecurityConnectors.CreateOrUpdate method. +type SecurityConnectorsCreateOrUpdateOptions struct { + // placeholder for future optional parameters +} + +// SecurityConnectorsDeleteOptions contains the optional parameters for the SecurityConnectors.Delete method. +type SecurityConnectorsDeleteOptions struct { + // placeholder for future optional parameters +} + +// SecurityConnectorsGetOptions contains the optional parameters for the SecurityConnectors.Get method. +type SecurityConnectorsGetOptions struct { + // placeholder for future optional parameters +} + +// SecurityConnectorsList - List of security connectors response. +type SecurityConnectorsList struct { + // REQUIRED; The list of security connectors under the given scope. + Value []*SecurityConnector `json:"value,omitempty"` + + // READ-ONLY; The URI to fetch the next page. + NextLink *string `json:"nextLink,omitempty" azure:"ro"` +} + +// MarshalJSON implements the json.Marshaller interface for type SecurityConnectorsList. +func (s SecurityConnectorsList) MarshalJSON() ([]byte, error) { + objectMap := make(map[string]interface{}) + populate(objectMap, "nextLink", s.NextLink) + populate(objectMap, "value", s.Value) + return json.Marshal(objectMap) +} + +// SecurityConnectorsListByResourceGroupOptions contains the optional parameters for the SecurityConnectors.ListByResourceGroup method. +type SecurityConnectorsListByResourceGroupOptions struct { + // placeholder for future optional parameters +} + +// SecurityConnectorsListOptions contains the optional parameters for the SecurityConnectors.List method. +type SecurityConnectorsListOptions struct { + // placeholder for future optional parameters +} + +// SecurityConnectorsUpdateOptions contains the optional parameters for the SecurityConnectors.Update method. +type SecurityConnectorsUpdateOptions struct { + // placeholder for future optional parameters +} + // SecurityContact - Contact details for security issues type SecurityContact struct { Resource @@ -8044,7 +8606,7 @@ func (s SecuritySubAssessmentProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "remediation", s.Remediation) populate(objectMap, "resourceDetails", s.ResourceDetails) populate(objectMap, "status", s.Status) - populate(objectMap, "timeGenerated", (*timeRFC3339)(s.TimeGenerated)) + populateTimeRFC3339(objectMap, "timeGenerated", s.TimeGenerated) return json.Marshal(objectMap) } @@ -8085,9 +8647,7 @@ func (s *SecuritySubAssessmentProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Status) delete(rawMsg, key) case "timeGenerated": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.TimeGenerated = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.TimeGenerated) delete(rawMsg, key) } if err != nil { @@ -8224,8 +8784,8 @@ type SecurityTaskProperties struct { // MarshalJSON implements the json.Marshaller interface for type SecurityTaskProperties. func (s SecurityTaskProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTimeUtc", (*timeRFC3339)(s.CreationTimeUTC)) - populate(objectMap, "lastStateChangeTimeUtc", (*timeRFC3339)(s.LastStateChangeTimeUTC)) + populateTimeRFC3339(objectMap, "creationTimeUtc", s.CreationTimeUTC) + populateTimeRFC3339(objectMap, "lastStateChangeTimeUtc", s.LastStateChangeTimeUTC) populate(objectMap, "securityTaskParameters", s.SecurityTaskParameters) populate(objectMap, "state", s.State) populate(objectMap, "subState", s.SubState) @@ -8242,14 +8802,10 @@ func (s *SecurityTaskProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTimeUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreationTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreationTimeUTC) delete(rawMsg, key) case "lastStateChangeTimeUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastStateChangeTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastStateChangeTimeUTC) delete(rawMsg, key) case "securityTaskParameters": err = unpopulate(val, &s.SecurityTaskParameters) @@ -8395,7 +8951,7 @@ func (s ServerVulnerabilityProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "cve", s.Cve) populate(objectMap, "cvss", s.Cvss) populate(objectMap, "patchable", s.Patchable) - populate(objectMap, "publishedTime", (*timeRFC3339)(s.PublishedTime)) + populateTimeRFC3339(objectMap, "publishedTime", s.PublishedTime) populate(objectMap, "threat", s.Threat) populate(objectMap, "type", s.Type) populate(objectMap, "vendorReferences", s.VendorReferences) @@ -8421,9 +8977,7 @@ func (s *ServerVulnerabilityProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Patchable) delete(rawMsg, key) case "publishedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.PublishedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.PublishedTime) delete(rawMsg, key) case "threat": err = unpopulate(val, &s.Threat) @@ -8726,10 +9280,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -8745,9 +9299,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -8756,9 +9308,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) @@ -9107,7 +9657,7 @@ type TopologyResourceProperties struct { // MarshalJSON implements the json.Marshaller interface for type TopologyResourceProperties. func (t TopologyResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "calculatedDateTime", (*timeRFC3339)(t.CalculatedDateTime)) + populateTimeRFC3339(objectMap, "calculatedDateTime", t.CalculatedDateTime) populate(objectMap, "topologyResources", t.TopologyResources) return json.Marshal(objectMap) } @@ -9122,9 +9672,7 @@ func (t *TopologyResourceProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "calculatedDateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.CalculatedDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.CalculatedDateTime) delete(rawMsg, key) case "topologyResources": err = unpopulate(val, &t.TopologyResources) @@ -9495,6 +10043,16 @@ func populate(m map[string]interface{}, k string, v interface{}) { } } +func populateByteArray(m map[string]interface{}, k string, b []byte, f runtime.Base64Encoding) { + if azcore.IsNullValue(b) { + m[k] = nil + } else if len(b) == 0 { + return + } else { + m[k] = runtime.EncodeByteArray(b, f) + } +} + func unpopulate(data json.RawMessage, v interface{}) error { if data == nil { return nil diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_operations_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_operations_client.go index ca83cd291a68..271f5737af0d 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_operations_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armsecurity import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Exposes all available operations for discovery purposes. @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationList); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_pagers.go b/sdk/resourcemanager/security/armsecurity/zz_generated_pagers.go index 619bb40de8b5..61e81bc9116d 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_pagers.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armsecurity import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // AdaptiveNetworkHardeningsListByExtendedResourcePager provides operations for iterating over paged responses. @@ -2501,6 +2500,114 @@ func (p *SecureScoresListPager) PageResponse() SecureScoresListResponse { return p.current } +// SecurityConnectorsListByResourceGroupPager provides operations for iterating over paged responses. +type SecurityConnectorsListByResourceGroupPager struct { + client *SecurityConnectorsClient + current SecurityConnectorsListByResourceGroupResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, SecurityConnectorsListByResourceGroupResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *SecurityConnectorsListByResourceGroupPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *SecurityConnectorsListByResourceGroupPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.SecurityConnectorsList.NextLink == nil || len(*p.current.SecurityConnectorsList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listByResourceGroupHandleError(resp) + return false + } + result, err := p.client.listByResourceGroupHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current SecurityConnectorsListByResourceGroupResponse page. +func (p *SecurityConnectorsListByResourceGroupPager) PageResponse() SecurityConnectorsListByResourceGroupResponse { + return p.current +} + +// SecurityConnectorsListPager provides operations for iterating over paged responses. +type SecurityConnectorsListPager struct { + client *SecurityConnectorsClient + current SecurityConnectorsListResponse + err error + requester func(context.Context) (*policy.Request, error) + advancer func(context.Context, SecurityConnectorsListResponse) (*policy.Request, error) +} + +// Err returns the last error encountered while paging. +func (p *SecurityConnectorsListPager) Err() error { + return p.err +} + +// NextPage returns true if the pager advanced to the next page. +// Returns false if there are no more pages or an error occurred. +func (p *SecurityConnectorsListPager) NextPage(ctx context.Context) bool { + var req *policy.Request + var err error + if !reflect.ValueOf(p.current).IsZero() { + if p.current.SecurityConnectorsList.NextLink == nil || len(*p.current.SecurityConnectorsList.NextLink) == 0 { + return false + } + req, err = p.advancer(ctx, p.current) + } else { + req, err = p.requester(ctx) + } + if err != nil { + p.err = err + return false + } + resp, err := p.client.pl.Do(req) + if err != nil { + p.err = err + return false + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + p.err = p.client.listHandleError(resp) + return false + } + result, err := p.client.listHandleResponse(resp) + if err != nil { + p.err = err + return false + } + p.current = result + return true +} + +// PageResponse returns the current SecurityConnectorsListResponse page. +func (p *SecurityConnectorsListPager) PageResponse() SecurityConnectorsListResponse { + return p.current +} + // SecurityContactsListPager provides operations for iterating over paged responses. type SecurityContactsListPager struct { client *SecurityContactsClient diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_pollers.go b/sdk/resourcemanager/security/armsecurity/zz_generated_pollers.go index d1ec39d48e33..0cf5170aaa9c 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_pollers.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armsecurity import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // AdaptiveNetworkHardeningsEnforcePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/security/armsecurity/zz_generated_polymorphic_helpers.go index c3641da2cb35..94165698dbcc 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_polymorphic_helpers.go @@ -51,6 +51,25 @@ func unmarshalAdditionalDataClassificationArray(rawMsg json.RawMessage) ([]Addit return fArray, nil } +func unmarshalAdditionalDataClassificationMap(rawMsg json.RawMessage) (map[string]AdditionalDataClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]AdditionalDataClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalAdditionalDataClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalAlertSimulatorRequestPropertiesClassification(rawMsg json.RawMessage) (AlertSimulatorRequestPropertiesClassification, error) { if rawMsg == nil { return nil, nil @@ -88,6 +107,25 @@ func unmarshalAlertSimulatorRequestPropertiesClassificationArray(rawMsg json.Raw return fArray, nil } +func unmarshalAlertSimulatorRequestPropertiesClassificationMap(rawMsg json.RawMessage) (map[string]AlertSimulatorRequestPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]AlertSimulatorRequestPropertiesClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalAlertSimulatorRequestPropertiesClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalAllowlistCustomAlertRuleClassification(rawMsg json.RawMessage) (AllowlistCustomAlertRuleClassification, error) { if rawMsg == nil { return nil, nil @@ -131,6 +169,25 @@ func unmarshalAllowlistCustomAlertRuleClassificationArray(rawMsg json.RawMessage return fArray, nil } +func unmarshalAllowlistCustomAlertRuleClassificationMap(rawMsg json.RawMessage) (map[string]AllowlistCustomAlertRuleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]AllowlistCustomAlertRuleClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalAllowlistCustomAlertRuleClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalAuthenticationDetailsPropertiesClassification(rawMsg json.RawMessage) (AuthenticationDetailsPropertiesClassification, error) { if rawMsg == nil { return nil, nil @@ -172,6 +229,25 @@ func unmarshalAuthenticationDetailsPropertiesClassificationArray(rawMsg json.Raw return fArray, nil } +func unmarshalAuthenticationDetailsPropertiesClassificationMap(rawMsg json.RawMessage) (map[string]AuthenticationDetailsPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]AuthenticationDetailsPropertiesClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalAuthenticationDetailsPropertiesClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalAutomationActionClassification(rawMsg json.RawMessage) (AutomationActionClassification, error) { if rawMsg == nil { return nil, nil @@ -213,6 +289,85 @@ func unmarshalAutomationActionClassificationArray(rawMsg json.RawMessage) ([]Aut return fArray, nil } +func unmarshalAutomationActionClassificationMap(rawMsg json.RawMessage) (map[string]AutomationActionClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]AutomationActionClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalAutomationActionClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + +func unmarshalCloudOfferingClassification(rawMsg json.RawMessage) (CloudOfferingClassification, error) { + if rawMsg == nil { + return nil, nil + } + var m map[string]interface{} + if err := json.Unmarshal(rawMsg, &m); err != nil { + return nil, err + } + var b CloudOfferingClassification + switch m["offeringType"] { + case string(OfferingTypeCspmMonitorAws): + b = &CspmMonitorAwsOffering{} + case string(OfferingTypeDefenderForContainersAws): + b = &DefenderForContainersAwsOffering{} + case "DefenderForServersAWS": + b = &DefenderForServersAwsOffering{} + default: + b = &CloudOffering{} + } + return b, json.Unmarshal(rawMsg, b) +} + +func unmarshalCloudOfferingClassificationArray(rawMsg json.RawMessage) ([]CloudOfferingClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages []json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fArray := make([]CloudOfferingClassification, len(rawMessages)) + for index, rawMessage := range rawMessages { + f, err := unmarshalCloudOfferingClassification(rawMessage) + if err != nil { + return nil, err + } + fArray[index] = f + } + return fArray, nil +} + +func unmarshalCloudOfferingClassificationMap(rawMsg json.RawMessage) (map[string]CloudOfferingClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]CloudOfferingClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalCloudOfferingClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalCustomAlertRuleClassification(rawMsg json.RawMessage) (CustomAlertRuleClassification, error) { if rawMsg == nil { return nil, nil @@ -298,6 +453,25 @@ func unmarshalCustomAlertRuleClassificationArray(rawMsg json.RawMessage) ([]Cust return fArray, nil } +func unmarshalCustomAlertRuleClassificationMap(rawMsg json.RawMessage) (map[string]CustomAlertRuleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]CustomAlertRuleClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalCustomAlertRuleClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalListCustomAlertRuleClassification(rawMsg json.RawMessage) (ListCustomAlertRuleClassification, error) { if rawMsg == nil { return nil, nil @@ -345,6 +519,25 @@ func unmarshalListCustomAlertRuleClassificationArray(rawMsg json.RawMessage) ([] return fArray, nil } +func unmarshalListCustomAlertRuleClassificationMap(rawMsg json.RawMessage) (map[string]ListCustomAlertRuleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ListCustomAlertRuleClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalListCustomAlertRuleClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalResourceDetailsClassification(rawMsg json.RawMessage) (ResourceDetailsClassification, error) { if rawMsg == nil { return nil, nil @@ -380,6 +573,25 @@ func unmarshalResourceDetailsClassificationArray(rawMsg json.RawMessage) ([]Reso return fArray, nil } +func unmarshalResourceDetailsClassificationMap(rawMsg json.RawMessage) (map[string]ResourceDetailsClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ResourceDetailsClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalResourceDetailsClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalResourceIdentifierClassification(rawMsg json.RawMessage) (ResourceIdentifierClassification, error) { if rawMsg == nil { return nil, nil @@ -419,6 +631,25 @@ func unmarshalResourceIdentifierClassificationArray(rawMsg json.RawMessage) ([]R return fArray, nil } +func unmarshalResourceIdentifierClassificationMap(rawMsg json.RawMessage) (map[string]ResourceIdentifierClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ResourceIdentifierClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalResourceIdentifierClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalSettingClassification(rawMsg json.RawMessage) (SettingClassification, error) { if rawMsg == nil { return nil, nil @@ -458,6 +689,25 @@ func unmarshalSettingClassificationArray(rawMsg json.RawMessage) ([]SettingClass return fArray, nil } +func unmarshalSettingClassificationMap(rawMsg json.RawMessage) (map[string]SettingClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]SettingClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalSettingClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalThresholdCustomAlertRuleClassification(rawMsg json.RawMessage) (ThresholdCustomAlertRuleClassification, error) { if rawMsg == nil { return nil, nil @@ -527,6 +777,25 @@ func unmarshalThresholdCustomAlertRuleClassificationArray(rawMsg json.RawMessage return fArray, nil } +func unmarshalThresholdCustomAlertRuleClassificationMap(rawMsg json.RawMessage) (map[string]ThresholdCustomAlertRuleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ThresholdCustomAlertRuleClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalThresholdCustomAlertRuleClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalTimeWindowCustomAlertRuleClassification(rawMsg json.RawMessage) (TimeWindowCustomAlertRuleClassification, error) { if rawMsg == nil { return nil, nil @@ -593,3 +862,22 @@ func unmarshalTimeWindowCustomAlertRuleClassificationArray(rawMsg json.RawMessag } return fArray, nil } + +func unmarshalTimeWindowCustomAlertRuleClassificationMap(rawMsg json.RawMessage) (map[string]TimeWindowCustomAlertRuleClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]TimeWindowCustomAlertRuleClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalTimeWindowCustomAlertRuleClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_pricings_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_pricings_client.go index a997801385fd..0301a989be26 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_pricings_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_pricings_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PricingsClient contains the methods for the Pricings group. @@ -30,8 +31,15 @@ type PricingsClient struct { } // NewPricingsClient creates a new instance of PricingsClient with the specified values. -func NewPricingsClient(con *arm.Connection, subscriptionID string) *PricingsClient { - return &PricingsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPricingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PricingsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PricingsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a provided Security Center pricing configuration in the subscription. @@ -77,7 +85,7 @@ func (client *PricingsClient) getCreateRequest(ctx context.Context, pricingName func (client *PricingsClient) getHandleResponse(resp *http.Response) (PricingsGetResponse, error) { result := PricingsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Pricing); err != nil { - return PricingsGetResponse{}, err + return PricingsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -134,7 +142,7 @@ func (client *PricingsClient) listCreateRequest(ctx context.Context, options *Pr func (client *PricingsClient) listHandleResponse(resp *http.Response) (PricingsListResponse, error) { result := PricingsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PricingList); err != nil { - return PricingsListResponse{}, err + return PricingsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -195,7 +203,7 @@ func (client *PricingsClient) updateCreateRequest(ctx context.Context, pricingNa func (client *PricingsClient) updateHandleResponse(resp *http.Response) (PricingsUpdateResponse, error) { result := PricingsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Pricing); err != nil { - return PricingsUpdateResponse{}, err + return PricingsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycomplianceassessments_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycomplianceassessments_client.go index 2f2d7455e06c..4ce778e48279 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycomplianceassessments_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycomplianceassessments_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RegulatoryComplianceAssessmentsClient contains the methods for the RegulatoryComplianceAssessments group. @@ -30,8 +31,15 @@ type RegulatoryComplianceAssessmentsClient struct { } // NewRegulatoryComplianceAssessmentsClient creates a new instance of RegulatoryComplianceAssessmentsClient with the specified values. -func NewRegulatoryComplianceAssessmentsClient(con *arm.Connection, subscriptionID string) *RegulatoryComplianceAssessmentsClient { - return &RegulatoryComplianceAssessmentsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRegulatoryComplianceAssessmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RegulatoryComplianceAssessmentsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RegulatoryComplianceAssessmentsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Supported regulatory compliance details and state for selected assessment @@ -85,7 +93,7 @@ func (client *RegulatoryComplianceAssessmentsClient) getCreateRequest(ctx contex func (client *RegulatoryComplianceAssessmentsClient) getHandleResponse(resp *http.Response) (RegulatoryComplianceAssessmentsGetResponse, error) { result := RegulatoryComplianceAssessmentsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RegulatoryComplianceAssessment); err != nil { - return RegulatoryComplianceAssessmentsGetResponse{}, err + return RegulatoryComplianceAssessmentsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -150,7 +158,7 @@ func (client *RegulatoryComplianceAssessmentsClient) listCreateRequest(ctx conte func (client *RegulatoryComplianceAssessmentsClient) listHandleResponse(resp *http.Response) (RegulatoryComplianceAssessmentsListResponse, error) { result := RegulatoryComplianceAssessmentsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RegulatoryComplianceAssessmentList); err != nil { - return RegulatoryComplianceAssessmentsListResponse{}, err + return RegulatoryComplianceAssessmentsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycompliancecontrols_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycompliancecontrols_client.go index a3ccc914765c..17ce8e99ed48 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycompliancecontrols_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycompliancecontrols_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RegulatoryComplianceControlsClient contains the methods for the RegulatoryComplianceControls group. @@ -30,8 +31,15 @@ type RegulatoryComplianceControlsClient struct { } // NewRegulatoryComplianceControlsClient creates a new instance of RegulatoryComplianceControlsClient with the specified values. -func NewRegulatoryComplianceControlsClient(con *arm.Connection, subscriptionID string) *RegulatoryComplianceControlsClient { - return &RegulatoryComplianceControlsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRegulatoryComplianceControlsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RegulatoryComplianceControlsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RegulatoryComplianceControlsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Selected regulatory compliance control details and state @@ -81,7 +89,7 @@ func (client *RegulatoryComplianceControlsClient) getCreateRequest(ctx context.C func (client *RegulatoryComplianceControlsClient) getHandleResponse(resp *http.Response) (RegulatoryComplianceControlsGetResponse, error) { result := RegulatoryComplianceControlsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RegulatoryComplianceControl); err != nil { - return RegulatoryComplianceControlsGetResponse{}, err + return RegulatoryComplianceControlsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -142,7 +150,7 @@ func (client *RegulatoryComplianceControlsClient) listCreateRequest(ctx context. func (client *RegulatoryComplianceControlsClient) listHandleResponse(resp *http.Response) (RegulatoryComplianceControlsListResponse, error) { result := RegulatoryComplianceControlsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RegulatoryComplianceControlList); err != nil { - return RegulatoryComplianceControlsListResponse{}, err + return RegulatoryComplianceControlsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycompliancestandards_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycompliancestandards_client.go index 70df846f5cc7..c6929c18c02c 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycompliancestandards_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_regulatorycompliancestandards_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RegulatoryComplianceStandardsClient contains the methods for the RegulatoryComplianceStandards group. @@ -30,8 +31,15 @@ type RegulatoryComplianceStandardsClient struct { } // NewRegulatoryComplianceStandardsClient creates a new instance of RegulatoryComplianceStandardsClient with the specified values. -func NewRegulatoryComplianceStandardsClient(con *arm.Connection, subscriptionID string) *RegulatoryComplianceStandardsClient { - return &RegulatoryComplianceStandardsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRegulatoryComplianceStandardsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RegulatoryComplianceStandardsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RegulatoryComplianceStandardsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Supported regulatory compliance details state for selected standard @@ -77,7 +85,7 @@ func (client *RegulatoryComplianceStandardsClient) getCreateRequest(ctx context. func (client *RegulatoryComplianceStandardsClient) getHandleResponse(resp *http.Response) (RegulatoryComplianceStandardsGetResponse, error) { result := RegulatoryComplianceStandardsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RegulatoryComplianceStandard); err != nil { - return RegulatoryComplianceStandardsGetResponse{}, err + return RegulatoryComplianceStandardsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -134,7 +142,7 @@ func (client *RegulatoryComplianceStandardsClient) listCreateRequest(ctx context func (client *RegulatoryComplianceStandardsClient) listHandleResponse(resp *http.Response) (RegulatoryComplianceStandardsListResponse, error) { result := RegulatoryComplianceStandardsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RegulatoryComplianceStandardList); err != nil { - return RegulatoryComplianceStandardsListResponse{}, err + return RegulatoryComplianceStandardsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_response_types.go b/sdk/resourcemanager/security/armsecurity/zz_generated_response_types.go index 4f7d8b8fd5a4..23b52165a20b 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_response_types.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armsecurity import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // AdaptiveApplicationControlsDeleteResponse contains the response from method AdaptiveApplicationControls.Delete. @@ -68,6 +67,8 @@ type AdaptiveNetworkHardeningsEnforcePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AdaptiveNetworkHardeningsEnforcePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AdaptiveNetworkHardeningsEnforceResponse, error) { respType := AdaptiveNetworkHardeningsEnforceResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -232,6 +233,8 @@ type AlertsSimulatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AlertsSimulatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AlertsSimulateResponse, error) { respType := AlertsSimulateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1262,6 +1265,30 @@ type LocationsListResult struct { AscLocationList } +// MdeOnboardingsGetResponse contains the response from method MdeOnboardings.Get. +type MdeOnboardingsGetResponse struct { + MdeOnboardingsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MdeOnboardingsGetResult contains the result from method MdeOnboardings.Get. +type MdeOnboardingsGetResult struct { + MdeOnboardingData +} + +// MdeOnboardingsListResponse contains the response from method MdeOnboardings.List. +type MdeOnboardingsListResponse struct { + MdeOnboardingsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// MdeOnboardingsListResult contains the result from method MdeOnboardings.List. +type MdeOnboardingsListResult struct { + MdeOnboardingDataList +} + // OperationsListResponse contains the response from method Operations.List. type OperationsListResponse struct { OperationsListResult @@ -1556,6 +1583,72 @@ type SecureScoresListResult struct { SecureScoresList } +// SecurityConnectorsCreateOrUpdateResponse contains the response from method SecurityConnectors.CreateOrUpdate. +type SecurityConnectorsCreateOrUpdateResponse struct { + SecurityConnectorsCreateOrUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SecurityConnectorsCreateOrUpdateResult contains the result from method SecurityConnectors.CreateOrUpdate. +type SecurityConnectorsCreateOrUpdateResult struct { + SecurityConnector +} + +// SecurityConnectorsDeleteResponse contains the response from method SecurityConnectors.Delete. +type SecurityConnectorsDeleteResponse struct { + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SecurityConnectorsGetResponse contains the response from method SecurityConnectors.Get. +type SecurityConnectorsGetResponse struct { + SecurityConnectorsGetResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SecurityConnectorsGetResult contains the result from method SecurityConnectors.Get. +type SecurityConnectorsGetResult struct { + SecurityConnector +} + +// SecurityConnectorsListByResourceGroupResponse contains the response from method SecurityConnectors.ListByResourceGroup. +type SecurityConnectorsListByResourceGroupResponse struct { + SecurityConnectorsListByResourceGroupResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SecurityConnectorsListByResourceGroupResult contains the result from method SecurityConnectors.ListByResourceGroup. +type SecurityConnectorsListByResourceGroupResult struct { + SecurityConnectorsList +} + +// SecurityConnectorsListResponse contains the response from method SecurityConnectors.List. +type SecurityConnectorsListResponse struct { + SecurityConnectorsListResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SecurityConnectorsListResult contains the result from method SecurityConnectors.List. +type SecurityConnectorsListResult struct { + SecurityConnectorsList +} + +// SecurityConnectorsUpdateResponse contains the response from method SecurityConnectors.Update. +type SecurityConnectorsUpdateResponse struct { + SecurityConnectorsUpdateResult + // RawResponse contains the underlying HTTP response. + RawResponse *http.Response +} + +// SecurityConnectorsUpdateResult contains the result from method SecurityConnectors.Update. +type SecurityConnectorsUpdateResult struct { + SecurityConnector +} + // SecurityContactsCreateResponse contains the response from method SecurityContacts.Create. type SecurityContactsCreateResponse struct { SecurityContactsCreateResult @@ -1680,6 +1773,8 @@ type ServerVulnerabilityAssessmentDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerVulnerabilityAssessmentDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerVulnerabilityAssessmentDeleteResponse, error) { respType := ServerVulnerabilityAssessmentDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_securescorecontroldefinitions_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_securescorecontroldefinitions_client.go index 723c1f788e61..39d21b755e02 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_securescorecontroldefinitions_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_securescorecontroldefinitions_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SecureScoreControlDefinitionsClient contains the methods for the SecureScoreControlDefinitions group. @@ -30,8 +31,15 @@ type SecureScoreControlDefinitionsClient struct { } // NewSecureScoreControlDefinitionsClient creates a new instance of SecureScoreControlDefinitionsClient with the specified values. -func NewSecureScoreControlDefinitionsClient(con *arm.Connection, subscriptionID string) *SecureScoreControlDefinitionsClient { - return &SecureScoreControlDefinitionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSecureScoreControlDefinitionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SecureScoreControlDefinitionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SecureScoreControlDefinitionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - List the available security controls, their assessments, and the max score @@ -66,7 +74,7 @@ func (client *SecureScoreControlDefinitionsClient) listCreateRequest(ctx context func (client *SecureScoreControlDefinitionsClient) listHandleResponse(resp *http.Response) (SecureScoreControlDefinitionsListResponse, error) { result := SecureScoreControlDefinitionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecureScoreControlDefinitionList); err != nil { - return SecureScoreControlDefinitionsListResponse{}, err + return SecureScoreControlDefinitionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -120,7 +128,7 @@ func (client *SecureScoreControlDefinitionsClient) listBySubscriptionCreateReque func (client *SecureScoreControlDefinitionsClient) listBySubscriptionHandleResponse(resp *http.Response) (SecureScoreControlDefinitionsListBySubscriptionResponse, error) { result := SecureScoreControlDefinitionsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecureScoreControlDefinitionList); err != nil { - return SecureScoreControlDefinitionsListBySubscriptionResponse{}, err + return SecureScoreControlDefinitionsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_securescorecontrols_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_securescorecontrols_client.go index 4d6e67579671..0d19be4a388c 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_securescorecontrols_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_securescorecontrols_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SecureScoreControlsClient contains the methods for the SecureScoreControls group. @@ -30,8 +31,15 @@ type SecureScoreControlsClient struct { } // NewSecureScoreControlsClient creates a new instance of SecureScoreControlsClient with the specified values. -func NewSecureScoreControlsClient(con *arm.Connection, subscriptionID string) *SecureScoreControlsClient { - return &SecureScoreControlsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSecureScoreControlsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SecureScoreControlsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SecureScoreControlsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Get all security controls within a scope @@ -73,7 +81,7 @@ func (client *SecureScoreControlsClient) listCreateRequest(ctx context.Context, func (client *SecureScoreControlsClient) listHandleResponse(resp *http.Response) (SecureScoreControlsListResponse, error) { result := SecureScoreControlsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecureScoreControlList); err != nil { - return SecureScoreControlsListResponse{}, err + return SecureScoreControlsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -134,7 +142,7 @@ func (client *SecureScoreControlsClient) listBySecureScoreCreateRequest(ctx cont func (client *SecureScoreControlsClient) listBySecureScoreHandleResponse(resp *http.Response) (SecureScoreControlsListBySecureScoreResponse, error) { result := SecureScoreControlsListBySecureScoreResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecureScoreControlList); err != nil { - return SecureScoreControlsListBySecureScoreResponse{}, err + return SecureScoreControlsListBySecureScoreResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_securescores_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_securescores_client.go index b6c8b03f47fe..f67c423be2e8 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_securescores_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_securescores_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SecureScoresClient contains the methods for the SecureScores group. @@ -30,8 +31,15 @@ type SecureScoresClient struct { } // NewSecureScoresClient creates a new instance of SecureScoresClient with the specified values. -func NewSecureScoresClient(con *arm.Connection, subscriptionID string) *SecureScoresClient { - return &SecureScoresClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSecureScoresClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SecureScoresClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SecureScoresClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get secure score for a specific Security Center initiative within your current scope. For the ASC Default initiative, use 'ascScore'. @@ -77,7 +85,7 @@ func (client *SecureScoresClient) getCreateRequest(ctx context.Context, secureSc func (client *SecureScoresClient) getHandleResponse(resp *http.Response) (SecureScoresGetResponse, error) { result := SecureScoresGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecureScoreItem); err != nil { - return SecureScoresGetResponse{}, err + return SecureScoresGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -131,7 +139,7 @@ func (client *SecureScoresClient) listCreateRequest(ctx context.Context, options func (client *SecureScoresClient) listHandleResponse(resp *http.Response) (SecureScoresListResponse, error) { result := SecureScoresListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecureScoresList); err != nil { - return SecureScoresListResponse{}, err + return SecureScoresListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_securityconnectors_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_securityconnectors_client.go new file mode 100644 index 000000000000..6ac33fdc8bad --- /dev/null +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_securityconnectors_client.go @@ -0,0 +1,409 @@ +//go:build go1.16 +// +build go1.16 + +// 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. + +package armsecurity + +import ( + "context" + "errors" + "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" +) + +// SecurityConnectorsClient contains the methods for the SecurityConnectors group. +// Don't use this type directly, use NewSecurityConnectorsClient() instead. +type SecurityConnectorsClient struct { + ep string + pl runtime.Pipeline + subscriptionID string +} + +// NewSecurityConnectorsClient creates a new instance of SecurityConnectorsClient with the specified values. +func NewSecurityConnectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SecurityConnectorsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SecurityConnectorsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} +} + +// CreateOrUpdate - Creates or updates a security connector. If a security connector is already created and a subsequent request is issued for the same +// security connector id, then it will be updated. +// If the operation fails it returns the *CloudError error type. +func (client *SecurityConnectorsClient) CreateOrUpdate(ctx context.Context, resourceGroupName string, securityConnectorName string, securityConnector SecurityConnector, options *SecurityConnectorsCreateOrUpdateOptions) (SecurityConnectorsCreateOrUpdateResponse, error) { + req, err := client.createOrUpdateCreateRequest(ctx, resourceGroupName, securityConnectorName, securityConnector, options) + if err != nil { + return SecurityConnectorsCreateOrUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SecurityConnectorsCreateOrUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusCreated) { + return SecurityConnectorsCreateOrUpdateResponse{}, client.createOrUpdateHandleError(resp) + } + return client.createOrUpdateHandleResponse(resp) +} + +// createOrUpdateCreateRequest creates the CreateOrUpdate request. +func (client *SecurityConnectorsClient) createOrUpdateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, securityConnector SecurityConnector, options *SecurityConnectorsCreateOrUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if securityConnectorName == "" { + return nil, errors.New("parameter securityConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) + req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, securityConnector) +} + +// createOrUpdateHandleResponse handles the CreateOrUpdate response. +func (client *SecurityConnectorsClient) createOrUpdateHandleResponse(resp *http.Response) (SecurityConnectorsCreateOrUpdateResponse, error) { + result := SecurityConnectorsCreateOrUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityConnector); err != nil { + return SecurityConnectorsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// createOrUpdateHandleError handles the CreateOrUpdate error response. +func (client *SecurityConnectorsClient) createOrUpdateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType.InnerError); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Delete - Deletes a security connector. +// If the operation fails it returns the *CloudError error type. +func (client *SecurityConnectorsClient) Delete(ctx context.Context, resourceGroupName string, securityConnectorName string, options *SecurityConnectorsDeleteOptions) (SecurityConnectorsDeleteResponse, error) { + req, err := client.deleteCreateRequest(ctx, resourceGroupName, securityConnectorName, options) + if err != nil { + return SecurityConnectorsDeleteResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SecurityConnectorsDeleteResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK, http.StatusNoContent) { + return SecurityConnectorsDeleteResponse{}, client.deleteHandleError(resp) + } + return SecurityConnectorsDeleteResponse{RawResponse: resp}, nil +} + +// deleteCreateRequest creates the Delete request. +func (client *SecurityConnectorsClient) deleteCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *SecurityConnectorsDeleteOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if securityConnectorName == "" { + return nil, errors.New("parameter securityConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) + req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// deleteHandleError handles the Delete error response. +func (client *SecurityConnectorsClient) deleteHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType.InnerError); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Get - Retrieves details of a specific security connector +// If the operation fails it returns the *CloudError error type. +func (client *SecurityConnectorsClient) Get(ctx context.Context, resourceGroupName string, securityConnectorName string, options *SecurityConnectorsGetOptions) (SecurityConnectorsGetResponse, error) { + req, err := client.getCreateRequest(ctx, resourceGroupName, securityConnectorName, options) + if err != nil { + return SecurityConnectorsGetResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SecurityConnectorsGetResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SecurityConnectorsGetResponse{}, client.getHandleError(resp) + } + return client.getHandleResponse(resp) +} + +// getCreateRequest creates the Get request. +func (client *SecurityConnectorsClient) getCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, options *SecurityConnectorsGetOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if securityConnectorName == "" { + return nil, errors.New("parameter securityConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// getHandleResponse handles the Get response. +func (client *SecurityConnectorsClient) getHandleResponse(resp *http.Response) (SecurityConnectorsGetResponse, error) { + result := SecurityConnectorsGetResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityConnector); err != nil { + return SecurityConnectorsGetResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// getHandleError handles the Get error response. +func (client *SecurityConnectorsClient) getHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType.InnerError); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// List - Lists all the security connectors in the specified subscription. Use the 'nextLink' property in the response to get the next page of security +// connectors for the specified subscription. +// If the operation fails it returns the *CloudError error type. +func (client *SecurityConnectorsClient) List(options *SecurityConnectorsListOptions) *SecurityConnectorsListPager { + return &SecurityConnectorsListPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listCreateRequest(ctx, options) + }, + advancer: func(ctx context.Context, resp SecurityConnectorsListResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.SecurityConnectorsList.NextLink) + }, + } +} + +// listCreateRequest creates the List request. +func (client *SecurityConnectorsClient) listCreateRequest(ctx context.Context, options *SecurityConnectorsListOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/providers/Microsoft.Security/securityConnectors" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listHandleResponse handles the List response. +func (client *SecurityConnectorsClient) listHandleResponse(resp *http.Response) (SecurityConnectorsListResponse, error) { + result := SecurityConnectorsListResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityConnectorsList); err != nil { + return SecurityConnectorsListResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listHandleError handles the List error response. +func (client *SecurityConnectorsClient) listHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType.InnerError); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// ListByResourceGroup - Lists all the security connectors in the specified resource group. Use the 'nextLink' property in the response to get the next +// page of security connectors for the specified resource group. +// If the operation fails it returns the *CloudError error type. +func (client *SecurityConnectorsClient) ListByResourceGroup(resourceGroupName string, options *SecurityConnectorsListByResourceGroupOptions) *SecurityConnectorsListByResourceGroupPager { + return &SecurityConnectorsListByResourceGroupPager{ + client: client, + requester: func(ctx context.Context) (*policy.Request, error) { + return client.listByResourceGroupCreateRequest(ctx, resourceGroupName, options) + }, + advancer: func(ctx context.Context, resp SecurityConnectorsListByResourceGroupResponse) (*policy.Request, error) { + return runtime.NewRequest(ctx, http.MethodGet, *resp.SecurityConnectorsList.NextLink) + }, + } +} + +// listByResourceGroupCreateRequest creates the ListByResourceGroup request. +func (client *SecurityConnectorsClient) listByResourceGroupCreateRequest(ctx context.Context, resourceGroupName string, options *SecurityConnectorsListByResourceGroupOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, nil +} + +// listByResourceGroupHandleResponse handles the ListByResourceGroup response. +func (client *SecurityConnectorsClient) listByResourceGroupHandleResponse(resp *http.Response) (SecurityConnectorsListByResourceGroupResponse, error) { + result := SecurityConnectorsListByResourceGroupResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityConnectorsList); err != nil { + return SecurityConnectorsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// listByResourceGroupHandleError handles the ListByResourceGroup error response. +func (client *SecurityConnectorsClient) listByResourceGroupHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType.InnerError); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} + +// Update - Updates a security connector +// If the operation fails it returns the *CloudError error type. +func (client *SecurityConnectorsClient) Update(ctx context.Context, resourceGroupName string, securityConnectorName string, securityConnector SecurityConnector, options *SecurityConnectorsUpdateOptions) (SecurityConnectorsUpdateResponse, error) { + req, err := client.updateCreateRequest(ctx, resourceGroupName, securityConnectorName, securityConnector, options) + if err != nil { + return SecurityConnectorsUpdateResponse{}, err + } + resp, err := client.pl.Do(req) + if err != nil { + return SecurityConnectorsUpdateResponse{}, err + } + if !runtime.HasStatusCode(resp, http.StatusOK) { + return SecurityConnectorsUpdateResponse{}, client.updateHandleError(resp) + } + return client.updateHandleResponse(resp) +} + +// updateCreateRequest creates the Update request. +func (client *SecurityConnectorsClient) updateCreateRequest(ctx context.Context, resourceGroupName string, securityConnectorName string, securityConnector SecurityConnector, options *SecurityConnectorsUpdateOptions) (*policy.Request, error) { + urlPath := "/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.Security/securityConnectors/{securityConnectorName}" + if client.subscriptionID == "" { + return nil, errors.New("parameter client.subscriptionID cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{subscriptionId}", url.PathEscape(client.subscriptionID)) + if resourceGroupName == "" { + return nil, errors.New("parameter resourceGroupName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{resourceGroupName}", url.PathEscape(resourceGroupName)) + if securityConnectorName == "" { + return nil, errors.New("parameter securityConnectorName cannot be empty") + } + urlPath = strings.ReplaceAll(urlPath, "{securityConnectorName}", url.PathEscape(securityConnectorName)) + req, err := runtime.NewRequest(ctx, http.MethodPatch, runtime.JoinPaths(client.ep, urlPath)) + if err != nil { + return nil, err + } + reqQP := req.Raw().URL.Query() + reqQP.Set("api-version", "2021-07-01-preview") + req.Raw().URL.RawQuery = reqQP.Encode() + req.Raw().Header.Set("Accept", "application/json") + return req, runtime.MarshalAsJSON(req, securityConnector) +} + +// updateHandleResponse handles the Update response. +func (client *SecurityConnectorsClient) updateHandleResponse(resp *http.Response) (SecurityConnectorsUpdateResponse, error) { + result := SecurityConnectorsUpdateResponse{RawResponse: resp} + if err := runtime.UnmarshalAsJSON(resp, &result.SecurityConnector); err != nil { + return SecurityConnectorsUpdateResponse{}, runtime.NewResponseError(err, resp) + } + return result, nil +} + +// updateHandleError handles the Update error response. +func (client *SecurityConnectorsClient) updateHandleError(resp *http.Response) error { + body, err := runtime.Payload(resp) + if err != nil { + return runtime.NewResponseError(err, resp) + } + errType := CloudError{raw: string(body)} + if err := runtime.UnmarshalAsJSON(resp, &errType.InnerError); err != nil { + return runtime.NewResponseError(fmt.Errorf("%s\n%s", string(body), err), resp) + } + return runtime.NewResponseError(&errType, resp) +} diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_securitycontacts_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_securitycontacts_client.go index 8a4281285c25..5b8e5b0e62e9 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_securitycontacts_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_securitycontacts_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SecurityContactsClient contains the methods for the SecurityContacts group. @@ -30,8 +31,15 @@ type SecurityContactsClient struct { } // NewSecurityContactsClient creates a new instance of SecurityContactsClient with the specified values. -func NewSecurityContactsClient(con *arm.Connection, subscriptionID string) *SecurityContactsClient { - return &SecurityContactsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSecurityContactsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SecurityContactsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SecurityContactsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Security contact configurations for the subscription @@ -77,7 +85,7 @@ func (client *SecurityContactsClient) createCreateRequest(ctx context.Context, s func (client *SecurityContactsClient) createHandleResponse(resp *http.Response) (SecurityContactsCreateResponse, error) { result := SecurityContactsCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityContact); err != nil { - return SecurityContactsCreateResponse{}, err + return SecurityContactsCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -190,7 +198,7 @@ func (client *SecurityContactsClient) getCreateRequest(ctx context.Context, secu func (client *SecurityContactsClient) getHandleResponse(resp *http.Response) (SecurityContactsGetResponse, error) { result := SecurityContactsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityContact); err != nil { - return SecurityContactsGetResponse{}, err + return SecurityContactsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -244,7 +252,7 @@ func (client *SecurityContactsClient) listCreateRequest(ctx context.Context, opt func (client *SecurityContactsClient) listHandleResponse(resp *http.Response) (SecurityContactsListResponse, error) { result := SecurityContactsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityContactList); err != nil { - return SecurityContactsListResponse{}, err + return SecurityContactsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -305,7 +313,7 @@ func (client *SecurityContactsClient) updateCreateRequest(ctx context.Context, s func (client *SecurityContactsClient) updateHandleResponse(resp *http.Response) (SecurityContactsUpdateResponse, error) { result := SecurityContactsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityContact); err != nil { - return SecurityContactsUpdateResponse{}, err + return SecurityContactsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_securitysolutions_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_securitysolutions_client.go index 338723ea6aea..ff119c928709 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_securitysolutions_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_securitysolutions_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SecuritySolutionsClient contains the methods for the SecuritySolutions group. @@ -31,8 +32,15 @@ type SecuritySolutionsClient struct { } // NewSecuritySolutionsClient creates a new instance of SecuritySolutionsClient with the specified values. -func NewSecuritySolutionsClient(con *arm.Connection, subscriptionID string, ascLocation string) *SecuritySolutionsClient { - return &SecuritySolutionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID, ascLocation: ascLocation} +func NewSecuritySolutionsClient(subscriptionID string, ascLocation string, credential azcore.TokenCredential, options *arm.ClientOptions) *SecuritySolutionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SecuritySolutionsClient{subscriptionID: subscriptionID, ascLocation: ascLocation, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a specific Security Solution. @@ -86,7 +94,7 @@ func (client *SecuritySolutionsClient) getCreateRequest(ctx context.Context, res func (client *SecuritySolutionsClient) getHandleResponse(resp *http.Response) (SecuritySolutionsGetResponse, error) { result := SecuritySolutionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecuritySolution); err != nil { - return SecuritySolutionsGetResponse{}, err + return SecuritySolutionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -140,7 +148,7 @@ func (client *SecuritySolutionsClient) listCreateRequest(ctx context.Context, op func (client *SecuritySolutionsClient) listHandleResponse(resp *http.Response) (SecuritySolutionsListResponse, error) { result := SecuritySolutionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecuritySolutionList); err != nil { - return SecuritySolutionsListResponse{}, err + return SecuritySolutionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_securitysolutionsreferencedata_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_securitysolutionsreferencedata_client.go index 0ff91c8738fe..63d2006ead35 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_securitysolutionsreferencedata_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_securitysolutionsreferencedata_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SecuritySolutionsReferenceDataClient contains the methods for the SecuritySolutionsReferenceData group. @@ -31,8 +32,15 @@ type SecuritySolutionsReferenceDataClient struct { } // NewSecuritySolutionsReferenceDataClient creates a new instance of SecuritySolutionsReferenceDataClient with the specified values. -func NewSecuritySolutionsReferenceDataClient(con *arm.Connection, subscriptionID string, ascLocation string) *SecuritySolutionsReferenceDataClient { - return &SecuritySolutionsReferenceDataClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID, ascLocation: ascLocation} +func NewSecuritySolutionsReferenceDataClient(subscriptionID string, ascLocation string, credential azcore.TokenCredential, options *arm.ClientOptions) *SecuritySolutionsReferenceDataClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SecuritySolutionsReferenceDataClient{subscriptionID: subscriptionID, ascLocation: ascLocation, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Gets a list of all supported Security Solutions for the subscription. @@ -74,7 +82,7 @@ func (client *SecuritySolutionsReferenceDataClient) listCreateRequest(ctx contex func (client *SecuritySolutionsReferenceDataClient) listHandleResponse(resp *http.Response) (SecuritySolutionsReferenceDataListResponse, error) { result := SecuritySolutionsReferenceDataListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecuritySolutionsReferenceDataList); err != nil { - return SecuritySolutionsReferenceDataListResponse{}, err + return SecuritySolutionsReferenceDataListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -135,7 +143,7 @@ func (client *SecuritySolutionsReferenceDataClient) listByHomeRegionCreateReques func (client *SecuritySolutionsReferenceDataClient) listByHomeRegionHandleResponse(resp *http.Response) (SecuritySolutionsReferenceDataListByHomeRegionResponse, error) { result := SecuritySolutionsReferenceDataListByHomeRegionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecuritySolutionsReferenceDataList); err != nil { - return SecuritySolutionsReferenceDataListByHomeRegionResponse{}, err + return SecuritySolutionsReferenceDataListByHomeRegionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_servervulnerabilityassessment_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_servervulnerabilityassessment_client.go index 0aca8dd26874..9a1f62fc7d34 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_servervulnerabilityassessment_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_servervulnerabilityassessment_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerVulnerabilityAssessmentClient contains the methods for the ServerVulnerabilityAssessment group. @@ -31,8 +31,15 @@ type ServerVulnerabilityAssessmentClient struct { } // NewServerVulnerabilityAssessmentClient creates a new instance of ServerVulnerabilityAssessmentClient with the specified values. -func NewServerVulnerabilityAssessmentClient(con *arm.Connection, subscriptionID string) *ServerVulnerabilityAssessmentClient { - return &ServerVulnerabilityAssessmentClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerVulnerabilityAssessmentClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerVulnerabilityAssessmentClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerVulnerabilityAssessmentClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creating a server vulnerability assessment on a resource, which will onboard a resource for having a vulnerability assessment on it @@ -94,7 +101,7 @@ func (client *ServerVulnerabilityAssessmentClient) createOrUpdateCreateRequest(c func (client *ServerVulnerabilityAssessmentClient) createOrUpdateHandleResponse(resp *http.Response) (ServerVulnerabilityAssessmentCreateOrUpdateResponse, error) { result := ServerVulnerabilityAssessmentCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerVulnerabilityAssessment); err != nil { - return ServerVulnerabilityAssessmentCreateOrUpdateResponse{}, err + return ServerVulnerabilityAssessmentCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -259,7 +266,7 @@ func (client *ServerVulnerabilityAssessmentClient) getCreateRequest(ctx context. func (client *ServerVulnerabilityAssessmentClient) getHandleResponse(resp *http.Response) (ServerVulnerabilityAssessmentGetResponse, error) { result := ServerVulnerabilityAssessmentGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerVulnerabilityAssessment); err != nil { - return ServerVulnerabilityAssessmentGetResponse{}, err + return ServerVulnerabilityAssessmentGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -332,7 +339,7 @@ func (client *ServerVulnerabilityAssessmentClient) listByExtendedResourceCreateR func (client *ServerVulnerabilityAssessmentClient) listByExtendedResourceHandleResponse(resp *http.Response) (ServerVulnerabilityAssessmentListByExtendedResourceResponse, error) { result := ServerVulnerabilityAssessmentListByExtendedResourceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerVulnerabilityAssessmentsList); err != nil { - return ServerVulnerabilityAssessmentListByExtendedResourceResponse{}, err + return ServerVulnerabilityAssessmentListByExtendedResourceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_settings_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_settings_client.go index cdb9143b12b0..c8f88d9f46ce 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_settings_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_settings_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SettingsClient contains the methods for the Settings group. @@ -30,8 +31,15 @@ type SettingsClient struct { } // NewSettingsClient creates a new instance of SettingsClient with the specified values. -func NewSettingsClient(con *arm.Connection, subscriptionID string) *SettingsClient { - return &SettingsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SettingsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SettingsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Settings of different configurations in security center @@ -77,7 +85,7 @@ func (client *SettingsClient) getCreateRequest(ctx context.Context, settingName func (client *SettingsClient) getHandleResponse(resp *http.Response) (SettingsGetResponse, error) { result := SettingsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { - return SettingsGetResponse{}, err + return SettingsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -131,7 +139,7 @@ func (client *SettingsClient) listCreateRequest(ctx context.Context, options *Se func (client *SettingsClient) listHandleResponse(resp *http.Response) (SettingsListResponse, error) { result := SettingsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SettingsList); err != nil { - return SettingsListResponse{}, err + return SettingsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -192,7 +200,7 @@ func (client *SettingsClient) updateCreateRequest(ctx context.Context, settingNa func (client *SettingsClient) updateHandleResponse(resp *http.Response) (SettingsUpdateResponse, error) { result := SettingsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result); err != nil { - return SettingsUpdateResponse{}, err + return SettingsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_softwareinventories_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_softwareinventories_client.go index ee34d663e84c..3526dc01ddae 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_softwareinventories_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_softwareinventories_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SoftwareInventoriesClient contains the methods for the SoftwareInventories group. @@ -30,8 +31,15 @@ type SoftwareInventoriesClient struct { } // NewSoftwareInventoriesClient creates a new instance of SoftwareInventoriesClient with the specified values. -func NewSoftwareInventoriesClient(con *arm.Connection, subscriptionID string) *SoftwareInventoriesClient { - return &SoftwareInventoriesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSoftwareInventoriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SoftwareInventoriesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SoftwareInventoriesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a single software data of the virtual machine. @@ -93,7 +101,7 @@ func (client *SoftwareInventoriesClient) getCreateRequest(ctx context.Context, r func (client *SoftwareInventoriesClient) getHandleResponse(resp *http.Response) (SoftwareInventoriesGetResponse, error) { result := SoftwareInventoriesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Software); err != nil { - return SoftwareInventoriesGetResponse{}, err + return SoftwareInventoriesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -163,7 +171,7 @@ func (client *SoftwareInventoriesClient) listByExtendedResourceCreateRequest(ctx func (client *SoftwareInventoriesClient) listByExtendedResourceHandleResponse(resp *http.Response) (SoftwareInventoriesListByExtendedResourceResponse, error) { result := SoftwareInventoriesListByExtendedResourceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SoftwaresList); err != nil { - return SoftwareInventoriesListByExtendedResourceResponse{}, err + return SoftwareInventoriesListByExtendedResourceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -217,7 +225,7 @@ func (client *SoftwareInventoriesClient) listBySubscriptionCreateRequest(ctx con func (client *SoftwareInventoriesClient) listBySubscriptionHandleResponse(resp *http.Response) (SoftwareInventoriesListBySubscriptionResponse, error) { result := SoftwareInventoriesListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SoftwaresList); err != nil { - return SoftwareInventoriesListBySubscriptionResponse{}, err + return SoftwareInventoriesListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentbaselinerules_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentbaselinerules_client.go index 3c4e4aefd0e5..73ffaf377472 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentbaselinerules_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentbaselinerules_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SQLVulnerabilityAssessmentBaselineRulesClient contains the methods for the SQLVulnerabilityAssessmentBaselineRules group. @@ -29,8 +30,15 @@ type SQLVulnerabilityAssessmentBaselineRulesClient struct { } // NewSQLVulnerabilityAssessmentBaselineRulesClient creates a new instance of SQLVulnerabilityAssessmentBaselineRulesClient with the specified values. -func NewSQLVulnerabilityAssessmentBaselineRulesClient(con *arm.Connection) *SQLVulnerabilityAssessmentBaselineRulesClient { - return &SQLVulnerabilityAssessmentBaselineRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewSQLVulnerabilityAssessmentBaselineRulesClient(credential azcore.TokenCredential, options *arm.ClientOptions) *SQLVulnerabilityAssessmentBaselineRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SQLVulnerabilityAssessmentBaselineRulesClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Add - Add a list of baseline rules. Will overwrite any previously existing results (for all rules). @@ -53,9 +61,6 @@ func (client *SQLVulnerabilityAssessmentBaselineRulesClient) Add(ctx context.Con // addCreateRequest creates the Add request. func (client *SQLVulnerabilityAssessmentBaselineRulesClient) addCreateRequest(ctx context.Context, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesAddOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules" - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodPost, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -76,7 +81,7 @@ func (client *SQLVulnerabilityAssessmentBaselineRulesClient) addCreateRequest(ct func (client *SQLVulnerabilityAssessmentBaselineRulesClient) addHandleResponse(resp *http.Response) (SQLVulnerabilityAssessmentBaselineRulesAddResponse, error) { result := SQLVulnerabilityAssessmentBaselineRulesAddResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RulesResults); err != nil { - return SQLVulnerabilityAssessmentBaselineRulesAddResponse{}, err + return SQLVulnerabilityAssessmentBaselineRulesAddResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -118,9 +123,6 @@ func (client *SQLVulnerabilityAssessmentBaselineRulesClient) createOrUpdateCreat return nil, errors.New("parameter ruleID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodPut, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -141,7 +143,7 @@ func (client *SQLVulnerabilityAssessmentBaselineRulesClient) createOrUpdateCreat func (client *SQLVulnerabilityAssessmentBaselineRulesClient) createOrUpdateHandleResponse(resp *http.Response) (SQLVulnerabilityAssessmentBaselineRulesCreateOrUpdateResponse, error) { result := SQLVulnerabilityAssessmentBaselineRulesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RuleResults); err != nil { - return SQLVulnerabilityAssessmentBaselineRulesCreateOrUpdateResponse{}, err + return SQLVulnerabilityAssessmentBaselineRulesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -183,9 +185,6 @@ func (client *SQLVulnerabilityAssessmentBaselineRulesClient) deleteCreateRequest return nil, errors.New("parameter ruleID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodDelete, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -236,9 +235,6 @@ func (client *SQLVulnerabilityAssessmentBaselineRulesClient) getCreateRequest(ct return nil, errors.New("parameter ruleID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{ruleId}", url.PathEscape(ruleID)) - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -256,7 +252,7 @@ func (client *SQLVulnerabilityAssessmentBaselineRulesClient) getCreateRequest(ct func (client *SQLVulnerabilityAssessmentBaselineRulesClient) getHandleResponse(resp *http.Response) (SQLVulnerabilityAssessmentBaselineRulesGetResponse, error) { result := SQLVulnerabilityAssessmentBaselineRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RuleResults); err != nil { - return SQLVulnerabilityAssessmentBaselineRulesGetResponse{}, err + return SQLVulnerabilityAssessmentBaselineRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -294,9 +290,6 @@ func (client *SQLVulnerabilityAssessmentBaselineRulesClient) List(ctx context.Co // listCreateRequest creates the List request. func (client *SQLVulnerabilityAssessmentBaselineRulesClient) listCreateRequest(ctx context.Context, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentBaselineRulesListOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/baselineRules" - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -314,7 +307,7 @@ func (client *SQLVulnerabilityAssessmentBaselineRulesClient) listCreateRequest(c func (client *SQLVulnerabilityAssessmentBaselineRulesClient) listHandleResponse(resp *http.Response) (SQLVulnerabilityAssessmentBaselineRulesListResponse, error) { result := SQLVulnerabilityAssessmentBaselineRulesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RulesResults); err != nil { - return SQLVulnerabilityAssessmentBaselineRulesListResponse{}, err + return SQLVulnerabilityAssessmentBaselineRulesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentscanresults_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentscanresults_client.go index 9be638a48bc1..a221208843a8 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentscanresults_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentscanresults_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SQLVulnerabilityAssessmentScanResultsClient contains the methods for the SQLVulnerabilityAssessmentScanResults group. @@ -29,8 +30,15 @@ type SQLVulnerabilityAssessmentScanResultsClient struct { } // NewSQLVulnerabilityAssessmentScanResultsClient creates a new instance of SQLVulnerabilityAssessmentScanResultsClient with the specified values. -func NewSQLVulnerabilityAssessmentScanResultsClient(con *arm.Connection) *SQLVulnerabilityAssessmentScanResultsClient { - return &SQLVulnerabilityAssessmentScanResultsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewSQLVulnerabilityAssessmentScanResultsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *SQLVulnerabilityAssessmentScanResultsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SQLVulnerabilityAssessmentScanResultsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the scan results of a single rule in a scan record. @@ -61,9 +69,6 @@ func (client *SQLVulnerabilityAssessmentScanResultsClient) getCreateRequest(ctx return nil, errors.New("parameter scanResultID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{scanResultId}", url.PathEscape(scanResultID)) - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -81,7 +86,7 @@ func (client *SQLVulnerabilityAssessmentScanResultsClient) getCreateRequest(ctx func (client *SQLVulnerabilityAssessmentScanResultsClient) getHandleResponse(resp *http.Response) (SQLVulnerabilityAssessmentScanResultsGetResponse, error) { result := SQLVulnerabilityAssessmentScanResultsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ScanResult); err != nil { - return SQLVulnerabilityAssessmentScanResultsGetResponse{}, err + return SQLVulnerabilityAssessmentScanResultsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -123,9 +128,6 @@ func (client *SQLVulnerabilityAssessmentScanResultsClient) listCreateRequest(ctx return nil, errors.New("parameter scanID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{scanId}", url.PathEscape(scanID)) - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -143,7 +145,7 @@ func (client *SQLVulnerabilityAssessmentScanResultsClient) listCreateRequest(ctx func (client *SQLVulnerabilityAssessmentScanResultsClient) listHandleResponse(resp *http.Response) (SQLVulnerabilityAssessmentScanResultsListResponse, error) { result := SQLVulnerabilityAssessmentScanResultsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ScanResults); err != nil { - return SQLVulnerabilityAssessmentScanResultsListResponse{}, err + return SQLVulnerabilityAssessmentScanResultsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentscans_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentscans_client.go index 36af6f51db61..baba444e7e70 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentscans_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_sqlvulnerabilityassessmentscans_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SQLVulnerabilityAssessmentScansClient contains the methods for the SQLVulnerabilityAssessmentScans group. @@ -29,8 +30,15 @@ type SQLVulnerabilityAssessmentScansClient struct { } // NewSQLVulnerabilityAssessmentScansClient creates a new instance of SQLVulnerabilityAssessmentScansClient with the specified values. -func NewSQLVulnerabilityAssessmentScansClient(con *arm.Connection) *SQLVulnerabilityAssessmentScansClient { - return &SQLVulnerabilityAssessmentScansClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewSQLVulnerabilityAssessmentScansClient(credential azcore.TokenCredential, options *arm.ClientOptions) *SQLVulnerabilityAssessmentScansClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SQLVulnerabilityAssessmentScansClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the scan details of a single scan record. @@ -57,9 +65,6 @@ func (client *SQLVulnerabilityAssessmentScansClient) getCreateRequest(ctx contex return nil, errors.New("parameter scanID cannot be empty") } urlPath = strings.ReplaceAll(urlPath, "{scanId}", url.PathEscape(scanID)) - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -77,7 +82,7 @@ func (client *SQLVulnerabilityAssessmentScansClient) getCreateRequest(ctx contex func (client *SQLVulnerabilityAssessmentScansClient) getHandleResponse(resp *http.Response) (SQLVulnerabilityAssessmentScansGetResponse, error) { result := SQLVulnerabilityAssessmentScansGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Scan); err != nil { - return SQLVulnerabilityAssessmentScansGetResponse{}, err + return SQLVulnerabilityAssessmentScansGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -115,9 +120,6 @@ func (client *SQLVulnerabilityAssessmentScansClient) List(ctx context.Context, w // listCreateRequest creates the List request. func (client *SQLVulnerabilityAssessmentScansClient) listCreateRequest(ctx context.Context, workspaceID string, resourceID string, options *SQLVulnerabilityAssessmentScansListOptions) (*policy.Request, error) { urlPath := "/{resourceId}/providers/Microsoft.Security/sqlVulnerabilityAssessments/default/scans" - if resourceID == "" { - return nil, errors.New("parameter resourceID cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{resourceId}", resourceID) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -135,7 +137,7 @@ func (client *SQLVulnerabilityAssessmentScansClient) listCreateRequest(ctx conte func (client *SQLVulnerabilityAssessmentScansClient) listHandleResponse(resp *http.Response) (SQLVulnerabilityAssessmentScansListResponse, error) { result := SQLVulnerabilityAssessmentScansListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Scans); err != nil { - return SQLVulnerabilityAssessmentScansListResponse{}, err + return SQLVulnerabilityAssessmentScansListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_subassessments_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_subassessments_client.go index fcddcd350493..0f8223487155 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_subassessments_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_subassessments_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SubAssessmentsClient contains the methods for the SubAssessments group. @@ -29,8 +30,15 @@ type SubAssessmentsClient struct { } // NewSubAssessmentsClient creates a new instance of SubAssessmentsClient with the specified values. -func NewSubAssessmentsClient(con *arm.Connection) *SubAssessmentsClient { - return &SubAssessmentsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewSubAssessmentsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *SubAssessmentsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SubAssessmentsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get a security sub-assessment on your scanned resource @@ -53,9 +61,6 @@ func (client *SubAssessmentsClient) Get(ctx context.Context, scope string, asses // getCreateRequest creates the Get request. func (client *SubAssessmentsClient) getCreateRequest(ctx context.Context, scope string, assessmentName string, subAssessmentName string, options *SubAssessmentsGetOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments/{subAssessmentName}" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if assessmentName == "" { return nil, errors.New("parameter assessmentName cannot be empty") @@ -80,7 +85,7 @@ func (client *SubAssessmentsClient) getCreateRequest(ctx context.Context, scope func (client *SubAssessmentsClient) getHandleResponse(resp *http.Response) (SubAssessmentsGetResponse, error) { result := SubAssessmentsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecuritySubAssessment); err != nil { - return SubAssessmentsGetResponse{}, err + return SubAssessmentsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -115,9 +120,6 @@ func (client *SubAssessmentsClient) List(scope string, assessmentName string, op // listCreateRequest creates the List request. func (client *SubAssessmentsClient) listCreateRequest(ctx context.Context, scope string, assessmentName string, options *SubAssessmentsListOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/assessments/{assessmentName}/subAssessments" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) if assessmentName == "" { return nil, errors.New("parameter assessmentName cannot be empty") @@ -138,7 +140,7 @@ func (client *SubAssessmentsClient) listCreateRequest(ctx context.Context, scope func (client *SubAssessmentsClient) listHandleResponse(resp *http.Response) (SubAssessmentsListResponse, error) { result := SubAssessmentsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecuritySubAssessmentList); err != nil { - return SubAssessmentsListResponse{}, err + return SubAssessmentsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -173,9 +175,6 @@ func (client *SubAssessmentsClient) ListAll(scope string, options *SubAssessment // listAllCreateRequest creates the ListAll request. func (client *SubAssessmentsClient) listAllCreateRequest(ctx context.Context, scope string, options *SubAssessmentsListAllOptions) (*policy.Request, error) { urlPath := "/{scope}/providers/Microsoft.Security/subAssessments" - if scope == "" { - return nil, errors.New("parameter scope cannot be empty") - } urlPath = strings.ReplaceAll(urlPath, "{scope}", scope) req, err := runtime.NewRequest(ctx, http.MethodGet, runtime.JoinPaths(client.ep, urlPath)) if err != nil { @@ -192,7 +191,7 @@ func (client *SubAssessmentsClient) listAllCreateRequest(ctx context.Context, sc func (client *SubAssessmentsClient) listAllHandleResponse(resp *http.Response) (SubAssessmentsListAllResponse, error) { result := SubAssessmentsListAllResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecuritySubAssessmentList); err != nil { - return SubAssessmentsListAllResponse{}, err + return SubAssessmentsListAllResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_tasks_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_tasks_client.go index 0a038a0a411e..7893ceb69d17 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_tasks_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_tasks_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TasksClient contains the methods for the Tasks group. @@ -31,8 +32,15 @@ type TasksClient struct { } // NewTasksClient creates a new instance of TasksClient with the specified values. -func NewTasksClient(con *arm.Connection, subscriptionID string, ascLocation string) *TasksClient { - return &TasksClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID, ascLocation: ascLocation} +func NewTasksClient(subscriptionID string, ascLocation string, credential azcore.TokenCredential, options *arm.ClientOptions) *TasksClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TasksClient{subscriptionID: subscriptionID, ascLocation: ascLocation, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetResourceGroupLevelTask - Recommended tasks that will help improve the security of the subscription proactively @@ -86,7 +94,7 @@ func (client *TasksClient) getResourceGroupLevelTaskCreateRequest(ctx context.Co func (client *TasksClient) getResourceGroupLevelTaskHandleResponse(resp *http.Response) (TasksGetResourceGroupLevelTaskResponse, error) { result := TasksGetResourceGroupLevelTaskResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityTask); err != nil { - return TasksGetResourceGroupLevelTaskResponse{}, err + return TasksGetResourceGroupLevelTaskResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -151,7 +159,7 @@ func (client *TasksClient) getSubscriptionLevelTaskCreateRequest(ctx context.Con func (client *TasksClient) getSubscriptionLevelTaskHandleResponse(resp *http.Response) (TasksGetSubscriptionLevelTaskResponse, error) { result := TasksGetSubscriptionLevelTaskResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityTask); err != nil { - return TasksGetSubscriptionLevelTaskResponse{}, err + return TasksGetSubscriptionLevelTaskResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -208,7 +216,7 @@ func (client *TasksClient) listCreateRequest(ctx context.Context, options *Tasks func (client *TasksClient) listHandleResponse(resp *http.Response) (TasksListResponse, error) { result := TasksListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityTaskList); err != nil { - return TasksListResponse{}, err + return TasksListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -269,7 +277,7 @@ func (client *TasksClient) listByHomeRegionCreateRequest(ctx context.Context, op func (client *TasksClient) listByHomeRegionHandleResponse(resp *http.Response) (TasksListByHomeRegionResponse, error) { result := TasksListByHomeRegionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityTaskList); err != nil { - return TasksListByHomeRegionResponse{}, err + return TasksListByHomeRegionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -334,7 +342,7 @@ func (client *TasksClient) listByResourceGroupCreateRequest(ctx context.Context, func (client *TasksClient) listByResourceGroupHandleResponse(resp *http.Response) (TasksListByResourceGroupResponse, error) { result := TasksListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityTaskList); err != nil { - return TasksListByResourceGroupResponse{}, err + return TasksListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_time_rfc3339.go b/sdk/resourcemanager/security/armsecurity/zz_generated_time_rfc3339.go index f3fb0558792a..c13a0e5dec2b 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armsecurity import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_topology_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_topology_client.go index 2ba940602c2f..9740f4094668 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_topology_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_topology_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TopologyClient contains the methods for the Topology group. @@ -31,8 +32,15 @@ type TopologyClient struct { } // NewTopologyClient creates a new instance of TopologyClient with the specified values. -func NewTopologyClient(con *arm.Connection, subscriptionID string, ascLocation string) *TopologyClient { - return &TopologyClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID, ascLocation: ascLocation} +func NewTopologyClient(subscriptionID string, ascLocation string, credential azcore.TokenCredential, options *arm.ClientOptions) *TopologyClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TopologyClient{subscriptionID: subscriptionID, ascLocation: ascLocation, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a specific topology component. @@ -86,7 +94,7 @@ func (client *TopologyClient) getCreateRequest(ctx context.Context, resourceGrou func (client *TopologyClient) getHandleResponse(resp *http.Response) (TopologyGetResponse, error) { result := TopologyGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TopologyResource); err != nil { - return TopologyGetResponse{}, err + return TopologyGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -140,7 +148,7 @@ func (client *TopologyClient) listCreateRequest(ctx context.Context, options *To func (client *TopologyClient) listHandleResponse(resp *http.Response) (TopologyListResponse, error) { result := TopologyListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TopologyList); err != nil { - return TopologyListResponse{}, err + return TopologyListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -198,7 +206,7 @@ func (client *TopologyClient) listByHomeRegionCreateRequest(ctx context.Context, func (client *TopologyClient) listByHomeRegionHandleResponse(resp *http.Response) (TopologyListByHomeRegionResponse, error) { result := TopologyListByHomeRegionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TopologyList); err != nil { - return TopologyListByHomeRegionResponse{}, err + return TopologyListByHomeRegionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/security/armsecurity/zz_generated_workspacesettings_client.go b/sdk/resourcemanager/security/armsecurity/zz_generated_workspacesettings_client.go index 81065c7fb0c1..6001344a6004 100644 --- a/sdk/resourcemanager/security/armsecurity/zz_generated_workspacesettings_client.go +++ b/sdk/resourcemanager/security/armsecurity/zz_generated_workspacesettings_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // WorkspaceSettingsClient contains the methods for the WorkspaceSettings group. @@ -30,8 +31,15 @@ type WorkspaceSettingsClient struct { } // NewWorkspaceSettingsClient creates a new instance of WorkspaceSettingsClient with the specified values. -func NewWorkspaceSettingsClient(con *arm.Connection, subscriptionID string) *WorkspaceSettingsClient { - return &WorkspaceSettingsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWorkspaceSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkspaceSettingsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WorkspaceSettingsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - creating settings about where we should store your security data and logs @@ -77,7 +85,7 @@ func (client *WorkspaceSettingsClient) createCreateRequest(ctx context.Context, func (client *WorkspaceSettingsClient) createHandleResponse(resp *http.Response) (WorkspaceSettingsCreateResponse, error) { result := WorkspaceSettingsCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceSetting); err != nil { - return WorkspaceSettingsCreateResponse{}, err + return WorkspaceSettingsCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -190,7 +198,7 @@ func (client *WorkspaceSettingsClient) getCreateRequest(ctx context.Context, wor func (client *WorkspaceSettingsClient) getHandleResponse(resp *http.Response) (WorkspaceSettingsGetResponse, error) { result := WorkspaceSettingsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceSetting); err != nil { - return WorkspaceSettingsGetResponse{}, err + return WorkspaceSettingsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -245,7 +253,7 @@ func (client *WorkspaceSettingsClient) listCreateRequest(ctx context.Context, op func (client *WorkspaceSettingsClient) listHandleResponse(resp *http.Response) (WorkspaceSettingsListResponse, error) { result := WorkspaceSettingsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceSettingList); err != nil { - return WorkspaceSettingsListResponse{}, err + return WorkspaceSettingsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -306,7 +314,7 @@ func (client *WorkspaceSettingsClient) updateCreateRequest(ctx context.Context, func (client *WorkspaceSettingsClient) updateHandleResponse(resp *http.Response) (WorkspaceSettingsUpdateResponse, error) { result := WorkspaceSettingsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkspaceSetting); err != nil { - return WorkspaceSettingsUpdateResponse{}, err + return WorkspaceSettingsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/servicebus/armservicebus/CHANGELOG.md b/sdk/resourcemanager/servicebus/armservicebus/CHANGELOG.md index 2e065a41064f..0c3c205075bd 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/CHANGELOG.md +++ b/sdk/resourcemanager/servicebus/armservicebus/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-10-08) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicebus/armservicebus". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/servicebus/armservicebus") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/servicebus/armservicebus/README.md b/sdk/resourcemanager/servicebus/armservicebus/README.md index 090b72ae40b1..9a474f80877c 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/README.md +++ b/sdk/resourcemanager/servicebus/armservicebus/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Service Bus +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Service Bus modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armservicebus.NewSubscriptionsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Service Bus modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armservicebus.NewSubscriptionsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armservicebus.NewSubscriptionsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/servicebus/armservicebus/autorest.md b/sdk/resourcemanager/servicebus/armservicebus/autorest.md index cd5c5b0eab7c..9cd833c254da 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/autorest.md +++ b/sdk/resourcemanager/servicebus/armservicebus/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/servicebus/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/servicebus/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/servicebus/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/servicebus/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/servicebus/armservicebus/go.mod b/sdk/resourcemanager/servicebus/armservicebus/go.mod index af20a2f75d4a..5e58b8736e58 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/go.mod +++ b/sdk/resourcemanager/servicebus/armservicebus/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicebus/armservi go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/servicebus/armservicebus/go.sum b/sdk/resourcemanager/servicebus/armservicebus/go.sum index 4f0fb709cf31..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/go.sum +++ b/sdk/resourcemanager/servicebus/armservicebus/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible h1:Cw16jiP4dI+CK761aq44ol4RV5dUiIIXky1+EKpoiVM= -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_constants.go b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_constants.go index c685cf03d746..ff121d3ca9b7 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_constants.go +++ b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_constants.go @@ -10,7 +10,7 @@ package armservicebus const ( module = "armservicebus" - version = "v0.1.0" + version = "v0.2.0" ) type AccessRights string diff --git a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_disasterrecoveryconfigs_client.go b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_disasterrecoveryconfigs_client.go index 46182514ff8e..da707c69e8d8 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_disasterrecoveryconfigs_client.go +++ b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_disasterrecoveryconfigs_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DisasterRecoveryConfigsClient contains the methods for the DisasterRecoveryConfigs group. @@ -30,8 +31,15 @@ type DisasterRecoveryConfigsClient struct { } // NewDisasterRecoveryConfigsClient creates a new instance of DisasterRecoveryConfigsClient with the specified values. -func NewDisasterRecoveryConfigsClient(con *arm.Connection, subscriptionID string) *DisasterRecoveryConfigsClient { - return &DisasterRecoveryConfigsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDisasterRecoveryConfigsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DisasterRecoveryConfigsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DisasterRecoveryConfigsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BreakPairing - This operation disables the Disaster Recovery and stops replicating changes from primary to secondary namespaces @@ -141,7 +149,7 @@ func (client *DisasterRecoveryConfigsClient) checkNameAvailabilityCreateRequest( func (client *DisasterRecoveryConfigsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (DisasterRecoveryConfigsCheckNameAvailabilityResponse, error) { result := DisasterRecoveryConfigsCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResult); err != nil { - return DisasterRecoveryConfigsCheckNameAvailabilityResponse{}, err + return DisasterRecoveryConfigsCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -210,7 +218,7 @@ func (client *DisasterRecoveryConfigsClient) createOrUpdateCreateRequest(ctx con func (client *DisasterRecoveryConfigsClient) createOrUpdateHandleResponse(resp *http.Response) (DisasterRecoveryConfigsCreateOrUpdateResponse, error) { result := DisasterRecoveryConfigsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ArmDisasterRecovery); err != nil { - return DisasterRecoveryConfigsCreateOrUpdateResponse{}, err + return DisasterRecoveryConfigsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -402,7 +410,7 @@ func (client *DisasterRecoveryConfigsClient) getCreateRequest(ctx context.Contex func (client *DisasterRecoveryConfigsClient) getHandleResponse(resp *http.Response) (DisasterRecoveryConfigsGetResponse, error) { result := DisasterRecoveryConfigsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ArmDisasterRecovery); err != nil { - return DisasterRecoveryConfigsGetResponse{}, err + return DisasterRecoveryConfigsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -475,7 +483,7 @@ func (client *DisasterRecoveryConfigsClient) getAuthorizationRuleCreateRequest(c func (client *DisasterRecoveryConfigsClient) getAuthorizationRuleHandleResponse(resp *http.Response) (DisasterRecoveryConfigsGetAuthorizationRuleResponse, error) { result := DisasterRecoveryConfigsGetAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBAuthorizationRule); err != nil { - return DisasterRecoveryConfigsGetAuthorizationRuleResponse{}, err + return DisasterRecoveryConfigsGetAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -537,7 +545,7 @@ func (client *DisasterRecoveryConfigsClient) listCreateRequest(ctx context.Conte func (client *DisasterRecoveryConfigsClient) listHandleResponse(resp *http.Response) (DisasterRecoveryConfigsListResponse, error) { result := DisasterRecoveryConfigsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ArmDisasterRecoveryListResult); err != nil { - return DisasterRecoveryConfigsListResponse{}, err + return DisasterRecoveryConfigsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -603,7 +611,7 @@ func (client *DisasterRecoveryConfigsClient) listAuthorizationRulesCreateRequest func (client *DisasterRecoveryConfigsClient) listAuthorizationRulesHandleResponse(resp *http.Response) (DisasterRecoveryConfigsListAuthorizationRulesResponse, error) { result := DisasterRecoveryConfigsListAuthorizationRulesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBAuthorizationRuleListResult); err != nil { - return DisasterRecoveryConfigsListAuthorizationRulesResponse{}, err + return DisasterRecoveryConfigsListAuthorizationRulesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -676,7 +684,7 @@ func (client *DisasterRecoveryConfigsClient) listKeysCreateRequest(ctx context.C func (client *DisasterRecoveryConfigsClient) listKeysHandleResponse(resp *http.Response) (DisasterRecoveryConfigsListKeysResponse, error) { result := DisasterRecoveryConfigsListKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { - return DisasterRecoveryConfigsListKeysResponse{}, err + return DisasterRecoveryConfigsListKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_migrationconfigs_client.go b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_migrationconfigs_client.go index 106c584c50a0..179b8e314ddf 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_migrationconfigs_client.go +++ b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_migrationconfigs_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // MigrationConfigsClient contains the methods for the MigrationConfigs group. @@ -31,8 +31,15 @@ type MigrationConfigsClient struct { } // NewMigrationConfigsClient creates a new instance of MigrationConfigsClient with the specified values. -func NewMigrationConfigsClient(con *arm.Connection, subscriptionID string) *MigrationConfigsClient { - return &MigrationConfigsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewMigrationConfigsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *MigrationConfigsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MigrationConfigsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CompleteMigration - This operation Completes Migration of entities by pointing the connection strings to Premium namespace and any entities created after @@ -288,7 +295,7 @@ func (client *MigrationConfigsClient) getCreateRequest(ctx context.Context, reso func (client *MigrationConfigsClient) getHandleResponse(resp *http.Response) (MigrationConfigsGetResponse, error) { result := MigrationConfigsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MigrationConfigProperties); err != nil { - return MigrationConfigsGetResponse{}, err + return MigrationConfigsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -350,7 +357,7 @@ func (client *MigrationConfigsClient) listCreateRequest(ctx context.Context, res func (client *MigrationConfigsClient) listHandleResponse(resp *http.Response) (MigrationConfigsListResponse, error) { result := MigrationConfigsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MigrationConfigListResult); err != nil { - return MigrationConfigsListResponse{}, err + return MigrationConfigsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_models.go b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_models.go index d6a7ae22cc72..25f913dce575 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_models.go +++ b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_models.go @@ -10,10 +10,9 @@ package armservicebus import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // AccessKeys - Namespace/ServiceBus Connection String @@ -1125,7 +1124,7 @@ type SBNamespaceProperties struct { // MarshalJSON implements the json.Marshaller interface for type SBNamespaceProperties. func (s SBNamespaceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "disableLocalAuth", s.DisableLocalAuth) populate(objectMap, "encryption", s.Encryption) populate(objectMap, "metricId", s.MetricID) @@ -1133,7 +1132,7 @@ func (s SBNamespaceProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "provisioningState", s.ProvisioningState) populate(objectMap, "serviceBusEndpoint", s.ServiceBusEndpoint) populate(objectMap, "status", s.Status) - populate(objectMap, "updatedAt", (*timeRFC3339)(s.UpdatedAt)) + populateTimeRFC3339(objectMap, "updatedAt", s.UpdatedAt) populate(objectMap, "zoneRedundant", s.ZoneRedundant) return json.Marshal(objectMap) } @@ -1148,9 +1147,7 @@ func (s *SBNamespaceProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "disableLocalAuth": err = unpopulate(val, &s.DisableLocalAuth) @@ -1174,9 +1171,7 @@ func (s *SBNamespaceProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Status) delete(rawMsg, key) case "updatedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.UpdatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.UpdatedAt) delete(rawMsg, key) case "zoneRedundant": err = unpopulate(val, &s.ZoneRedundant) @@ -1323,10 +1318,10 @@ type SBQueueProperties struct { // MarshalJSON implements the json.Marshaller interface for type SBQueueProperties. func (s SBQueueProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "accessedAt", (*timeRFC3339)(s.AccessedAt)) + populateTimeRFC3339(objectMap, "accessedAt", s.AccessedAt) populate(objectMap, "autoDeleteOnIdle", s.AutoDeleteOnIdle) populate(objectMap, "countDetails", s.CountDetails) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "deadLetteringOnMessageExpiration", s.DeadLetteringOnMessageExpiration) populate(objectMap, "defaultMessageTimeToLive", s.DefaultMessageTimeToLive) populate(objectMap, "duplicateDetectionHistoryTimeWindow", s.DuplicateDetectionHistoryTimeWindow) @@ -1344,7 +1339,7 @@ func (s SBQueueProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "requiresSession", s.RequiresSession) populate(objectMap, "sizeInBytes", s.SizeInBytes) populate(objectMap, "status", s.Status) - populate(objectMap, "updatedAt", (*timeRFC3339)(s.UpdatedAt)) + populateTimeRFC3339(objectMap, "updatedAt", s.UpdatedAt) return json.Marshal(objectMap) } @@ -1358,9 +1353,7 @@ func (s *SBQueueProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "accessedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.AccessedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.AccessedAt) delete(rawMsg, key) case "autoDeleteOnIdle": err = unpopulate(val, &s.AutoDeleteOnIdle) @@ -1369,9 +1362,7 @@ func (s *SBQueueProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CountDetails) delete(rawMsg, key) case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "deadLetteringOnMessageExpiration": err = unpopulate(val, &s.DeadLetteringOnMessageExpiration) @@ -1425,9 +1416,7 @@ func (s *SBQueueProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Status) delete(rawMsg, key) case "updatedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.UpdatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.UpdatedAt) delete(rawMsg, key) } if err != nil { @@ -1550,11 +1539,11 @@ type SBSubscriptionProperties struct { // MarshalJSON implements the json.Marshaller interface for type SBSubscriptionProperties. func (s SBSubscriptionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "accessedAt", (*timeRFC3339)(s.AccessedAt)) + populateTimeRFC3339(objectMap, "accessedAt", s.AccessedAt) populate(objectMap, "autoDeleteOnIdle", s.AutoDeleteOnIdle) populate(objectMap, "clientAffineProperties", s.ClientAffineProperties) populate(objectMap, "countDetails", s.CountDetails) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "deadLetteringOnFilterEvaluationExceptions", s.DeadLetteringOnFilterEvaluationExceptions) populate(objectMap, "deadLetteringOnMessageExpiration", s.DeadLetteringOnMessageExpiration) populate(objectMap, "defaultMessageTimeToLive", s.DefaultMessageTimeToLive) @@ -1568,7 +1557,7 @@ func (s SBSubscriptionProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "messageCount", s.MessageCount) populate(objectMap, "requiresSession", s.RequiresSession) populate(objectMap, "status", s.Status) - populate(objectMap, "updatedAt", (*timeRFC3339)(s.UpdatedAt)) + populateTimeRFC3339(objectMap, "updatedAt", s.UpdatedAt) return json.Marshal(objectMap) } @@ -1582,9 +1571,7 @@ func (s *SBSubscriptionProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "accessedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.AccessedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.AccessedAt) delete(rawMsg, key) case "autoDeleteOnIdle": err = unpopulate(val, &s.AutoDeleteOnIdle) @@ -1596,9 +1583,7 @@ func (s *SBSubscriptionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CountDetails) delete(rawMsg, key) case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "deadLetteringOnFilterEvaluationExceptions": err = unpopulate(val, &s.DeadLetteringOnFilterEvaluationExceptions) @@ -1640,9 +1625,7 @@ func (s *SBSubscriptionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Status) delete(rawMsg, key) case "updatedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.UpdatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.UpdatedAt) delete(rawMsg, key) } if err != nil { @@ -1747,10 +1730,10 @@ type SBTopicProperties struct { // MarshalJSON implements the json.Marshaller interface for type SBTopicProperties. func (s SBTopicProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "accessedAt", (*timeRFC3339)(s.AccessedAt)) + populateTimeRFC3339(objectMap, "accessedAt", s.AccessedAt) populate(objectMap, "autoDeleteOnIdle", s.AutoDeleteOnIdle) populate(objectMap, "countDetails", s.CountDetails) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "defaultMessageTimeToLive", s.DefaultMessageTimeToLive) populate(objectMap, "duplicateDetectionHistoryTimeWindow", s.DuplicateDetectionHistoryTimeWindow) populate(objectMap, "enableBatchedOperations", s.EnableBatchedOperations) @@ -1763,7 +1746,7 @@ func (s SBTopicProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "status", s.Status) populate(objectMap, "subscriptionCount", s.SubscriptionCount) populate(objectMap, "supportOrdering", s.SupportOrdering) - populate(objectMap, "updatedAt", (*timeRFC3339)(s.UpdatedAt)) + populateTimeRFC3339(objectMap, "updatedAt", s.UpdatedAt) return json.Marshal(objectMap) } @@ -1777,9 +1760,7 @@ func (s *SBTopicProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "accessedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.AccessedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.AccessedAt) delete(rawMsg, key) case "autoDeleteOnIdle": err = unpopulate(val, &s.AutoDeleteOnIdle) @@ -1788,9 +1769,7 @@ func (s *SBTopicProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CountDetails) delete(rawMsg, key) case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "defaultMessageTimeToLive": err = unpopulate(val, &s.DefaultMessageTimeToLive) @@ -1829,9 +1808,7 @@ func (s *SBTopicProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.SupportOrdering) delete(rawMsg, key) case "updatedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.UpdatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.UpdatedAt) delete(rawMsg, key) } if err != nil { @@ -1912,10 +1889,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -1931,9 +1908,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -1942,9 +1917,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) diff --git a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_namespaces_client.go b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_namespaces_client.go index def8d5fe006c..1a0719e1e9b9 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_namespaces_client.go +++ b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_namespaces_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // NamespacesClient contains the methods for the Namespaces group. @@ -31,8 +31,15 @@ type NamespacesClient struct { } // NewNamespacesClient creates a new instance of NamespacesClient with the specified values. -func NewNamespacesClient(con *arm.Connection, subscriptionID string) *NamespacesClient { - return &NamespacesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewNamespacesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *NamespacesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &NamespacesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNameAvailability - Check the give namespace name availability. @@ -74,7 +81,7 @@ func (client *NamespacesClient) checkNameAvailabilityCreateRequest(ctx context.C func (client *NamespacesClient) checkNameAvailabilityHandleResponse(resp *http.Response) (NamespacesCheckNameAvailabilityResponse, error) { result := NamespacesCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResult); err != nil { - return NamespacesCheckNameAvailabilityResponse{}, err + return NamespacesCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -219,7 +226,7 @@ func (client *NamespacesClient) createOrUpdateAuthorizationRuleCreateRequest(ctx func (client *NamespacesClient) createOrUpdateAuthorizationRuleHandleResponse(resp *http.Response) (NamespacesCreateOrUpdateAuthorizationRuleResponse, error) { result := NamespacesCreateOrUpdateAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBAuthorizationRule); err != nil { - return NamespacesCreateOrUpdateAuthorizationRuleResponse{}, err + return NamespacesCreateOrUpdateAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -284,7 +291,7 @@ func (client *NamespacesClient) createOrUpdateNetworkRuleSetCreateRequest(ctx co func (client *NamespacesClient) createOrUpdateNetworkRuleSetHandleResponse(resp *http.Response) (NamespacesCreateOrUpdateNetworkRuleSetResponse, error) { result := NamespacesCreateOrUpdateNetworkRuleSetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkRuleSet); err != nil { - return NamespacesCreateOrUpdateNetworkRuleSetResponse{}, err + return NamespacesCreateOrUpdateNetworkRuleSetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -485,7 +492,7 @@ func (client *NamespacesClient) getCreateRequest(ctx context.Context, resourceGr func (client *NamespacesClient) getHandleResponse(resp *http.Response) (NamespacesGetResponse, error) { result := NamespacesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBNamespace); err != nil { - return NamespacesGetResponse{}, err + return NamespacesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -554,7 +561,7 @@ func (client *NamespacesClient) getAuthorizationRuleCreateRequest(ctx context.Co func (client *NamespacesClient) getAuthorizationRuleHandleResponse(resp *http.Response) (NamespacesGetAuthorizationRuleResponse, error) { result := NamespacesGetAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBAuthorizationRule); err != nil { - return NamespacesGetAuthorizationRuleResponse{}, err + return NamespacesGetAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -619,7 +626,7 @@ func (client *NamespacesClient) getNetworkRuleSetCreateRequest(ctx context.Conte func (client *NamespacesClient) getNetworkRuleSetHandleResponse(resp *http.Response) (NamespacesGetNetworkRuleSetResponse, error) { result := NamespacesGetNetworkRuleSetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkRuleSet); err != nil { - return NamespacesGetNetworkRuleSetResponse{}, err + return NamespacesGetNetworkRuleSetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -673,7 +680,7 @@ func (client *NamespacesClient) listCreateRequest(ctx context.Context, options * func (client *NamespacesClient) listHandleResponse(resp *http.Response) (NamespacesListResponse, error) { result := NamespacesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBNamespaceListResult); err != nil { - return NamespacesListResponse{}, err + return NamespacesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -735,7 +742,7 @@ func (client *NamespacesClient) listAuthorizationRulesCreateRequest(ctx context. func (client *NamespacesClient) listAuthorizationRulesHandleResponse(resp *http.Response) (NamespacesListAuthorizationRulesResponse, error) { result := NamespacesListAuthorizationRulesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBAuthorizationRuleListResult); err != nil { - return NamespacesListAuthorizationRulesResponse{}, err + return NamespacesListAuthorizationRulesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -793,7 +800,7 @@ func (client *NamespacesClient) listByResourceGroupCreateRequest(ctx context.Con func (client *NamespacesClient) listByResourceGroupHandleResponse(resp *http.Response) (NamespacesListByResourceGroupResponse, error) { result := NamespacesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBNamespaceListResult); err != nil { - return NamespacesListByResourceGroupResponse{}, err + return NamespacesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -862,7 +869,7 @@ func (client *NamespacesClient) listKeysCreateRequest(ctx context.Context, resou func (client *NamespacesClient) listKeysHandleResponse(resp *http.Response) (NamespacesListKeysResponse, error) { result := NamespacesListKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { - return NamespacesListKeysResponse{}, err + return NamespacesListKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -924,7 +931,7 @@ func (client *NamespacesClient) listNetworkRuleSetsCreateRequest(ctx context.Con func (client *NamespacesClient) listNetworkRuleSetsHandleResponse(resp *http.Response) (NamespacesListNetworkRuleSetsResponse, error) { result := NamespacesListNetworkRuleSetsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkRuleSetListResult); err != nil { - return NamespacesListNetworkRuleSetsResponse{}, err + return NamespacesListNetworkRuleSetsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -993,7 +1000,7 @@ func (client *NamespacesClient) regenerateKeysCreateRequest(ctx context.Context, func (client *NamespacesClient) regenerateKeysHandleResponse(resp *http.Response) (NamespacesRegenerateKeysResponse, error) { result := NamespacesRegenerateKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { - return NamespacesRegenerateKeysResponse{}, err + return NamespacesRegenerateKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1058,7 +1065,7 @@ func (client *NamespacesClient) updateCreateRequest(ctx context.Context, resourc func (client *NamespacesClient) updateHandleResponse(resp *http.Response) (NamespacesUpdateResponse, error) { result := NamespacesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBNamespace); err != nil { - return NamespacesUpdateResponse{}, err + return NamespacesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_operations_client.go b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_operations_client.go index b7c6eec18fee..229f343c772a 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_operations_client.go +++ b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armservicebus import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available ServiceBus REST API operations. @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_pagers.go b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_pagers.go index f0d7ddb0ead5..45ab3966549f 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_pagers.go +++ b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armservicebus import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // DisasterRecoveryConfigsListAuthorizationRulesPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_pollers.go b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_pollers.go index 0ae2ad003f9c..3a62c4cd8062 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_pollers.go +++ b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armservicebus import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // MigrationConfigsCreateAndStartMigrationPoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_privateendpointconnections_client.go index 8237cd387707..4ec88494688b 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_privateendpointconnections_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. @@ -31,8 +31,15 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { - return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates PrivateEndpointConnections of service namespace. @@ -86,7 +93,7 @@ func (client *PrivateEndpointConnectionsClient) createOrUpdateCreateRequest(ctx func (client *PrivateEndpointConnectionsClient) createOrUpdateHandleResponse(resp *http.Response) (PrivateEndpointConnectionsCreateOrUpdateResponse, error) { result := PrivateEndpointConnectionsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsCreateOrUpdateResponse{}, err + return PrivateEndpointConnectionsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -235,7 +242,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsGetResponse{}, err + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -297,7 +304,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListResponse, error) { result := PrivateEndpointConnectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionsListResponse{}, err + return PrivateEndpointConnectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_privatelinkresources_client.go index 0268088cdd7b..b5dad9ad7ed9 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_privatelinkresources_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. @@ -30,8 +31,15 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { - return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets lists of resources that supports Privatelinks. @@ -81,7 +89,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesGetResponse, error) { result := PrivateLinkResourcesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourcesListResult); err != nil { - return PrivateLinkResourcesGetResponse{}, err + return PrivateLinkResourcesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_queues_client.go b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_queues_client.go index d1094f9920c5..9f52f9c3d739 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_queues_client.go +++ b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_queues_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // QueuesClient contains the methods for the Queues group. @@ -31,8 +32,15 @@ type QueuesClient struct { } // NewQueuesClient creates a new instance of QueuesClient with the specified values. -func NewQueuesClient(con *arm.Connection, subscriptionID string) *QueuesClient { - return &QueuesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewQueuesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *QueuesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &QueuesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a Service Bus queue. This operation is idempotent. @@ -86,7 +94,7 @@ func (client *QueuesClient) createOrUpdateCreateRequest(ctx context.Context, res func (client *QueuesClient) createOrUpdateHandleResponse(resp *http.Response) (QueuesCreateOrUpdateResponse, error) { result := QueuesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBQueue); err != nil { - return QueuesCreateOrUpdateResponse{}, err + return QueuesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -159,7 +167,7 @@ func (client *QueuesClient) createOrUpdateAuthorizationRuleCreateRequest(ctx con func (client *QueuesClient) createOrUpdateAuthorizationRuleHandleResponse(resp *http.Response) (QueuesCreateOrUpdateAuthorizationRuleResponse, error) { result := QueuesCreateOrUpdateAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBAuthorizationRule); err != nil { - return QueuesCreateOrUpdateAuthorizationRuleResponse{}, err + return QueuesCreateOrUpdateAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -352,7 +360,7 @@ func (client *QueuesClient) getCreateRequest(ctx context.Context, resourceGroupN func (client *QueuesClient) getHandleResponse(resp *http.Response) (QueuesGetResponse, error) { result := QueuesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBQueue); err != nil { - return QueuesGetResponse{}, err + return QueuesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -425,7 +433,7 @@ func (client *QueuesClient) getAuthorizationRuleCreateRequest(ctx context.Contex func (client *QueuesClient) getAuthorizationRuleHandleResponse(resp *http.Response) (QueuesGetAuthorizationRuleResponse, error) { result := QueuesGetAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBAuthorizationRule); err != nil { - return QueuesGetAuthorizationRuleResponse{}, err + return QueuesGetAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -491,7 +499,7 @@ func (client *QueuesClient) listAuthorizationRulesCreateRequest(ctx context.Cont func (client *QueuesClient) listAuthorizationRulesHandleResponse(resp *http.Response) (QueuesListAuthorizationRulesResponse, error) { result := QueuesListAuthorizationRulesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBAuthorizationRuleListResult); err != nil { - return QueuesListAuthorizationRulesResponse{}, err + return QueuesListAuthorizationRulesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -559,7 +567,7 @@ func (client *QueuesClient) listByNamespaceCreateRequest(ctx context.Context, re func (client *QueuesClient) listByNamespaceHandleResponse(resp *http.Response) (QueuesListByNamespaceResponse, error) { result := QueuesListByNamespaceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBQueueListResult); err != nil { - return QueuesListByNamespaceResponse{}, err + return QueuesListByNamespaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -632,7 +640,7 @@ func (client *QueuesClient) listKeysCreateRequest(ctx context.Context, resourceG func (client *QueuesClient) listKeysHandleResponse(resp *http.Response) (QueuesListKeysResponse, error) { result := QueuesListKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { - return QueuesListKeysResponse{}, err + return QueuesListKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -705,7 +713,7 @@ func (client *QueuesClient) regenerateKeysCreateRequest(ctx context.Context, res func (client *QueuesClient) regenerateKeysHandleResponse(resp *http.Response) (QueuesRegenerateKeysResponse, error) { result := QueuesRegenerateKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { - return QueuesRegenerateKeysResponse{}, err + return QueuesRegenerateKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_response_types.go b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_response_types.go index 1054f0612ba7..5814aca1fcff 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_response_types.go +++ b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armservicebus import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // DisasterRecoveryConfigsBreakPairingResponse contains the response from method DisasterRecoveryConfigs.BreakPairing. @@ -134,6 +133,8 @@ type MigrationConfigsCreateAndStartMigrationPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l MigrationConfigsCreateAndStartMigrationPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (MigrationConfigsCreateAndStartMigrationResponse, error) { respType := MigrationConfigsCreateAndStartMigrationResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.MigrationConfigProperties) @@ -256,6 +257,8 @@ type NamespacesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NamespacesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NamespacesCreateOrUpdateResponse, error) { respType := NamespacesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SBNamespace) @@ -312,6 +315,8 @@ type NamespacesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l NamespacesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (NamespacesDeleteResponse, error) { respType := NamespacesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -500,6 +505,8 @@ type PrivateEndpointConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsDeleteResponse, error) { respType := PrivateEndpointConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_rules_client.go b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_rules_client.go index fd6705b8a8d9..0782f15c31e7 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_rules_client.go +++ b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_rules_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // RulesClient contains the methods for the Rules group. @@ -31,8 +32,15 @@ type RulesClient struct { } // NewRulesClient creates a new instance of RulesClient with the specified values. -func NewRulesClient(con *arm.Connection, subscriptionID string) *RulesClient { - return &RulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates a new rule and updates an existing rule @@ -94,7 +102,7 @@ func (client *RulesClient) createOrUpdateCreateRequest(ctx context.Context, reso func (client *RulesClient) createOrUpdateHandleResponse(resp *http.Response) (RulesCreateOrUpdateResponse, error) { result := RulesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Rule); err != nil { - return RulesCreateOrUpdateResponse{}, err + return RulesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -239,7 +247,7 @@ func (client *RulesClient) getCreateRequest(ctx context.Context, resourceGroupNa func (client *RulesClient) getHandleResponse(resp *http.Response) (RulesGetResponse, error) { result := RulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Rule); err != nil { - return RulesGetResponse{}, err + return RulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -315,7 +323,7 @@ func (client *RulesClient) listBySubscriptionsCreateRequest(ctx context.Context, func (client *RulesClient) listBySubscriptionsHandleResponse(resp *http.Response) (RulesListBySubscriptionsResponse, error) { result := RulesListBySubscriptionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RuleListResult); err != nil { - return RulesListBySubscriptionsResponse{}, err + return RulesListBySubscriptionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_subscriptions_client.go b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_subscriptions_client.go index 2be5f38853c8..949be385fb0d 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_subscriptions_client.go +++ b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_subscriptions_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // SubscriptionsClient contains the methods for the Subscriptions group. @@ -31,8 +32,15 @@ type SubscriptionsClient struct { } // NewSubscriptionsClient creates a new instance of SubscriptionsClient with the specified values. -func NewSubscriptionsClient(con *arm.Connection, subscriptionID string) *SubscriptionsClient { - return &SubscriptionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSubscriptionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SubscriptionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SubscriptionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates a topic subscription. @@ -90,7 +98,7 @@ func (client *SubscriptionsClient) createOrUpdateCreateRequest(ctx context.Conte func (client *SubscriptionsClient) createOrUpdateHandleResponse(resp *http.Response) (SubscriptionsCreateOrUpdateResponse, error) { result := SubscriptionsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBSubscription); err != nil { - return SubscriptionsCreateOrUpdateResponse{}, err + return SubscriptionsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -227,7 +235,7 @@ func (client *SubscriptionsClient) getCreateRequest(ctx context.Context, resourc func (client *SubscriptionsClient) getHandleResponse(resp *http.Response) (SubscriptionsGetResponse, error) { result := SubscriptionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBSubscription); err != nil { - return SubscriptionsGetResponse{}, err + return SubscriptionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -299,7 +307,7 @@ func (client *SubscriptionsClient) listByTopicCreateRequest(ctx context.Context, func (client *SubscriptionsClient) listByTopicHandleResponse(resp *http.Response) (SubscriptionsListByTopicResponse, error) { result := SubscriptionsListByTopicResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBSubscriptionListResult); err != nil { - return SubscriptionsListByTopicResponse{}, err + return SubscriptionsListByTopicResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_time_rfc3339.go b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_time_rfc3339.go index 69299a665fc9..60e2f5792ac7 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armservicebus import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_topics_client.go b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_topics_client.go index 6cb562d406ea..cf53d34ab6b9 100644 --- a/sdk/resourcemanager/servicebus/armservicebus/zz_generated_topics_client.go +++ b/sdk/resourcemanager/servicebus/armservicebus/zz_generated_topics_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // TopicsClient contains the methods for the Topics group. @@ -31,8 +32,15 @@ type TopicsClient struct { } // NewTopicsClient creates a new instance of TopicsClient with the specified values. -func NewTopicsClient(con *arm.Connection, subscriptionID string) *TopicsClient { - return &TopicsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTopicsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TopicsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TopicsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates a topic in the specified namespace. @@ -86,7 +94,7 @@ func (client *TopicsClient) createOrUpdateCreateRequest(ctx context.Context, res func (client *TopicsClient) createOrUpdateHandleResponse(resp *http.Response) (TopicsCreateOrUpdateResponse, error) { result := TopicsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBTopic); err != nil { - return TopicsCreateOrUpdateResponse{}, err + return TopicsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -159,7 +167,7 @@ func (client *TopicsClient) createOrUpdateAuthorizationRuleCreateRequest(ctx con func (client *TopicsClient) createOrUpdateAuthorizationRuleHandleResponse(resp *http.Response) (TopicsCreateOrUpdateAuthorizationRuleResponse, error) { result := TopicsCreateOrUpdateAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBAuthorizationRule); err != nil { - return TopicsCreateOrUpdateAuthorizationRuleResponse{}, err + return TopicsCreateOrUpdateAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -352,7 +360,7 @@ func (client *TopicsClient) getCreateRequest(ctx context.Context, resourceGroupN func (client *TopicsClient) getHandleResponse(resp *http.Response) (TopicsGetResponse, error) { result := TopicsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBTopic); err != nil { - return TopicsGetResponse{}, err + return TopicsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -425,7 +433,7 @@ func (client *TopicsClient) getAuthorizationRuleCreateRequest(ctx context.Contex func (client *TopicsClient) getAuthorizationRuleHandleResponse(resp *http.Response) (TopicsGetAuthorizationRuleResponse, error) { result := TopicsGetAuthorizationRuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBAuthorizationRule); err != nil { - return TopicsGetAuthorizationRuleResponse{}, err + return TopicsGetAuthorizationRuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -491,7 +499,7 @@ func (client *TopicsClient) listAuthorizationRulesCreateRequest(ctx context.Cont func (client *TopicsClient) listAuthorizationRulesHandleResponse(resp *http.Response) (TopicsListAuthorizationRulesResponse, error) { result := TopicsListAuthorizationRulesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBAuthorizationRuleListResult); err != nil { - return TopicsListAuthorizationRulesResponse{}, err + return TopicsListAuthorizationRulesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -559,7 +567,7 @@ func (client *TopicsClient) listByNamespaceCreateRequest(ctx context.Context, re func (client *TopicsClient) listByNamespaceHandleResponse(resp *http.Response) (TopicsListByNamespaceResponse, error) { result := TopicsListByNamespaceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SBTopicListResult); err != nil { - return TopicsListByNamespaceResponse{}, err + return TopicsListByNamespaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -632,7 +640,7 @@ func (client *TopicsClient) listKeysCreateRequest(ctx context.Context, resourceG func (client *TopicsClient) listKeysHandleResponse(resp *http.Response) (TopicsListKeysResponse, error) { result := TopicsListKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { - return TopicsListKeysResponse{}, err + return TopicsListKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -705,7 +713,7 @@ func (client *TopicsClient) regenerateKeysCreateRequest(ctx context.Context, res func (client *TopicsClient) regenerateKeysHandleResponse(resp *http.Response) (TopicsRegenerateKeysResponse, error) { result := TopicsRegenerateKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AccessKeys); err != nil { - return TopicsRegenerateKeysResponse{}, err + return TopicsRegenerateKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/servicefabric/armservicefabric/CHANGELOG.md b/sdk/resourcemanager/servicefabric/armservicefabric/CHANGELOG.md index 2276a757fdd8..626bf7231e27 100644 --- a/sdk/resourcemanager/servicefabric/armservicefabric/CHANGELOG.md +++ b/sdk/resourcemanager/servicefabric/armservicefabric/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-20) diff --git a/sdk/resourcemanager/servicefabric/armservicefabric/README.md b/sdk/resourcemanager/servicefabric/armservicefabric/README.md index ecbcdc12fbd6..8949e6f20352 100644 --- a/sdk/resourcemanager/servicefabric/armservicefabric/README.md +++ b/sdk/resourcemanager/servicefabric/armservicefabric/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Service Fabric +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Service Fabric modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armservicefabric.NewApplicationsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Service Fabric modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armservicefabric.NewApplicationsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armservicefabric.NewApplicationsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/servicefabric/armservicefabric/autorest.md b/sdk/resourcemanager/servicefabric/armservicefabric/autorest.md index a53a729b1e89..dff4b45886e2 100644 --- a/sdk/resourcemanager/servicefabric/armservicefabric/autorest.md +++ b/sdk/resourcemanager/servicefabric/armservicefabric/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/6ba37b7279bbd0d69042743246780cc3af9257b9/specification/servicefabric/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/6ba37b7279bbd0d69042743246780cc3af9257b9/specification/servicefabric/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/servicefabric/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/servicefabric/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/servicefabric/armservicefabric/go.mod b/sdk/resourcemanager/servicefabric/armservicefabric/go.mod index 42a1c16ca154..2e651b50ccc2 100644 --- a/sdk/resourcemanager/servicefabric/armservicefabric/go.mod +++ b/sdk/resourcemanager/servicefabric/armservicefabric/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/servicefabric/armse go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.2.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/servicefabric/armservicefabric/go.sum b/sdk/resourcemanager/servicefabric/armservicefabric/go.sum index c8ff7a2143ad..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/servicefabric/armservicefabric/go.sum +++ b/sdk/resourcemanager/servicefabric/armservicefabric/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible h1:iCb2tuoEm3N7ZpUDOvu1Yxl1B3iOVDmaD6weaRuIPzs= -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_applications_client.go b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_applications_client.go index b3ccd8385dc1..6e7144a60af3 100644 --- a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_applications_client.go +++ b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_applications_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ApplicationsClient contains the methods for the Applications group. @@ -31,8 +31,15 @@ type ApplicationsClient struct { } // NewApplicationsClient creates a new instance of ApplicationsClient with the specified values. -func NewApplicationsClient(con *arm.Connection, subscriptionID string) *ApplicationsClient { - return &ApplicationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewApplicationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ApplicationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ApplicationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update a Service Fabric application resource with the specified name. @@ -246,7 +253,7 @@ func (client *ApplicationsClient) getCreateRequest(ctx context.Context, resource func (client *ApplicationsClient) getHandleResponse(resp *http.Response) (ApplicationsGetResponse, error) { result := ApplicationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationResource); err != nil { - return ApplicationsGetResponse{}, err + return ApplicationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -311,7 +318,7 @@ func (client *ApplicationsClient) listCreateRequest(ctx context.Context, resourc func (client *ApplicationsClient) listHandleResponse(resp *http.Response) (ApplicationsListResponse, error) { result := ApplicationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationResourceList); err != nil { - return ApplicationsListResponse{}, err + return ApplicationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_applicationtypes_client.go b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_applicationtypes_client.go index af6f65ac1058..054f56fe0bcf 100644 --- a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_applicationtypes_client.go +++ b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_applicationtypes_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ApplicationTypesClient contains the methods for the ApplicationTypes group. @@ -31,8 +31,15 @@ type ApplicationTypesClient struct { } // NewApplicationTypesClient creates a new instance of ApplicationTypesClient with the specified values. -func NewApplicationTypesClient(con *arm.Connection, subscriptionID string) *ApplicationTypesClient { - return &ApplicationTypesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewApplicationTypesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ApplicationTypesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ApplicationTypesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update a Service Fabric application type name resource with the specified name. @@ -86,7 +93,7 @@ func (client *ApplicationTypesClient) createOrUpdateCreateRequest(ctx context.Co func (client *ApplicationTypesClient) createOrUpdateHandleResponse(resp *http.Response) (ApplicationTypesCreateOrUpdateResponse, error) { result := ApplicationTypesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationTypeResource); err != nil { - return ApplicationTypesCreateOrUpdateResponse{}, err + return ApplicationTypesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -235,7 +242,7 @@ func (client *ApplicationTypesClient) getCreateRequest(ctx context.Context, reso func (client *ApplicationTypesClient) getHandleResponse(resp *http.Response) (ApplicationTypesGetResponse, error) { result := ApplicationTypesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationTypeResource); err != nil { - return ApplicationTypesGetResponse{}, err + return ApplicationTypesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -300,7 +307,7 @@ func (client *ApplicationTypesClient) listCreateRequest(ctx context.Context, res func (client *ApplicationTypesClient) listHandleResponse(resp *http.Response) (ApplicationTypesListResponse, error) { result := ApplicationTypesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationTypeResourceList); err != nil { - return ApplicationTypesListResponse{}, err + return ApplicationTypesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_applicationtypeversions_client.go b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_applicationtypeversions_client.go index e778f498c735..a0676ca1d9b6 100644 --- a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_applicationtypeversions_client.go +++ b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_applicationtypeversions_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ApplicationTypeVersionsClient contains the methods for the ApplicationTypeVersions group. @@ -31,8 +31,15 @@ type ApplicationTypeVersionsClient struct { } // NewApplicationTypeVersionsClient creates a new instance of ApplicationTypeVersionsClient with the specified values. -func NewApplicationTypeVersionsClient(con *arm.Connection, subscriptionID string) *ApplicationTypeVersionsClient { - return &ApplicationTypeVersionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewApplicationTypeVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ApplicationTypeVersionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ApplicationTypeVersionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update a Service Fabric application type version resource with the specified name. @@ -258,7 +265,7 @@ func (client *ApplicationTypeVersionsClient) getCreateRequest(ctx context.Contex func (client *ApplicationTypeVersionsClient) getHandleResponse(resp *http.Response) (ApplicationTypeVersionsGetResponse, error) { result := ApplicationTypeVersionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationTypeVersionResource); err != nil { - return ApplicationTypeVersionsGetResponse{}, err + return ApplicationTypeVersionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -327,7 +334,7 @@ func (client *ApplicationTypeVersionsClient) listCreateRequest(ctx context.Conte func (client *ApplicationTypeVersionsClient) listHandleResponse(resp *http.Response) (ApplicationTypeVersionsListResponse, error) { result := ApplicationTypeVersionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationTypeVersionResourceList); err != nil { - return ApplicationTypeVersionsListResponse{}, err + return ApplicationTypeVersionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_clusters_client.go b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_clusters_client.go index 3ae35c785e77..0644e1081980 100644 --- a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_clusters_client.go +++ b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_clusters_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ClustersClient contains the methods for the Clusters group. @@ -31,8 +31,15 @@ type ClustersClient struct { } // NewClustersClient creates a new instance of ClustersClient with the specified values. -func NewClustersClient(con *arm.Connection, subscriptionID string) *ClustersClient { - return &ClustersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ClustersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ClustersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update a Service Fabric cluster resource with the specified name. @@ -214,7 +221,7 @@ func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGrou func (client *ClustersClient) getHandleResponse(resp *http.Response) (ClustersGetResponse, error) { result := ClustersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Cluster); err != nil { - return ClustersGetResponse{}, err + return ClustersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -271,7 +278,7 @@ func (client *ClustersClient) listCreateRequest(ctx context.Context, options *Cl func (client *ClustersClient) listHandleResponse(resp *http.Response) (ClustersListResponse, error) { result := ClustersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ClusterListResult); err != nil { - return ClustersListResponse{}, err + return ClustersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -332,7 +339,7 @@ func (client *ClustersClient) listByResourceGroupCreateRequest(ctx context.Conte func (client *ClustersClient) listByResourceGroupHandleResponse(resp *http.Response) (ClustersListByResourceGroupResponse, error) { result := ClustersListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ClusterListResult); err != nil { - return ClustersListByResourceGroupResponse{}, err + return ClustersListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -402,7 +409,7 @@ func (client *ClustersClient) listUpgradableVersionsCreateRequest(ctx context.Co func (client *ClustersClient) listUpgradableVersionsHandleResponse(resp *http.Response) (ClustersListUpgradableVersionsResponse, error) { result := ClustersListUpgradableVersionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UpgradableVersionPathResult); err != nil { - return ClustersListUpgradableVersionsResponse{}, err + return ClustersListUpgradableVersionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_clusterversions_client.go b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_clusterversions_client.go index 93a2a7f38b7d..f1720b502352 100644 --- a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_clusterversions_client.go +++ b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_clusterversions_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ClusterVersionsClient contains the methods for the ClusterVersions group. @@ -30,8 +31,15 @@ type ClusterVersionsClient struct { } // NewClusterVersionsClient creates a new instance of ClusterVersionsClient with the specified values. -func NewClusterVersionsClient(con *arm.Connection, subscriptionID string) *ClusterVersionsClient { - return &ClusterVersionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewClusterVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ClusterVersionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ClusterVersionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets information about an available Service Fabric cluster code version. @@ -81,7 +89,7 @@ func (client *ClusterVersionsClient) getCreateRequest(ctx context.Context, locat func (client *ClusterVersionsClient) getHandleResponse(resp *http.Response) (ClusterVersionsGetResponse, error) { result := ClusterVersionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ClusterCodeVersionsListResult); err != nil { - return ClusterVersionsGetResponse{}, err + return ClusterVersionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -150,7 +158,7 @@ func (client *ClusterVersionsClient) getByEnvironmentCreateRequest(ctx context.C func (client *ClusterVersionsClient) getByEnvironmentHandleResponse(resp *http.Response) (ClusterVersionsGetByEnvironmentResponse, error) { result := ClusterVersionsGetByEnvironmentResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ClusterCodeVersionsListResult); err != nil { - return ClusterVersionsGetByEnvironmentResponse{}, err + return ClusterVersionsGetByEnvironmentResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -211,7 +219,7 @@ func (client *ClusterVersionsClient) listCreateRequest(ctx context.Context, loca func (client *ClusterVersionsClient) listHandleResponse(resp *http.Response) (ClusterVersionsListResponse, error) { result := ClusterVersionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ClusterCodeVersionsListResult); err != nil { - return ClusterVersionsListResponse{}, err + return ClusterVersionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -276,7 +284,7 @@ func (client *ClusterVersionsClient) listByEnvironmentCreateRequest(ctx context. func (client *ClusterVersionsClient) listByEnvironmentHandleResponse(resp *http.Response) (ClusterVersionsListByEnvironmentResponse, error) { result := ClusterVersionsListByEnvironmentResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ClusterCodeVersionsListResult); err != nil { - return ClusterVersionsListByEnvironmentResponse{}, err + return ClusterVersionsListByEnvironmentResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_constants.go b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_constants.go index 186ceda7cdca..48c8bc592231 100644 --- a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_constants.go +++ b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_constants.go @@ -10,7 +10,7 @@ package armservicefabric const ( module = "armservicefabric" - version = "v0.1.1" + version = "v0.2.0" ) // AddOnFeatures - Available cluster add-on features diff --git a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_models.go b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_models.go index 09de67848673..47d095fc88cc 100644 --- a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_models.go +++ b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_models.go @@ -10,10 +10,9 @@ package armservicefabric import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // ApplicationDeltaHealthPolicy - Defines a delta health policy used to evaluate the health of an application or one of its child entities when upgrading @@ -868,8 +867,8 @@ func (c ClusterProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "sfZonalUpgradeMode", c.SfZonalUpgradeMode) populate(objectMap, "upgradeDescription", c.UpgradeDescription) populate(objectMap, "upgradeMode", c.UpgradeMode) - populate(objectMap, "upgradePauseEndTimestampUtc", (*timeRFC3339)(c.UpgradePauseEndTimestampUTC)) - populate(objectMap, "upgradePauseStartTimestampUtc", (*timeRFC3339)(c.UpgradePauseStartTimestampUTC)) + populateTimeRFC3339(objectMap, "upgradePauseEndTimestampUtc", c.UpgradePauseEndTimestampUTC) + populateTimeRFC3339(objectMap, "upgradePauseStartTimestampUtc", c.UpgradePauseStartTimestampUTC) populate(objectMap, "upgradeWave", c.UpgradeWave) populate(objectMap, "vmImage", c.VMImage) populate(objectMap, "vmssZonalUpgradeMode", c.VmssZonalUpgradeMode) @@ -965,14 +964,10 @@ func (c *ClusterProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.UpgradeMode) delete(rawMsg, key) case "upgradePauseEndTimestampUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.UpgradePauseEndTimestampUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.UpgradePauseEndTimestampUTC) delete(rawMsg, key) case "upgradePauseStartTimestampUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.UpgradePauseStartTimestampUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.UpgradePauseStartTimestampUTC) delete(rawMsg, key) case "upgradeWave": err = unpopulate(val, &c.UpgradeWave) @@ -1094,8 +1089,8 @@ func (c ClusterPropertiesUpdateParameters) MarshalJSON() ([]byte, error) { populate(objectMap, "sfZonalUpgradeMode", c.SfZonalUpgradeMode) populate(objectMap, "upgradeDescription", c.UpgradeDescription) populate(objectMap, "upgradeMode", c.UpgradeMode) - populate(objectMap, "upgradePauseEndTimestampUtc", (*timeRFC3339)(c.UpgradePauseEndTimestampUTC)) - populate(objectMap, "upgradePauseStartTimestampUtc", (*timeRFC3339)(c.UpgradePauseStartTimestampUTC)) + populateTimeRFC3339(objectMap, "upgradePauseEndTimestampUtc", c.UpgradePauseEndTimestampUTC) + populateTimeRFC3339(objectMap, "upgradePauseStartTimestampUtc", c.UpgradePauseStartTimestampUTC) populate(objectMap, "upgradeWave", c.UpgradeWave) populate(objectMap, "vmssZonalUpgradeMode", c.VmssZonalUpgradeMode) populate(objectMap, "waveUpgradePaused", c.WaveUpgradePaused) @@ -1163,14 +1158,10 @@ func (c *ClusterPropertiesUpdateParameters) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.UpgradeMode) delete(rawMsg, key) case "upgradePauseEndTimestampUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.UpgradePauseEndTimestampUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.UpgradePauseEndTimestampUTC) delete(rawMsg, key) case "upgradePauseStartTimestampUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.UpgradePauseStartTimestampUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.UpgradePauseStartTimestampUTC) delete(rawMsg, key) case "upgradeWave": err = unpopulate(val, &c.UpgradeWave) @@ -2286,9 +2277,9 @@ func (s StatefulServiceProperties) MarshalJSON() ([]byte, error) { s.ServiceResourceProperties.marshalInternal(objectMap, ServiceKindStateful) populate(objectMap, "hasPersistedState", s.HasPersistedState) populate(objectMap, "minReplicaSetSize", s.MinReplicaSetSize) - populate(objectMap, "quorumLossWaitDuration", (*timeRFC3339)(s.QuorumLossWaitDuration)) - populate(objectMap, "replicaRestartWaitDuration", (*timeRFC3339)(s.ReplicaRestartWaitDuration)) - populate(objectMap, "standByReplicaKeepDuration", (*timeRFC3339)(s.StandByReplicaKeepDuration)) + populateTimeRFC3339(objectMap, "quorumLossWaitDuration", s.QuorumLossWaitDuration) + populateTimeRFC3339(objectMap, "replicaRestartWaitDuration", s.ReplicaRestartWaitDuration) + populateTimeRFC3339(objectMap, "standByReplicaKeepDuration", s.StandByReplicaKeepDuration) populate(objectMap, "targetReplicaSetSize", s.TargetReplicaSetSize) return json.Marshal(objectMap) } @@ -2309,19 +2300,13 @@ func (s *StatefulServiceProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.MinReplicaSetSize) delete(rawMsg, key) case "quorumLossWaitDuration": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.QuorumLossWaitDuration = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.QuorumLossWaitDuration) delete(rawMsg, key) case "replicaRestartWaitDuration": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.ReplicaRestartWaitDuration = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.ReplicaRestartWaitDuration) delete(rawMsg, key) case "standByReplicaKeepDuration": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.StandByReplicaKeepDuration = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.StandByReplicaKeepDuration) delete(rawMsg, key) case "targetReplicaSetSize": err = unpopulate(val, &s.TargetReplicaSetSize) @@ -2361,9 +2346,9 @@ func (s StatefulServiceUpdateProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) s.ServiceResourceUpdateProperties.marshalInternal(objectMap, ServiceKindStateful) populate(objectMap, "minReplicaSetSize", s.MinReplicaSetSize) - populate(objectMap, "quorumLossWaitDuration", (*timeRFC3339)(s.QuorumLossWaitDuration)) - populate(objectMap, "replicaRestartWaitDuration", (*timeRFC3339)(s.ReplicaRestartWaitDuration)) - populate(objectMap, "standByReplicaKeepDuration", (*timeRFC3339)(s.StandByReplicaKeepDuration)) + populateTimeRFC3339(objectMap, "quorumLossWaitDuration", s.QuorumLossWaitDuration) + populateTimeRFC3339(objectMap, "replicaRestartWaitDuration", s.ReplicaRestartWaitDuration) + populateTimeRFC3339(objectMap, "standByReplicaKeepDuration", s.StandByReplicaKeepDuration) populate(objectMap, "targetReplicaSetSize", s.TargetReplicaSetSize) return json.Marshal(objectMap) } @@ -2381,19 +2366,13 @@ func (s *StatefulServiceUpdateProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.MinReplicaSetSize) delete(rawMsg, key) case "quorumLossWaitDuration": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.QuorumLossWaitDuration = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.QuorumLossWaitDuration) delete(rawMsg, key) case "replicaRestartWaitDuration": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.ReplicaRestartWaitDuration = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.ReplicaRestartWaitDuration) delete(rawMsg, key) case "standByReplicaKeepDuration": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.StandByReplicaKeepDuration = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.StandByReplicaKeepDuration) delete(rawMsg, key) case "targetReplicaSetSize": err = unpopulate(val, &s.TargetReplicaSetSize) @@ -2533,10 +2512,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -2552,9 +2531,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -2563,9 +2540,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) diff --git a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_operations_client.go b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_operations_client.go index ae6ce89e2843..0daf75361087 100644 --- a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_operations_client.go +++ b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armservicefabric import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Get the list of available Service Fabric resource provider API operations. @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_pagers.go b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_pagers.go index 4a940e8e7e3c..a55b06ec3c74 100644 --- a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_pagers.go +++ b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armservicefabric import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // OperationsListPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_pollers.go b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_pollers.go index d8cca92f599f..3d6471e1e154 100644 --- a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_pollers.go +++ b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armservicefabric import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // ApplicationTypeVersionsCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_polymorphic_helpers.go index 9521d2f9e0db..0330162d8cf0 100644 --- a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_polymorphic_helpers.go @@ -51,6 +51,25 @@ func unmarshalPartitionSchemeDescriptionClassificationArray(rawMsg json.RawMessa return fArray, nil } +func unmarshalPartitionSchemeDescriptionClassificationMap(rawMsg json.RawMessage) (map[string]PartitionSchemeDescriptionClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]PartitionSchemeDescriptionClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalPartitionSchemeDescriptionClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalServicePlacementPolicyDescriptionClassification(rawMsg json.RawMessage) (ServicePlacementPolicyDescriptionClassification, error) { if rawMsg == nil { return nil, nil @@ -86,6 +105,25 @@ func unmarshalServicePlacementPolicyDescriptionClassificationArray(rawMsg json.R return fArray, nil } +func unmarshalServicePlacementPolicyDescriptionClassificationMap(rawMsg json.RawMessage) (map[string]ServicePlacementPolicyDescriptionClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ServicePlacementPolicyDescriptionClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalServicePlacementPolicyDescriptionClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalServiceResourcePropertiesClassification(rawMsg json.RawMessage) (ServiceResourcePropertiesClassification, error) { if rawMsg == nil { return nil, nil @@ -125,6 +163,25 @@ func unmarshalServiceResourcePropertiesClassificationArray(rawMsg json.RawMessag return fArray, nil } +func unmarshalServiceResourcePropertiesClassificationMap(rawMsg json.RawMessage) (map[string]ServiceResourcePropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ServiceResourcePropertiesClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalServiceResourcePropertiesClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalServiceResourceUpdatePropertiesClassification(rawMsg json.RawMessage) (ServiceResourceUpdatePropertiesClassification, error) { if rawMsg == nil { return nil, nil @@ -163,3 +220,22 @@ func unmarshalServiceResourceUpdatePropertiesClassificationArray(rawMsg json.Raw } return fArray, nil } + +func unmarshalServiceResourceUpdatePropertiesClassificationMap(rawMsg json.RawMessage) (map[string]ServiceResourceUpdatePropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ServiceResourceUpdatePropertiesClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalServiceResourceUpdatePropertiesClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_response_types.go b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_response_types.go index 47cf9fd0f48d..a470ce14c578 100644 --- a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_response_types.go +++ b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armservicefabric import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // ApplicationTypeVersionsCreateOrUpdatePollerResponse contains the response from method ApplicationTypeVersions.CreateOrUpdate. @@ -26,6 +25,8 @@ type ApplicationTypeVersionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ApplicationTypeVersionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ApplicationTypeVersionsCreateOrUpdateResponse, error) { respType := ApplicationTypeVersionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ApplicationTypeVersionResource) @@ -76,6 +77,8 @@ type ApplicationTypeVersionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ApplicationTypeVersionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ApplicationTypeVersionsDeleteResponse, error) { respType := ApplicationTypeVersionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -156,6 +159,8 @@ type ApplicationTypesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ApplicationTypesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ApplicationTypesDeleteResponse, error) { respType := ApplicationTypesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -224,6 +229,8 @@ type ApplicationsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ApplicationsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ApplicationsCreateOrUpdateResponse, error) { respType := ApplicationsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ApplicationResource) @@ -274,6 +281,8 @@ type ApplicationsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ApplicationsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ApplicationsDeleteResponse, error) { respType := ApplicationsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -342,6 +351,8 @@ type ApplicationsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ApplicationsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ApplicationsUpdateResponse, error) { respType := ApplicationsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ApplicationResource) @@ -440,6 +451,8 @@ type ClustersCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ClustersCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClustersCreateOrUpdateResponse, error) { respType := ClustersCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Cluster) @@ -544,6 +557,8 @@ type ClustersUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ClustersUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClustersUpdateResponse, error) { respType := ClustersUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Cluster) @@ -606,6 +621,8 @@ type ServicesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServicesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServicesCreateOrUpdateResponse, error) { respType := ServicesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServiceResource) @@ -656,6 +673,8 @@ type ServicesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServicesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServicesDeleteResponse, error) { respType := ServicesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -724,6 +743,8 @@ type ServicesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServicesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServicesUpdateResponse, error) { respType := ServicesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServiceResource) diff --git a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_services_client.go b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_services_client.go index 9b9bd1ffe36d..9d79fa285ef8 100644 --- a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_services_client.go +++ b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_services_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServicesClient contains the methods for the Services group. @@ -31,8 +31,15 @@ type ServicesClient struct { } // NewServicesClient creates a new instance of ServicesClient with the specified values. -func NewServicesClient(con *arm.Connection, subscriptionID string) *ServicesClient { - return &ServicesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServicesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServicesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create or update a Service Fabric service resource with the specified name. @@ -258,7 +265,7 @@ func (client *ServicesClient) getCreateRequest(ctx context.Context, resourceGrou func (client *ServicesClient) getHandleResponse(resp *http.Response) (ServicesGetResponse, error) { result := ServicesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServiceResource); err != nil { - return ServicesGetResponse{}, err + return ServicesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -327,7 +334,7 @@ func (client *ServicesClient) listCreateRequest(ctx context.Context, resourceGro func (client *ServicesClient) listHandleResponse(resp *http.Response) (ServicesListResponse, error) { result := ServicesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServiceResourceList); err != nil { - return ServicesListResponse{}, err + return ServicesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_time_rfc3339.go b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_time_rfc3339.go index 0ffc7dcef342..a263bf855c17 100644 --- a/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/servicefabric/armservicefabric/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armservicefabric import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/sql/armsql/CHANGELOG.md b/sdk/resourcemanager/sql/armsql/CHANGELOG.md index 510dec532d52..457b198faf8d 100644 --- a/sdk/resourcemanager/sql/armsql/CHANGELOG.md +++ b/sdk/resourcemanager/sql/armsql/CHANGELOG.md @@ -1,5 +1,12 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.1 (2021-10-14) - fix wrong module path in go.mod diff --git a/sdk/resourcemanager/sql/armsql/README.md b/sdk/resourcemanager/sql/armsql/README.md index 51bc1757f6d7..56f45aa3bd4f 100644 --- a/sdk/resourcemanager/sql/armsql/README.md +++ b/sdk/resourcemanager/sql/armsql/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure SQL Database +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure SQL Database modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armsql.NewInstanceFailoverGroupsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure SQL Database modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armsql.NewInstanceFailoverGroupsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armsql.NewInstanceFailoverGroupsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/sql/armsql/autorest.md b/sdk/resourcemanager/sql/armsql/autorest.md index c4153709fd2b..c9a4d573fcb8 100644 --- a/sdk/resourcemanager/sql/armsql/autorest.md +++ b/sdk/resourcemanager/sql/armsql/autorest.md @@ -5,10 +5,10 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/sql/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/sql/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/sql/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/sql/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.1 +module-version: 0.2.0 modelerfour: seal-single-value-enum-by-default: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/sql/armsql/go.mod b/sdk/resourcemanager/sql/armsql/go.mod index f1e66213bc09..bcacc9b4f2e4 100644 --- a/sdk/resourcemanager/sql/armsql/go.mod +++ b/sdk/resourcemanager/sql/armsql/go.mod @@ -3,9 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/sql/armsql go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.1.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) - -// fix wrong module path in go.mod -retract v0.1.0 diff --git a/sdk/resourcemanager/sql/armsql/go.sum b/sdk/resourcemanager/sql/armsql/go.sum index f37ba2aef08b..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/sql/armsql/go.sum +++ b/sdk/resourcemanager/sql/armsql/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible h1:WFsr3Efy7uweykOAEfOHO3ACtuwIv+rrFmSn9K48VnA= -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_backupshorttermretentionpolicies_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_backupshorttermretentionpolicies_client.go index 268588fcc61c..552a7f75ac25 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_backupshorttermretentionpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_backupshorttermretentionpolicies_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // BackupShortTermRetentionPoliciesClient contains the methods for the BackupShortTermRetentionPolicies group. @@ -30,8 +30,15 @@ type BackupShortTermRetentionPoliciesClient struct { } // NewBackupShortTermRetentionPoliciesClient creates a new instance of BackupShortTermRetentionPoliciesClient with the specified values. -func NewBackupShortTermRetentionPoliciesClient(con *arm.Connection, subscriptionID string) *BackupShortTermRetentionPoliciesClient { - return &BackupShortTermRetentionPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewBackupShortTermRetentionPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *BackupShortTermRetentionPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &BackupShortTermRetentionPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Updates a database's short term retention policy. @@ -172,7 +179,7 @@ func (client *BackupShortTermRetentionPoliciesClient) getCreateRequest(ctx conte func (client *BackupShortTermRetentionPoliciesClient) getHandleResponse(resp *http.Response) (BackupShortTermRetentionPoliciesGetResponse, error) { result := BackupShortTermRetentionPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BackupShortTermRetentionPolicy); err != nil { - return BackupShortTermRetentionPoliciesGetResponse{}, err + return BackupShortTermRetentionPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -237,7 +244,7 @@ func (client *BackupShortTermRetentionPoliciesClient) listByDatabaseCreateReques func (client *BackupShortTermRetentionPoliciesClient) listByDatabaseHandleResponse(resp *http.Response) (BackupShortTermRetentionPoliciesListByDatabaseResponse, error) { result := BackupShortTermRetentionPoliciesListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BackupShortTermRetentionPolicyListResult); err != nil { - return BackupShortTermRetentionPoliciesListByDatabaseResponse{}, err + return BackupShortTermRetentionPoliciesListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_capabilities_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_capabilities_client.go index 46d7b2ef90f9..9144e8def7da 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_capabilities_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_capabilities_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CapabilitiesClient contains the methods for the Capabilities group. @@ -29,8 +30,15 @@ type CapabilitiesClient struct { } // NewCapabilitiesClient creates a new instance of CapabilitiesClient with the specified values. -func NewCapabilitiesClient(con *arm.Connection, subscriptionID string) *CapabilitiesClient { - return &CapabilitiesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCapabilitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CapabilitiesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CapabilitiesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByLocation - Gets the subscription capabilities available for the specified location. @@ -79,7 +87,7 @@ func (client *CapabilitiesClient) listByLocationCreateRequest(ctx context.Contex func (client *CapabilitiesClient) listByLocationHandleResponse(resp *http.Response) (CapabilitiesListByLocationResponse, error) { result := CapabilitiesListByLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LocationCapabilities); err != nil { - return CapabilitiesListByLocationResponse{}, err + return CapabilitiesListByLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_constants.go b/sdk/resourcemanager/sql/armsql/zz_generated_constants.go index 14fd054f0728..b651e84cc501 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_constants.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_constants.go @@ -10,7 +10,7 @@ package armsql const ( module = "armsql" - version = "v0.1.1" + version = "v0.2.0" ) type AdministratorName string diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_databaseadvisors_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_databaseadvisors_client.go index e8b0408b3ff4..66783e9cfb7a 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_databaseadvisors_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_databaseadvisors_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabaseAdvisorsClient contains the methods for the DatabaseAdvisors group. @@ -29,8 +30,15 @@ type DatabaseAdvisorsClient struct { } // NewDatabaseAdvisorsClient creates a new instance of DatabaseAdvisorsClient with the specified values. -func NewDatabaseAdvisorsClient(con *arm.Connection, subscriptionID string) *DatabaseAdvisorsClient { - return &DatabaseAdvisorsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabaseAdvisorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabaseAdvisorsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabaseAdvisorsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a database advisor. @@ -88,7 +96,7 @@ func (client *DatabaseAdvisorsClient) getCreateRequest(ctx context.Context, reso func (client *DatabaseAdvisorsClient) getHandleResponse(resp *http.Response) (DatabaseAdvisorsGetResponse, error) { result := DatabaseAdvisorsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Advisor); err != nil { - return DatabaseAdvisorsGetResponse{}, err + return DatabaseAdvisorsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -159,7 +167,7 @@ func (client *DatabaseAdvisorsClient) listByDatabaseCreateRequest(ctx context.Co func (client *DatabaseAdvisorsClient) listByDatabaseHandleResponse(resp *http.Response) (DatabaseAdvisorsListByDatabaseResponse, error) { result := DatabaseAdvisorsListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AdvisorArray); err != nil { - return DatabaseAdvisorsListByDatabaseResponse{}, err + return DatabaseAdvisorsListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -231,7 +239,7 @@ func (client *DatabaseAdvisorsClient) updateCreateRequest(ctx context.Context, r func (client *DatabaseAdvisorsClient) updateHandleResponse(resp *http.Response) (DatabaseAdvisorsUpdateResponse, error) { result := DatabaseAdvisorsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Advisor); err != nil { - return DatabaseAdvisorsUpdateResponse{}, err + return DatabaseAdvisorsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_databaseautomatictuning_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_databaseautomatictuning_client.go index 7526e08da047..1d058c683509 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_databaseautomatictuning_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_databaseautomatictuning_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabaseAutomaticTuningClient contains the methods for the DatabaseAutomaticTuning group. @@ -29,8 +30,15 @@ type DatabaseAutomaticTuningClient struct { } // NewDatabaseAutomaticTuningClient creates a new instance of DatabaseAutomaticTuningClient with the specified values. -func NewDatabaseAutomaticTuningClient(con *arm.Connection, subscriptionID string) *DatabaseAutomaticTuningClient { - return &DatabaseAutomaticTuningClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabaseAutomaticTuningClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabaseAutomaticTuningClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabaseAutomaticTuningClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a database's automatic tuning. @@ -84,7 +92,7 @@ func (client *DatabaseAutomaticTuningClient) getCreateRequest(ctx context.Contex func (client *DatabaseAutomaticTuningClient) getHandleResponse(resp *http.Response) (DatabaseAutomaticTuningGetResponse, error) { result := DatabaseAutomaticTuningGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseAutomaticTuning); err != nil { - return DatabaseAutomaticTuningGetResponse{}, err + return DatabaseAutomaticTuningGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -152,7 +160,7 @@ func (client *DatabaseAutomaticTuningClient) updateCreateRequest(ctx context.Con func (client *DatabaseAutomaticTuningClient) updateHandleResponse(resp *http.Response) (DatabaseAutomaticTuningUpdateResponse, error) { result := DatabaseAutomaticTuningUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseAutomaticTuning); err != nil { - return DatabaseAutomaticTuningUpdateResponse{}, err + return DatabaseAutomaticTuningUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_databaseblobauditingpolicies_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_databaseblobauditingpolicies_client.go index f69bebef6dd8..b1da8b2bde43 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_databaseblobauditingpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_databaseblobauditingpolicies_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabaseBlobAuditingPoliciesClient contains the methods for the DatabaseBlobAuditingPolicies group. @@ -29,8 +30,15 @@ type DatabaseBlobAuditingPoliciesClient struct { } // NewDatabaseBlobAuditingPoliciesClient creates a new instance of DatabaseBlobAuditingPoliciesClient with the specified values. -func NewDatabaseBlobAuditingPoliciesClient(con *arm.Connection, subscriptionID string) *DatabaseBlobAuditingPoliciesClient { - return &DatabaseBlobAuditingPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabaseBlobAuditingPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabaseBlobAuditingPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabaseBlobAuditingPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a database's blob auditing policy. @@ -85,7 +93,7 @@ func (client *DatabaseBlobAuditingPoliciesClient) createOrUpdateCreateRequest(ct func (client *DatabaseBlobAuditingPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (DatabaseBlobAuditingPoliciesCreateOrUpdateResponse, error) { result := DatabaseBlobAuditingPoliciesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseBlobAuditingPolicy); err != nil { - return DatabaseBlobAuditingPoliciesCreateOrUpdateResponse{}, err + return DatabaseBlobAuditingPoliciesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -154,7 +162,7 @@ func (client *DatabaseBlobAuditingPoliciesClient) getCreateRequest(ctx context.C func (client *DatabaseBlobAuditingPoliciesClient) getHandleResponse(resp *http.Response) (DatabaseBlobAuditingPoliciesGetResponse, error) { result := DatabaseBlobAuditingPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseBlobAuditingPolicy); err != nil { - return DatabaseBlobAuditingPoliciesGetResponse{}, err + return DatabaseBlobAuditingPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -219,7 +227,7 @@ func (client *DatabaseBlobAuditingPoliciesClient) listByDatabaseCreateRequest(ct func (client *DatabaseBlobAuditingPoliciesClient) listByDatabaseHandleResponse(resp *http.Response) (DatabaseBlobAuditingPoliciesListByDatabaseResponse, error) { result := DatabaseBlobAuditingPoliciesListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseBlobAuditingPolicyListResult); err != nil { - return DatabaseBlobAuditingPoliciesListByDatabaseResponse{}, err + return DatabaseBlobAuditingPoliciesListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_databasecolumns_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_databasecolumns_client.go index e1d0818b326a..4d5d0391ed05 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_databasecolumns_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_databasecolumns_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabaseColumnsClient contains the methods for the DatabaseColumns group. @@ -29,8 +30,15 @@ type DatabaseColumnsClient struct { } // NewDatabaseColumnsClient creates a new instance of DatabaseColumnsClient with the specified values. -func NewDatabaseColumnsClient(con *arm.Connection, subscriptionID string) *DatabaseColumnsClient { - return &DatabaseColumnsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabaseColumnsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabaseColumnsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabaseColumnsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get database column @@ -96,7 +104,7 @@ func (client *DatabaseColumnsClient) getCreateRequest(ctx context.Context, resou func (client *DatabaseColumnsClient) getHandleResponse(resp *http.Response) (DatabaseColumnsGetResponse, error) { result := DatabaseColumnsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseColumn); err != nil { - return DatabaseColumnsGetResponse{}, err + return DatabaseColumnsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -184,7 +192,7 @@ func (client *DatabaseColumnsClient) listByDatabaseCreateRequest(ctx context.Con func (client *DatabaseColumnsClient) listByDatabaseHandleResponse(resp *http.Response) (DatabaseColumnsListByDatabaseResponse, error) { result := DatabaseColumnsListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseColumnListResult); err != nil { - return DatabaseColumnsListByDatabaseResponse{}, err + return DatabaseColumnsListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -260,7 +268,7 @@ func (client *DatabaseColumnsClient) listByTableCreateRequest(ctx context.Contex func (client *DatabaseColumnsClient) listByTableHandleResponse(resp *http.Response) (DatabaseColumnsListByTableResponse, error) { result := DatabaseColumnsListByTableResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseColumnListResult); err != nil { - return DatabaseColumnsListByTableResponse{}, err + return DatabaseColumnsListByTableResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_databaseextensions_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_databaseextensions_client.go index 7867c96ea45d..41ea7a77dcfd 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_databaseextensions_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_databaseextensions_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabaseExtensionsClient contains the methods for the DatabaseExtensions group. @@ -30,8 +30,15 @@ type DatabaseExtensionsClient struct { } // NewDatabaseExtensionsClient creates a new instance of DatabaseExtensionsClient with the specified values. -func NewDatabaseExtensionsClient(con *arm.Connection, subscriptionID string) *DatabaseExtensionsClient { - return &DatabaseExtensionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabaseExtensionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabaseExtensionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabaseExtensionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Perform a database extension operation, like polybase import @@ -227,7 +234,7 @@ func (client *DatabaseExtensionsClient) listByDatabaseCreateRequest(ctx context. func (client *DatabaseExtensionsClient) listByDatabaseHandleResponse(resp *http.Response) (DatabaseExtensionsListByDatabaseResponse, error) { result := DatabaseExtensionsListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ImportExportExtensionsOperationListResult); err != nil { - return DatabaseExtensionsListByDatabaseResponse{}, err + return DatabaseExtensionsListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_databaseoperations_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_databaseoperations_client.go index a2ad2785eb0b..bdb8ffe0a24a 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_databaseoperations_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_databaseoperations_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabaseOperationsClient contains the methods for the DatabaseOperations group. @@ -29,8 +30,15 @@ type DatabaseOperationsClient struct { } // NewDatabaseOperationsClient creates a new instance of DatabaseOperationsClient with the specified values. -func NewDatabaseOperationsClient(con *arm.Connection, subscriptionID string) *DatabaseOperationsClient { - return &DatabaseOperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabaseOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabaseOperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabaseOperationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Cancel - Cancels the asynchronous operation on the database. @@ -140,7 +148,7 @@ func (client *DatabaseOperationsClient) listByDatabaseCreateRequest(ctx context. func (client *DatabaseOperationsClient) listByDatabaseHandleResponse(resp *http.Response) (DatabaseOperationsListByDatabaseResponse, error) { result := DatabaseOperationsListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseOperationListResult); err != nil { - return DatabaseOperationsListByDatabaseResponse{}, err + return DatabaseOperationsListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_databaserecommendedactions_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_databaserecommendedactions_client.go index 9fa1c1c120d5..b1c79e0973d0 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_databaserecommendedactions_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_databaserecommendedactions_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabaseRecommendedActionsClient contains the methods for the DatabaseRecommendedActions group. @@ -29,8 +30,15 @@ type DatabaseRecommendedActionsClient struct { } // NewDatabaseRecommendedActionsClient creates a new instance of DatabaseRecommendedActionsClient with the specified values. -func NewDatabaseRecommendedActionsClient(con *arm.Connection, subscriptionID string) *DatabaseRecommendedActionsClient { - return &DatabaseRecommendedActionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabaseRecommendedActionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabaseRecommendedActionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabaseRecommendedActionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a database recommended action. @@ -92,7 +100,7 @@ func (client *DatabaseRecommendedActionsClient) getCreateRequest(ctx context.Con func (client *DatabaseRecommendedActionsClient) getHandleResponse(resp *http.Response) (DatabaseRecommendedActionsGetResponse, error) { result := DatabaseRecommendedActionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecommendedAction); err != nil { - return DatabaseRecommendedActionsGetResponse{}, err + return DatabaseRecommendedActionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -164,7 +172,7 @@ func (client *DatabaseRecommendedActionsClient) listByDatabaseAdvisorCreateReque func (client *DatabaseRecommendedActionsClient) listByDatabaseAdvisorHandleResponse(resp *http.Response) (DatabaseRecommendedActionsListByDatabaseAdvisorResponse, error) { result := DatabaseRecommendedActionsListByDatabaseAdvisorResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecommendedActionArray); err != nil { - return DatabaseRecommendedActionsListByDatabaseAdvisorResponse{}, err + return DatabaseRecommendedActionsListByDatabaseAdvisorResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -240,7 +248,7 @@ func (client *DatabaseRecommendedActionsClient) updateCreateRequest(ctx context. func (client *DatabaseRecommendedActionsClient) updateHandleResponse(resp *http.Response) (DatabaseRecommendedActionsUpdateResponse, error) { result := DatabaseRecommendedActionsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecommendedAction); err != nil { - return DatabaseRecommendedActionsUpdateResponse{}, err + return DatabaseRecommendedActionsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_databases_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_databases_client.go index baf5fb6c40f3..a7c32c369a70 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_databases_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_databases_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabasesClient contains the methods for the Databases group. @@ -30,8 +30,15 @@ type DatabasesClient struct { } // NewDatabasesClient creates a new instance of DatabasesClient with the specified values. -func NewDatabasesClient(con *arm.Connection, subscriptionID string) *DatabasesClient { - return &DatabasesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabasesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabasesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a new database or updates an existing database. @@ -402,7 +409,7 @@ func (client *DatabasesClient) getCreateRequest(ctx context.Context, resourceGro func (client *DatabasesClient) getHandleResponse(resp *http.Response) (DatabasesGetResponse, error) { result := DatabasesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Database); err != nil { - return DatabasesGetResponse{}, err + return DatabasesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -546,7 +553,7 @@ func (client *DatabasesClient) listByElasticPoolCreateRequest(ctx context.Contex func (client *DatabasesClient) listByElasticPoolHandleResponse(resp *http.Response) (DatabasesListByElasticPoolResponse, error) { result := DatabasesListByElasticPoolResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseListResult); err != nil { - return DatabasesListByElasticPoolResponse{}, err + return DatabasesListByElasticPoolResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -610,7 +617,7 @@ func (client *DatabasesClient) listByServerCreateRequest(ctx context.Context, re func (client *DatabasesClient) listByServerHandleResponse(resp *http.Response) (DatabasesListByServerResponse, error) { result := DatabasesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseListResult); err != nil { - return DatabasesListByServerResponse{}, err + return DatabasesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -671,7 +678,7 @@ func (client *DatabasesClient) listInaccessibleByServerCreateRequest(ctx context func (client *DatabasesClient) listInaccessibleByServerHandleResponse(resp *http.Response) (DatabasesListInaccessibleByServerResponse, error) { result := DatabasesListInaccessibleByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseListResult); err != nil { - return DatabasesListInaccessibleByServerResponse{}, err + return DatabasesListInaccessibleByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -739,7 +746,7 @@ func (client *DatabasesClient) listMetricDefinitionsCreateRequest(ctx context.Co func (client *DatabasesClient) listMetricDefinitionsHandleResponse(resp *http.Response) (DatabasesListMetricDefinitionsResponse, error) { result := DatabasesListMetricDefinitionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricDefinitionListResult); err != nil { - return DatabasesListMetricDefinitionsResponse{}, err + return DatabasesListMetricDefinitionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -808,7 +815,7 @@ func (client *DatabasesClient) listMetricsCreateRequest(ctx context.Context, res func (client *DatabasesClient) listMetricsHandleResponse(resp *http.Response) (DatabasesListMetricsResponse, error) { result := DatabasesListMetricsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricListResult); err != nil { - return DatabasesListMetricsResponse{}, err + return DatabasesListMetricsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_databaseschemas_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_databaseschemas_client.go index f6f3eb996a25..fa2a4e3d4d2d 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_databaseschemas_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_databaseschemas_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabaseSchemasClient contains the methods for the DatabaseSchemas group. @@ -29,8 +30,15 @@ type DatabaseSchemasClient struct { } // NewDatabaseSchemasClient creates a new instance of DatabaseSchemasClient with the specified values. -func NewDatabaseSchemasClient(con *arm.Connection, subscriptionID string) *DatabaseSchemasClient { - return &DatabaseSchemasClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabaseSchemasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabaseSchemasClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabaseSchemasClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get database schema @@ -88,7 +96,7 @@ func (client *DatabaseSchemasClient) getCreateRequest(ctx context.Context, resou func (client *DatabaseSchemasClient) getHandleResponse(resp *http.Response) (DatabaseSchemasGetResponse, error) { result := DatabaseSchemasGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseSchema); err != nil { - return DatabaseSchemasGetResponse{}, err + return DatabaseSchemasGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -156,7 +164,7 @@ func (client *DatabaseSchemasClient) listByDatabaseCreateRequest(ctx context.Con func (client *DatabaseSchemasClient) listByDatabaseHandleResponse(resp *http.Response) (DatabaseSchemasListByDatabaseResponse, error) { result := DatabaseSchemasListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseSchemaListResult); err != nil { - return DatabaseSchemasListByDatabaseResponse{}, err + return DatabaseSchemasListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_databasesecurityalertpolicies_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_databasesecurityalertpolicies_client.go index 0eeac886f755..88f07374c3ab 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_databasesecurityalertpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_databasesecurityalertpolicies_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabaseSecurityAlertPoliciesClient contains the methods for the DatabaseSecurityAlertPolicies group. @@ -29,8 +30,15 @@ type DatabaseSecurityAlertPoliciesClient struct { } // NewDatabaseSecurityAlertPoliciesClient creates a new instance of DatabaseSecurityAlertPoliciesClient with the specified values. -func NewDatabaseSecurityAlertPoliciesClient(con *arm.Connection, subscriptionID string) *DatabaseSecurityAlertPoliciesClient { - return &DatabaseSecurityAlertPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabaseSecurityAlertPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabaseSecurityAlertPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabaseSecurityAlertPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a database's security alert policy. @@ -88,7 +96,7 @@ func (client *DatabaseSecurityAlertPoliciesClient) createOrUpdateCreateRequest(c func (client *DatabaseSecurityAlertPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (DatabaseSecurityAlertPoliciesCreateOrUpdateResponse, error) { result := DatabaseSecurityAlertPoliciesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseSecurityAlertPolicy); err != nil { - return DatabaseSecurityAlertPoliciesCreateOrUpdateResponse{}, err + return DatabaseSecurityAlertPoliciesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -160,7 +168,7 @@ func (client *DatabaseSecurityAlertPoliciesClient) getCreateRequest(ctx context. func (client *DatabaseSecurityAlertPoliciesClient) getHandleResponse(resp *http.Response) (DatabaseSecurityAlertPoliciesGetResponse, error) { result := DatabaseSecurityAlertPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseSecurityAlertPolicy); err != nil { - return DatabaseSecurityAlertPoliciesGetResponse{}, err + return DatabaseSecurityAlertPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -225,7 +233,7 @@ func (client *DatabaseSecurityAlertPoliciesClient) listByDatabaseCreateRequest(c func (client *DatabaseSecurityAlertPoliciesClient) listByDatabaseHandleResponse(resp *http.Response) (DatabaseSecurityAlertPoliciesListByDatabaseResponse, error) { result := DatabaseSecurityAlertPoliciesListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseSecurityAlertListResult); err != nil { - return DatabaseSecurityAlertPoliciesListByDatabaseResponse{}, err + return DatabaseSecurityAlertPoliciesListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_databasetables_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_databasetables_client.go index 866e94c17ac1..c42db897f162 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_databasetables_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_databasetables_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabaseTablesClient contains the methods for the DatabaseTables group. @@ -29,8 +30,15 @@ type DatabaseTablesClient struct { } // NewDatabaseTablesClient creates a new instance of DatabaseTablesClient with the specified values. -func NewDatabaseTablesClient(con *arm.Connection, subscriptionID string) *DatabaseTablesClient { - return &DatabaseTablesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabaseTablesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabaseTablesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabaseTablesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get database table @@ -92,7 +100,7 @@ func (client *DatabaseTablesClient) getCreateRequest(ctx context.Context, resour func (client *DatabaseTablesClient) getHandleResponse(resp *http.Response) (DatabaseTablesGetResponse, error) { result := DatabaseTablesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseTable); err != nil { - return DatabaseTablesGetResponse{}, err + return DatabaseTablesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -164,7 +172,7 @@ func (client *DatabaseTablesClient) listBySchemaCreateRequest(ctx context.Contex func (client *DatabaseTablesClient) listBySchemaHandleResponse(resp *http.Response) (DatabaseTablesListBySchemaResponse, error) { result := DatabaseTablesListBySchemaResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseTableListResult); err != nil { - return DatabaseTablesListBySchemaResponse{}, err + return DatabaseTablesListBySchemaResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_databaseusages_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_databaseusages_client.go index 9e8d0070de30..714abfed2a1d 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_databaseusages_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_databaseusages_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabaseUsagesClient contains the methods for the DatabaseUsages group. @@ -29,8 +30,15 @@ type DatabaseUsagesClient struct { } // NewDatabaseUsagesClient creates a new instance of DatabaseUsagesClient with the specified values. -func NewDatabaseUsagesClient(con *arm.Connection, subscriptionID string) *DatabaseUsagesClient { - return &DatabaseUsagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabaseUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabaseUsagesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabaseUsagesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByDatabase - Gets database usages. @@ -81,7 +89,7 @@ func (client *DatabaseUsagesClient) listByDatabaseCreateRequest(ctx context.Cont func (client *DatabaseUsagesClient) listByDatabaseHandleResponse(resp *http.Response) (DatabaseUsagesListByDatabaseResponse, error) { result := DatabaseUsagesListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseUsageListResult); err != nil { - return DatabaseUsagesListByDatabaseResponse{}, err + return DatabaseUsagesListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_databasevulnerabilityassessmentrulebaselines_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_databasevulnerabilityassessmentrulebaselines_client.go index 967867ceea37..13ed712dd2aa 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_databasevulnerabilityassessmentrulebaselines_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_databasevulnerabilityassessmentrulebaselines_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabaseVulnerabilityAssessmentRuleBaselinesClient contains the methods for the DatabaseVulnerabilityAssessmentRuleBaselines group. @@ -29,8 +30,15 @@ type DatabaseVulnerabilityAssessmentRuleBaselinesClient struct { } // NewDatabaseVulnerabilityAssessmentRuleBaselinesClient creates a new instance of DatabaseVulnerabilityAssessmentRuleBaselinesClient with the specified values. -func NewDatabaseVulnerabilityAssessmentRuleBaselinesClient(con *arm.Connection, subscriptionID string) *DatabaseVulnerabilityAssessmentRuleBaselinesClient { - return &DatabaseVulnerabilityAssessmentRuleBaselinesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabaseVulnerabilityAssessmentRuleBaselinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabaseVulnerabilityAssessmentRuleBaselinesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabaseVulnerabilityAssessmentRuleBaselinesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a database's vulnerability assessment rule baseline. @@ -96,7 +104,7 @@ func (client *DatabaseVulnerabilityAssessmentRuleBaselinesClient) createOrUpdate func (client *DatabaseVulnerabilityAssessmentRuleBaselinesClient) createOrUpdateHandleResponse(resp *http.Response) (DatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateResponse, error) { result := DatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseVulnerabilityAssessmentRuleBaseline); err != nil { - return DatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateResponse{}, err + return DatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -246,7 +254,7 @@ func (client *DatabaseVulnerabilityAssessmentRuleBaselinesClient) getCreateReque func (client *DatabaseVulnerabilityAssessmentRuleBaselinesClient) getHandleResponse(resp *http.Response) (DatabaseVulnerabilityAssessmentRuleBaselinesGetResponse, error) { result := DatabaseVulnerabilityAssessmentRuleBaselinesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseVulnerabilityAssessmentRuleBaseline); err != nil { - return DatabaseVulnerabilityAssessmentRuleBaselinesGetResponse{}, err + return DatabaseVulnerabilityAssessmentRuleBaselinesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_databasevulnerabilityassessments_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_databasevulnerabilityassessments_client.go index 56e7cf0b2b64..18650058371e 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_databasevulnerabilityassessments_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_databasevulnerabilityassessments_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabaseVulnerabilityAssessmentsClient contains the methods for the DatabaseVulnerabilityAssessments group. @@ -29,8 +30,15 @@ type DatabaseVulnerabilityAssessmentsClient struct { } // NewDatabaseVulnerabilityAssessmentsClient creates a new instance of DatabaseVulnerabilityAssessmentsClient with the specified values. -func NewDatabaseVulnerabilityAssessmentsClient(con *arm.Connection, subscriptionID string) *DatabaseVulnerabilityAssessmentsClient { - return &DatabaseVulnerabilityAssessmentsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabaseVulnerabilityAssessmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabaseVulnerabilityAssessmentsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabaseVulnerabilityAssessmentsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the database's vulnerability assessment. @@ -88,7 +96,7 @@ func (client *DatabaseVulnerabilityAssessmentsClient) createOrUpdateCreateReques func (client *DatabaseVulnerabilityAssessmentsClient) createOrUpdateHandleResponse(resp *http.Response) (DatabaseVulnerabilityAssessmentsCreateOrUpdateResponse, error) { result := DatabaseVulnerabilityAssessmentsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseVulnerabilityAssessment); err != nil { - return DatabaseVulnerabilityAssessmentsCreateOrUpdateResponse{}, err + return DatabaseVulnerabilityAssessmentsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -222,7 +230,7 @@ func (client *DatabaseVulnerabilityAssessmentsClient) getCreateRequest(ctx conte func (client *DatabaseVulnerabilityAssessmentsClient) getHandleResponse(resp *http.Response) (DatabaseVulnerabilityAssessmentsGetResponse, error) { result := DatabaseVulnerabilityAssessmentsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseVulnerabilityAssessment); err != nil { - return DatabaseVulnerabilityAssessmentsGetResponse{}, err + return DatabaseVulnerabilityAssessmentsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -287,7 +295,7 @@ func (client *DatabaseVulnerabilityAssessmentsClient) listByDatabaseCreateReques func (client *DatabaseVulnerabilityAssessmentsClient) listByDatabaseHandleResponse(resp *http.Response) (DatabaseVulnerabilityAssessmentsListByDatabaseResponse, error) { result := DatabaseVulnerabilityAssessmentsListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseVulnerabilityAssessmentListResult); err != nil { - return DatabaseVulnerabilityAssessmentsListByDatabaseResponse{}, err + return DatabaseVulnerabilityAssessmentsListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_databasevulnerabilityassessmentscans_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_databasevulnerabilityassessmentscans_client.go index c06bc44ebb3b..00e80624fa8b 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_databasevulnerabilityassessmentscans_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_databasevulnerabilityassessmentscans_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DatabaseVulnerabilityAssessmentScansClient contains the methods for the DatabaseVulnerabilityAssessmentScans group. @@ -30,8 +30,15 @@ type DatabaseVulnerabilityAssessmentScansClient struct { } // NewDatabaseVulnerabilityAssessmentScansClient creates a new instance of DatabaseVulnerabilityAssessmentScansClient with the specified values. -func NewDatabaseVulnerabilityAssessmentScansClient(con *arm.Connection, subscriptionID string) *DatabaseVulnerabilityAssessmentScansClient { - return &DatabaseVulnerabilityAssessmentScansClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDatabaseVulnerabilityAssessmentScansClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DatabaseVulnerabilityAssessmentScansClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DatabaseVulnerabilityAssessmentScansClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Export - Convert an existing scan result to a human readable format. If already exists nothing happens @@ -93,7 +100,7 @@ func (client *DatabaseVulnerabilityAssessmentScansClient) exportCreateRequest(ct func (client *DatabaseVulnerabilityAssessmentScansClient) exportHandleResponse(resp *http.Response) (DatabaseVulnerabilityAssessmentScansExportResponse, error) { result := DatabaseVulnerabilityAssessmentScansExportResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseVulnerabilityAssessmentScansExport); err != nil { - return DatabaseVulnerabilityAssessmentScansExportResponse{}, err + return DatabaseVulnerabilityAssessmentScansExportResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -169,7 +176,7 @@ func (client *DatabaseVulnerabilityAssessmentScansClient) getCreateRequest(ctx c func (client *DatabaseVulnerabilityAssessmentScansClient) getHandleResponse(resp *http.Response) (DatabaseVulnerabilityAssessmentScansGetResponse, error) { result := DatabaseVulnerabilityAssessmentScansGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VulnerabilityAssessmentScanRecord); err != nil { - return DatabaseVulnerabilityAssessmentScansGetResponse{}, err + return DatabaseVulnerabilityAssessmentScansGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -324,7 +331,7 @@ func (client *DatabaseVulnerabilityAssessmentScansClient) listByDatabaseCreateRe func (client *DatabaseVulnerabilityAssessmentScansClient) listByDatabaseHandleResponse(resp *http.Response) (DatabaseVulnerabilityAssessmentScansListByDatabaseResponse, error) { result := DatabaseVulnerabilityAssessmentScansListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VulnerabilityAssessmentScanRecordListResult); err != nil { - return DatabaseVulnerabilityAssessmentScansListByDatabaseResponse{}, err + return DatabaseVulnerabilityAssessmentScansListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_datamaskingpolicies_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_datamaskingpolicies_client.go index 5ef22a8c21a0..7e54b4d4083e 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_datamaskingpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_datamaskingpolicies_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DataMaskingPoliciesClient contains the methods for the DataMaskingPolicies group. @@ -29,8 +30,15 @@ type DataMaskingPoliciesClient struct { } // NewDataMaskingPoliciesClient creates a new instance of DataMaskingPoliciesClient with the specified values. -func NewDataMaskingPoliciesClient(con *arm.Connection, subscriptionID string) *DataMaskingPoliciesClient { - return &DataMaskingPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDataMaskingPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DataMaskingPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DataMaskingPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a database data masking policy @@ -85,7 +93,7 @@ func (client *DataMaskingPoliciesClient) createOrUpdateCreateRequest(ctx context func (client *DataMaskingPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (DataMaskingPoliciesCreateOrUpdateResponse, error) { result := DataMaskingPoliciesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataMaskingPolicy); err != nil { - return DataMaskingPoliciesCreateOrUpdateResponse{}, err + return DataMaskingPoliciesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -154,7 +162,7 @@ func (client *DataMaskingPoliciesClient) getCreateRequest(ctx context.Context, r func (client *DataMaskingPoliciesClient) getHandleResponse(resp *http.Response) (DataMaskingPoliciesGetResponse, error) { result := DataMaskingPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataMaskingPolicy); err != nil { - return DataMaskingPoliciesGetResponse{}, err + return DataMaskingPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_datamaskingrules_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_datamaskingrules_client.go index 33650fc083e6..e5a9147672a6 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_datamaskingrules_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_datamaskingrules_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DataMaskingRulesClient contains the methods for the DataMaskingRules group. @@ -29,8 +30,15 @@ type DataMaskingRulesClient struct { } // NewDataMaskingRulesClient creates a new instance of DataMaskingRulesClient with the specified values. -func NewDataMaskingRulesClient(con *arm.Connection, subscriptionID string) *DataMaskingRulesClient { - return &DataMaskingRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDataMaskingRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DataMaskingRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DataMaskingRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a database data masking rule. @@ -89,7 +97,7 @@ func (client *DataMaskingRulesClient) createOrUpdateCreateRequest(ctx context.Co func (client *DataMaskingRulesClient) createOrUpdateHandleResponse(resp *http.Response) (DataMaskingRulesCreateOrUpdateResponse, error) { result := DataMaskingRulesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataMaskingRule); err != nil { - return DataMaskingRulesCreateOrUpdateResponse{}, err + return DataMaskingRulesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -158,7 +166,7 @@ func (client *DataMaskingRulesClient) listByDatabaseCreateRequest(ctx context.Co func (client *DataMaskingRulesClient) listByDatabaseHandleResponse(resp *http.Response) (DataMaskingRulesListByDatabaseResponse, error) { result := DataMaskingRulesListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataMaskingRuleListResult); err != nil { - return DataMaskingRulesListByDatabaseResponse{}, err + return DataMaskingRulesListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_datawarehouseuseractivities_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_datawarehouseuseractivities_client.go index 659f3b5dc3a9..bd8a8e7b0728 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_datawarehouseuseractivities_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_datawarehouseuseractivities_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DataWarehouseUserActivitiesClient contains the methods for the DataWarehouseUserActivities group. @@ -29,8 +30,15 @@ type DataWarehouseUserActivitiesClient struct { } // NewDataWarehouseUserActivitiesClient creates a new instance of DataWarehouseUserActivitiesClient with the specified values. -func NewDataWarehouseUserActivitiesClient(con *arm.Connection, subscriptionID string) *DataWarehouseUserActivitiesClient { - return &DataWarehouseUserActivitiesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDataWarehouseUserActivitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DataWarehouseUserActivitiesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DataWarehouseUserActivitiesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets the user activities of a data warehouse which includes running and suspended queries @@ -88,7 +96,7 @@ func (client *DataWarehouseUserActivitiesClient) getCreateRequest(ctx context.Co func (client *DataWarehouseUserActivitiesClient) getHandleResponse(resp *http.Response) (DataWarehouseUserActivitiesGetResponse, error) { result := DataWarehouseUserActivitiesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataWarehouseUserActivities); err != nil { - return DataWarehouseUserActivitiesGetResponse{}, err + return DataWarehouseUserActivitiesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -153,7 +161,7 @@ func (client *DataWarehouseUserActivitiesClient) listByDatabaseCreateRequest(ctx func (client *DataWarehouseUserActivitiesClient) listByDatabaseHandleResponse(resp *http.Response) (DataWarehouseUserActivitiesListByDatabaseResponse, error) { result := DataWarehouseUserActivitiesListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DataWarehouseUserActivitiesListResult); err != nil { - return DataWarehouseUserActivitiesListByDatabaseResponse{}, err + return DataWarehouseUserActivitiesListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_deletedservers_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_deletedservers_client.go index 2f2b45e21038..db0cd36c468f 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_deletedservers_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_deletedservers_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DeletedServersClient contains the methods for the DeletedServers group. @@ -30,8 +30,15 @@ type DeletedServersClient struct { } // NewDeletedServersClient creates a new instance of DeletedServersClient with the specified values. -func NewDeletedServersClient(con *arm.Connection, subscriptionID string) *DeletedServersClient { - return &DeletedServersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDeletedServersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DeletedServersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DeletedServersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a deleted server. @@ -81,7 +88,7 @@ func (client *DeletedServersClient) getCreateRequest(ctx context.Context, locati func (client *DeletedServersClient) getHandleResponse(resp *http.Response) (DeletedServersGetResponse, error) { result := DeletedServersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeletedServer); err != nil { - return DeletedServersGetResponse{}, err + return DeletedServersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -134,7 +141,7 @@ func (client *DeletedServersClient) listCreateRequest(ctx context.Context, optio func (client *DeletedServersClient) listHandleResponse(resp *http.Response) (DeletedServersListResponse, error) { result := DeletedServersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeletedServerListResult); err != nil { - return DeletedServersListResponse{}, err + return DeletedServersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -191,7 +198,7 @@ func (client *DeletedServersClient) listByLocationCreateRequest(ctx context.Cont func (client *DeletedServersClient) listByLocationHandleResponse(resp *http.Response) (DeletedServersListByLocationResponse, error) { result := DeletedServersListByLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeletedServerListResult); err != nil { - return DeletedServersListByLocationResponse{}, err + return DeletedServersListByLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_elasticpoolactivities_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_elasticpoolactivities_client.go index 273a4da280e5..7196ff94d91c 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_elasticpoolactivities_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_elasticpoolactivities_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ElasticPoolActivitiesClient contains the methods for the ElasticPoolActivities group. @@ -29,8 +30,15 @@ type ElasticPoolActivitiesClient struct { } // NewElasticPoolActivitiesClient creates a new instance of ElasticPoolActivitiesClient with the specified values. -func NewElasticPoolActivitiesClient(con *arm.Connection, subscriptionID string) *ElasticPoolActivitiesClient { - return &ElasticPoolActivitiesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewElasticPoolActivitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ElasticPoolActivitiesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ElasticPoolActivitiesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByElasticPool - Returns elastic pool activities. @@ -84,7 +92,7 @@ func (client *ElasticPoolActivitiesClient) listByElasticPoolCreateRequest(ctx co func (client *ElasticPoolActivitiesClient) listByElasticPoolHandleResponse(resp *http.Response) (ElasticPoolActivitiesListByElasticPoolResponse, error) { result := ElasticPoolActivitiesListByElasticPoolResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ElasticPoolActivityListResult); err != nil { - return ElasticPoolActivitiesListByElasticPoolResponse{}, err + return ElasticPoolActivitiesListByElasticPoolResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_elasticpooldatabaseactivities_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_elasticpooldatabaseactivities_client.go index 9aca661a1583..57656c69d971 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_elasticpooldatabaseactivities_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_elasticpooldatabaseactivities_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ElasticPoolDatabaseActivitiesClient contains the methods for the ElasticPoolDatabaseActivities group. @@ -29,8 +30,15 @@ type ElasticPoolDatabaseActivitiesClient struct { } // NewElasticPoolDatabaseActivitiesClient creates a new instance of ElasticPoolDatabaseActivitiesClient with the specified values. -func NewElasticPoolDatabaseActivitiesClient(con *arm.Connection, subscriptionID string) *ElasticPoolDatabaseActivitiesClient { - return &ElasticPoolDatabaseActivitiesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewElasticPoolDatabaseActivitiesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ElasticPoolDatabaseActivitiesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ElasticPoolDatabaseActivitiesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByElasticPool - Returns activity on databases inside of an elastic pool. @@ -84,7 +92,7 @@ func (client *ElasticPoolDatabaseActivitiesClient) listByElasticPoolCreateReques func (client *ElasticPoolDatabaseActivitiesClient) listByElasticPoolHandleResponse(resp *http.Response) (ElasticPoolDatabaseActivitiesListByElasticPoolResponse, error) { result := ElasticPoolDatabaseActivitiesListByElasticPoolResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ElasticPoolDatabaseActivityListResult); err != nil { - return ElasticPoolDatabaseActivitiesListByElasticPoolResponse{}, err + return ElasticPoolDatabaseActivitiesListByElasticPoolResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_elasticpooloperations_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_elasticpooloperations_client.go index 1e703b20425f..63c50e2c998e 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_elasticpooloperations_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_elasticpooloperations_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ElasticPoolOperationsClient contains the methods for the ElasticPoolOperations group. @@ -29,8 +30,15 @@ type ElasticPoolOperationsClient struct { } // NewElasticPoolOperationsClient creates a new instance of ElasticPoolOperationsClient with the specified values. -func NewElasticPoolOperationsClient(con *arm.Connection, subscriptionID string) *ElasticPoolOperationsClient { - return &ElasticPoolOperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewElasticPoolOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ElasticPoolOperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ElasticPoolOperationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Cancel - Cancels the asynchronous operation on the elastic pool. @@ -140,7 +148,7 @@ func (client *ElasticPoolOperationsClient) listByElasticPoolCreateRequest(ctx co func (client *ElasticPoolOperationsClient) listByElasticPoolHandleResponse(resp *http.Response) (ElasticPoolOperationsListByElasticPoolResponse, error) { result := ElasticPoolOperationsListByElasticPoolResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ElasticPoolOperationListResult); err != nil { - return ElasticPoolOperationsListByElasticPoolResponse{}, err + return ElasticPoolOperationsListByElasticPoolResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_elasticpools_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_elasticpools_client.go index 7b663e3b2c8a..14ba16ad37fd 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_elasticpools_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_elasticpools_client.go @@ -11,15 +11,15 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // ElasticPoolsClient contains the methods for the ElasticPools group. @@ -31,8 +31,15 @@ type ElasticPoolsClient struct { } // NewElasticPoolsClient creates a new instance of ElasticPoolsClient with the specified values. -func NewElasticPoolsClient(con *arm.Connection, subscriptionID string) *ElasticPoolsClient { - return &ElasticPoolsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewElasticPoolsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ElasticPoolsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ElasticPoolsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates an elastic pool. @@ -321,7 +328,7 @@ func (client *ElasticPoolsClient) getCreateRequest(ctx context.Context, resource func (client *ElasticPoolsClient) getHandleResponse(resp *http.Response) (ElasticPoolsGetResponse, error) { result := ElasticPoolsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ElasticPool); err != nil { - return ElasticPoolsGetResponse{}, err + return ElasticPoolsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -385,7 +392,7 @@ func (client *ElasticPoolsClient) listByServerCreateRequest(ctx context.Context, func (client *ElasticPoolsClient) listByServerHandleResponse(resp *http.Response) (ElasticPoolsListByServerResponse, error) { result := ElasticPoolsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ElasticPoolListResult); err != nil { - return ElasticPoolsListByServerResponse{}, err + return ElasticPoolsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -453,7 +460,7 @@ func (client *ElasticPoolsClient) listMetricDefinitionsCreateRequest(ctx context func (client *ElasticPoolsClient) listMetricDefinitionsHandleResponse(resp *http.Response) (ElasticPoolsListMetricDefinitionsResponse, error) { result := ElasticPoolsListMetricDefinitionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricDefinitionListResult); err != nil { - return ElasticPoolsListMetricDefinitionsResponse{}, err + return ElasticPoolsListMetricDefinitionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -522,7 +529,7 @@ func (client *ElasticPoolsClient) listMetricsCreateRequest(ctx context.Context, func (client *ElasticPoolsClient) listMetricsHandleResponse(resp *http.Response) (ElasticPoolsListMetricsResponse, error) { result := ElasticPoolsListMetricsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MetricListResult); err != nil { - return ElasticPoolsListMetricsResponse{}, err + return ElasticPoolsListMetricsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_encryptionprotectors_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_encryptionprotectors_client.go index 5dc10937deb9..2613d9f92834 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_encryptionprotectors_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_encryptionprotectors_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // EncryptionProtectorsClient contains the methods for the EncryptionProtectors group. @@ -30,8 +30,15 @@ type EncryptionProtectorsClient struct { } // NewEncryptionProtectorsClient creates a new instance of EncryptionProtectorsClient with the specified values. -func NewEncryptionProtectorsClient(con *arm.Connection, subscriptionID string) *EncryptionProtectorsClient { - return &EncryptionProtectorsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewEncryptionProtectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *EncryptionProtectorsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &EncryptionProtectorsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Updates an existing encryption protector. @@ -164,7 +171,7 @@ func (client *EncryptionProtectorsClient) getCreateRequest(ctx context.Context, func (client *EncryptionProtectorsClient) getHandleResponse(resp *http.Response) (EncryptionProtectorsGetResponse, error) { result := EncryptionProtectorsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionProtector); err != nil { - return EncryptionProtectorsGetResponse{}, err + return EncryptionProtectorsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -225,7 +232,7 @@ func (client *EncryptionProtectorsClient) listByServerCreateRequest(ctx context. func (client *EncryptionProtectorsClient) listByServerHandleResponse(resp *http.Response) (EncryptionProtectorsListByServerResponse, error) { result := EncryptionProtectorsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionProtectorListResult); err != nil { - return EncryptionProtectorsListByServerResponse{}, err + return EncryptionProtectorsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_extendeddatabaseblobauditingpolicies_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_extendeddatabaseblobauditingpolicies_client.go index a00ba5e19e66..4defdf59c71b 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_extendeddatabaseblobauditingpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_extendeddatabaseblobauditingpolicies_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ExtendedDatabaseBlobAuditingPoliciesClient contains the methods for the ExtendedDatabaseBlobAuditingPolicies group. @@ -29,8 +30,15 @@ type ExtendedDatabaseBlobAuditingPoliciesClient struct { } // NewExtendedDatabaseBlobAuditingPoliciesClient creates a new instance of ExtendedDatabaseBlobAuditingPoliciesClient with the specified values. -func NewExtendedDatabaseBlobAuditingPoliciesClient(con *arm.Connection, subscriptionID string) *ExtendedDatabaseBlobAuditingPoliciesClient { - return &ExtendedDatabaseBlobAuditingPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewExtendedDatabaseBlobAuditingPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExtendedDatabaseBlobAuditingPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ExtendedDatabaseBlobAuditingPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates an extended database's blob auditing policy. @@ -85,7 +93,7 @@ func (client *ExtendedDatabaseBlobAuditingPoliciesClient) createOrUpdateCreateRe func (client *ExtendedDatabaseBlobAuditingPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (ExtendedDatabaseBlobAuditingPoliciesCreateOrUpdateResponse, error) { result := ExtendedDatabaseBlobAuditingPoliciesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExtendedDatabaseBlobAuditingPolicy); err != nil { - return ExtendedDatabaseBlobAuditingPoliciesCreateOrUpdateResponse{}, err + return ExtendedDatabaseBlobAuditingPoliciesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -154,7 +162,7 @@ func (client *ExtendedDatabaseBlobAuditingPoliciesClient) getCreateRequest(ctx c func (client *ExtendedDatabaseBlobAuditingPoliciesClient) getHandleResponse(resp *http.Response) (ExtendedDatabaseBlobAuditingPoliciesGetResponse, error) { result := ExtendedDatabaseBlobAuditingPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExtendedDatabaseBlobAuditingPolicy); err != nil { - return ExtendedDatabaseBlobAuditingPoliciesGetResponse{}, err + return ExtendedDatabaseBlobAuditingPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -219,7 +227,7 @@ func (client *ExtendedDatabaseBlobAuditingPoliciesClient) listByDatabaseCreateRe func (client *ExtendedDatabaseBlobAuditingPoliciesClient) listByDatabaseHandleResponse(resp *http.Response) (ExtendedDatabaseBlobAuditingPoliciesListByDatabaseResponse, error) { result := ExtendedDatabaseBlobAuditingPoliciesListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExtendedDatabaseBlobAuditingPolicyListResult); err != nil { - return ExtendedDatabaseBlobAuditingPoliciesListByDatabaseResponse{}, err + return ExtendedDatabaseBlobAuditingPoliciesListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_extendedserverblobauditingpolicies_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_extendedserverblobauditingpolicies_client.go index a2444cac40d2..84f4e4c17a59 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_extendedserverblobauditingpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_extendedserverblobauditingpolicies_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ExtendedServerBlobAuditingPoliciesClient contains the methods for the ExtendedServerBlobAuditingPolicies group. @@ -30,8 +30,15 @@ type ExtendedServerBlobAuditingPoliciesClient struct { } // NewExtendedServerBlobAuditingPoliciesClient creates a new instance of ExtendedServerBlobAuditingPoliciesClient with the specified values. -func NewExtendedServerBlobAuditingPoliciesClient(con *arm.Connection, subscriptionID string) *ExtendedServerBlobAuditingPoliciesClient { - return &ExtendedServerBlobAuditingPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewExtendedServerBlobAuditingPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ExtendedServerBlobAuditingPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ExtendedServerBlobAuditingPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates an extended server's blob auditing policy. @@ -158,7 +165,7 @@ func (client *ExtendedServerBlobAuditingPoliciesClient) getCreateRequest(ctx con func (client *ExtendedServerBlobAuditingPoliciesClient) getHandleResponse(resp *http.Response) (ExtendedServerBlobAuditingPoliciesGetResponse, error) { result := ExtendedServerBlobAuditingPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExtendedServerBlobAuditingPolicy); err != nil { - return ExtendedServerBlobAuditingPoliciesGetResponse{}, err + return ExtendedServerBlobAuditingPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -219,7 +226,7 @@ func (client *ExtendedServerBlobAuditingPoliciesClient) listByServerCreateReques func (client *ExtendedServerBlobAuditingPoliciesClient) listByServerHandleResponse(resp *http.Response) (ExtendedServerBlobAuditingPoliciesListByServerResponse, error) { result := ExtendedServerBlobAuditingPoliciesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ExtendedServerBlobAuditingPolicyListResult); err != nil { - return ExtendedServerBlobAuditingPoliciesListByServerResponse{}, err + return ExtendedServerBlobAuditingPoliciesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_failovergroups_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_failovergroups_client.go index 2ad53b2dfb19..1585d468c684 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_failovergroups_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_failovergroups_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // FailoverGroupsClient contains the methods for the FailoverGroups group. @@ -30,8 +30,15 @@ type FailoverGroupsClient struct { } // NewFailoverGroupsClient creates a new instance of FailoverGroupsClient with the specified values. -func NewFailoverGroupsClient(con *arm.Connection, subscriptionID string) *FailoverGroupsClient { - return &FailoverGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewFailoverGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FailoverGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FailoverGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a failover group. @@ -400,7 +407,7 @@ func (client *FailoverGroupsClient) getCreateRequest(ctx context.Context, resour func (client *FailoverGroupsClient) getHandleResponse(resp *http.Response) (FailoverGroupsGetResponse, error) { result := FailoverGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FailoverGroup); err != nil { - return FailoverGroupsGetResponse{}, err + return FailoverGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -461,7 +468,7 @@ func (client *FailoverGroupsClient) listByServerCreateRequest(ctx context.Contex func (client *FailoverGroupsClient) listByServerHandleResponse(resp *http.Response) (FailoverGroupsListByServerResponse, error) { result := FailoverGroupsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FailoverGroupListResult); err != nil { - return FailoverGroupsListByServerResponse{}, err + return FailoverGroupsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_firewallrules_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_firewallrules_client.go index 0c11efc3951d..c39190230a0c 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_firewallrules_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_firewallrules_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // FirewallRulesClient contains the methods for the FirewallRules group. @@ -29,8 +30,15 @@ type FirewallRulesClient struct { } // NewFirewallRulesClient creates a new instance of FirewallRulesClient with the specified values. -func NewFirewallRulesClient(con *arm.Connection, subscriptionID string) *FirewallRulesClient { - return &FirewallRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewFirewallRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FirewallRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FirewallRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a firewall rule. @@ -84,7 +92,7 @@ func (client *FirewallRulesClient) createOrUpdateCreateRequest(ctx context.Conte func (client *FirewallRulesClient) createOrUpdateHandleResponse(resp *http.Response) (FirewallRulesCreateOrUpdateResponse, error) { result := FirewallRulesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRule); err != nil { - return FirewallRulesCreateOrUpdateResponse{}, err + return FirewallRulesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -210,7 +218,7 @@ func (client *FirewallRulesClient) getCreateRequest(ctx context.Context, resourc func (client *FirewallRulesClient) getHandleResponse(resp *http.Response) (FirewallRulesGetResponse, error) { result := FirewallRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRule); err != nil { - return FirewallRulesGetResponse{}, err + return FirewallRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -271,7 +279,7 @@ func (client *FirewallRulesClient) listByServerCreateRequest(ctx context.Context func (client *FirewallRulesClient) listByServerHandleResponse(resp *http.Response) (FirewallRulesListByServerResponse, error) { result := FirewallRulesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRuleListResult); err != nil { - return FirewallRulesListByServerResponse{}, err + return FirewallRulesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -335,7 +343,7 @@ func (client *FirewallRulesClient) replaceCreateRequest(ctx context.Context, res func (client *FirewallRulesClient) replaceHandleResponse(resp *http.Response) (FirewallRulesReplaceResponse, error) { result := FirewallRulesReplaceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FirewallRule); err != nil { - return FirewallRulesReplaceResponse{}, err + return FirewallRulesReplaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_geobackuppolicies_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_geobackuppolicies_client.go index db3fa0b61950..aefbda307d22 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_geobackuppolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_geobackuppolicies_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // GeoBackupPoliciesClient contains the methods for the GeoBackupPolicies group. @@ -29,8 +30,15 @@ type GeoBackupPoliciesClient struct { } // NewGeoBackupPoliciesClient creates a new instance of GeoBackupPoliciesClient with the specified values. -func NewGeoBackupPoliciesClient(con *arm.Connection, subscriptionID string) *GeoBackupPoliciesClient { - return &GeoBackupPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewGeoBackupPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *GeoBackupPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &GeoBackupPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Updates a database geo backup policy. @@ -88,7 +96,7 @@ func (client *GeoBackupPoliciesClient) createOrUpdateCreateRequest(ctx context.C func (client *GeoBackupPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (GeoBackupPoliciesCreateOrUpdateResponse, error) { result := GeoBackupPoliciesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GeoBackupPolicy); err != nil { - return GeoBackupPoliciesCreateOrUpdateResponse{}, err + return GeoBackupPoliciesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -160,7 +168,7 @@ func (client *GeoBackupPoliciesClient) getCreateRequest(ctx context.Context, res func (client *GeoBackupPoliciesClient) getHandleResponse(resp *http.Response) (GeoBackupPoliciesGetResponse, error) { result := GeoBackupPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GeoBackupPolicy); err != nil { - return GeoBackupPoliciesGetResponse{}, err + return GeoBackupPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -228,7 +236,7 @@ func (client *GeoBackupPoliciesClient) listByDatabaseCreateRequest(ctx context.C func (client *GeoBackupPoliciesClient) listByDatabaseHandleResponse(resp *http.Response) (GeoBackupPoliciesListByDatabaseResponse, error) { result := GeoBackupPoliciesListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GeoBackupPolicyListResult); err != nil { - return GeoBackupPoliciesListByDatabaseResponse{}, err + return GeoBackupPoliciesListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_instancefailovergroups_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_instancefailovergroups_client.go index cbdf58bae238..420a499b33d2 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_instancefailovergroups_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_instancefailovergroups_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // InstanceFailoverGroupsClient contains the methods for the InstanceFailoverGroups group. @@ -30,8 +30,15 @@ type InstanceFailoverGroupsClient struct { } // NewInstanceFailoverGroupsClient creates a new instance of InstanceFailoverGroupsClient with the specified values. -func NewInstanceFailoverGroupsClient(con *arm.Connection, subscriptionID string) *InstanceFailoverGroupsClient { - return &InstanceFailoverGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewInstanceFailoverGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *InstanceFailoverGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &InstanceFailoverGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a failover group. @@ -401,7 +408,7 @@ func (client *InstanceFailoverGroupsClient) getCreateRequest(ctx context.Context func (client *InstanceFailoverGroupsClient) getHandleResponse(resp *http.Response) (InstanceFailoverGroupsGetResponse, error) { result := InstanceFailoverGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.InstanceFailoverGroup); err != nil { - return InstanceFailoverGroupsGetResponse{}, err + return InstanceFailoverGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -462,7 +469,7 @@ func (client *InstanceFailoverGroupsClient) listByLocationCreateRequest(ctx cont func (client *InstanceFailoverGroupsClient) listByLocationHandleResponse(resp *http.Response) (InstanceFailoverGroupsListByLocationResponse, error) { result := InstanceFailoverGroupsListByLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.InstanceFailoverGroupListResult); err != nil { - return InstanceFailoverGroupsListByLocationResponse{}, err + return InstanceFailoverGroupsListByLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_instancepools_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_instancepools_client.go index 0b94a8dbbc57..e6b663d98576 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_instancepools_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_instancepools_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // InstancePoolsClient contains the methods for the InstancePools group. @@ -30,8 +30,15 @@ type InstancePoolsClient struct { } // NewInstancePoolsClient creates a new instance of InstancePoolsClient with the specified values. -func NewInstancePoolsClient(con *arm.Connection, subscriptionID string) *InstancePoolsClient { - return &InstancePoolsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewInstancePoolsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *InstancePoolsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &InstancePoolsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates an instance pool. @@ -230,7 +237,7 @@ func (client *InstancePoolsClient) getCreateRequest(ctx context.Context, resourc func (client *InstancePoolsClient) getHandleResponse(resp *http.Response) (InstancePoolsGetResponse, error) { result := InstancePoolsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.InstancePool); err != nil { - return InstancePoolsGetResponse{}, err + return InstancePoolsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -283,7 +290,7 @@ func (client *InstancePoolsClient) listCreateRequest(ctx context.Context, option func (client *InstancePoolsClient) listHandleResponse(resp *http.Response) (InstancePoolsListResponse, error) { result := InstancePoolsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.InstancePoolListResult); err != nil { - return InstancePoolsListResponse{}, err + return InstancePoolsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -340,7 +347,7 @@ func (client *InstancePoolsClient) listByResourceGroupCreateRequest(ctx context. func (client *InstancePoolsClient) listByResourceGroupHandleResponse(resp *http.Response) (InstancePoolsListByResourceGroupResponse, error) { result := InstancePoolsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.InstancePoolListResult); err != nil { - return InstancePoolsListByResourceGroupResponse{}, err + return InstancePoolsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_jobagents_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_jobagents_client.go index cfdfb44a7777..5000b1ac3948 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_jobagents_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_jobagents_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // JobAgentsClient contains the methods for the JobAgents group. @@ -30,8 +30,15 @@ type JobAgentsClient struct { } // NewJobAgentsClient creates a new instance of JobAgentsClient with the specified values. -func NewJobAgentsClient(con *arm.Connection, subscriptionID string) *JobAgentsClient { - return &JobAgentsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewJobAgentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *JobAgentsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &JobAgentsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a job agent. @@ -242,7 +249,7 @@ func (client *JobAgentsClient) getCreateRequest(ctx context.Context, resourceGro func (client *JobAgentsClient) getHandleResponse(resp *http.Response) (JobAgentsGetResponse, error) { result := JobAgentsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobAgent); err != nil { - return JobAgentsGetResponse{}, err + return JobAgentsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -303,7 +310,7 @@ func (client *JobAgentsClient) listByServerCreateRequest(ctx context.Context, re func (client *JobAgentsClient) listByServerHandleResponse(resp *http.Response) (JobAgentsListByServerResponse, error) { result := JobAgentsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobAgentListResult); err != nil { - return JobAgentsListByServerResponse{}, err + return JobAgentsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_jobcredentials_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_jobcredentials_client.go index c385db761681..288e75b2efcb 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_jobcredentials_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_jobcredentials_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // JobCredentialsClient contains the methods for the JobCredentials group. @@ -29,8 +30,15 @@ type JobCredentialsClient struct { } // NewJobCredentialsClient creates a new instance of JobCredentialsClient with the specified values. -func NewJobCredentialsClient(con *arm.Connection, subscriptionID string) *JobCredentialsClient { - return &JobCredentialsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewJobCredentialsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *JobCredentialsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &JobCredentialsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a job credential. @@ -88,7 +96,7 @@ func (client *JobCredentialsClient) createOrUpdateCreateRequest(ctx context.Cont func (client *JobCredentialsClient) createOrUpdateHandleResponse(resp *http.Response) (JobCredentialsCreateOrUpdateResponse, error) { result := JobCredentialsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobCredential); err != nil { - return JobCredentialsCreateOrUpdateResponse{}, err + return JobCredentialsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -222,7 +230,7 @@ func (client *JobCredentialsClient) getCreateRequest(ctx context.Context, resour func (client *JobCredentialsClient) getHandleResponse(resp *http.Response) (JobCredentialsGetResponse, error) { result := JobCredentialsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobCredential); err != nil { - return JobCredentialsGetResponse{}, err + return JobCredentialsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -287,7 +295,7 @@ func (client *JobCredentialsClient) listByAgentCreateRequest(ctx context.Context func (client *JobCredentialsClient) listByAgentHandleResponse(resp *http.Response) (JobCredentialsListByAgentResponse, error) { result := JobCredentialsListByAgentResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobCredentialListResult); err != nil { - return JobCredentialsListByAgentResponse{}, err + return JobCredentialsListByAgentResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_jobexecutions_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_jobexecutions_client.go index 23b6e987cc7d..5339adf9dadb 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_jobexecutions_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_jobexecutions_client.go @@ -11,16 +11,16 @@ package armsql import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // JobExecutionsClient contains the methods for the JobExecutions group. @@ -32,8 +32,15 @@ type JobExecutionsClient struct { } // NewJobExecutionsClient creates a new instance of JobExecutionsClient with the specified values. -func NewJobExecutionsClient(con *arm.Connection, subscriptionID string) *JobExecutionsClient { - return &JobExecutionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewJobExecutionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *JobExecutionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &JobExecutionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Cancel - Requests cancellation of a job execution. @@ -322,7 +329,7 @@ func (client *JobExecutionsClient) getCreateRequest(ctx context.Context, resourc func (client *JobExecutionsClient) getHandleResponse(resp *http.Response) (JobExecutionsGetResponse, error) { result := JobExecutionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobExecution); err != nil { - return JobExecutionsGetResponse{}, err + return JobExecutionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -408,7 +415,7 @@ func (client *JobExecutionsClient) listByAgentCreateRequest(ctx context.Context, func (client *JobExecutionsClient) listByAgentHandleResponse(resp *http.Response) (JobExecutionsListByAgentResponse, error) { result := JobExecutionsListByAgentResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobExecutionListResult); err != nil { - return JobExecutionsListByAgentResponse{}, err + return JobExecutionsListByAgentResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -498,7 +505,7 @@ func (client *JobExecutionsClient) listByJobCreateRequest(ctx context.Context, r func (client *JobExecutionsClient) listByJobHandleResponse(resp *http.Response) (JobExecutionsListByJobResponse, error) { result := JobExecutionsListByJobResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobExecutionListResult); err != nil { - return JobExecutionsListByJobResponse{}, err + return JobExecutionsListByJobResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_jobs_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_jobs_client.go index 7eb043789995..8bf6af96f556 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_jobs_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_jobs_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // JobsClient contains the methods for the Jobs group. @@ -29,8 +30,15 @@ type JobsClient struct { } // NewJobsClient creates a new instance of JobsClient with the specified values. -func NewJobsClient(con *arm.Connection, subscriptionID string) *JobsClient { - return &JobsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *JobsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &JobsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a job. @@ -88,7 +96,7 @@ func (client *JobsClient) createOrUpdateCreateRequest(ctx context.Context, resou func (client *JobsClient) createOrUpdateHandleResponse(resp *http.Response) (JobsCreateOrUpdateResponse, error) { result := JobsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Job); err != nil { - return JobsCreateOrUpdateResponse{}, err + return JobsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -222,7 +230,7 @@ func (client *JobsClient) getCreateRequest(ctx context.Context, resourceGroupNam func (client *JobsClient) getHandleResponse(resp *http.Response) (JobsGetResponse, error) { result := JobsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Job); err != nil { - return JobsGetResponse{}, err + return JobsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -287,7 +295,7 @@ func (client *JobsClient) listByAgentCreateRequest(ctx context.Context, resource func (client *JobsClient) listByAgentHandleResponse(resp *http.Response) (JobsListByAgentResponse, error) { result := JobsListByAgentResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobListResult); err != nil { - return JobsListByAgentResponse{}, err + return JobsListByAgentResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_jobstepexecutions_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_jobstepexecutions_client.go index dd846643e6c7..a97520536c49 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_jobstepexecutions_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_jobstepexecutions_client.go @@ -11,15 +11,16 @@ package armsql import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // JobStepExecutionsClient contains the methods for the JobStepExecutions group. @@ -31,8 +32,15 @@ type JobStepExecutionsClient struct { } // NewJobStepExecutionsClient creates a new instance of JobStepExecutionsClient with the specified values. -func NewJobStepExecutionsClient(con *arm.Connection, subscriptionID string) *JobStepExecutionsClient { - return &JobStepExecutionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewJobStepExecutionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *JobStepExecutionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &JobStepExecutionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a step execution of a job execution. @@ -95,7 +103,7 @@ func (client *JobStepExecutionsClient) getCreateRequest(ctx context.Context, res func (client *JobStepExecutionsClient) getHandleResponse(resp *http.Response) (JobStepExecutionsGetResponse, error) { result := JobStepExecutionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobExecution); err != nil { - return JobStepExecutionsGetResponse{}, err + return JobStepExecutionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -186,7 +194,7 @@ func (client *JobStepExecutionsClient) listByJobExecutionCreateRequest(ctx conte func (client *JobStepExecutionsClient) listByJobExecutionHandleResponse(resp *http.Response) (JobStepExecutionsListByJobExecutionResponse, error) { result := JobStepExecutionsListByJobExecutionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobExecutionListResult); err != nil { - return JobStepExecutionsListByJobExecutionResponse{}, err + return JobStepExecutionsListByJobExecutionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_jobsteps_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_jobsteps_client.go index 46443c092c65..0cf3b1de81ce 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_jobsteps_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_jobsteps_client.go @@ -11,14 +11,15 @@ package armsql import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // JobStepsClient contains the methods for the JobSteps group. @@ -30,8 +31,15 @@ type JobStepsClient struct { } // NewJobStepsClient creates a new instance of JobStepsClient with the specified values. -func NewJobStepsClient(con *arm.Connection, subscriptionID string) *JobStepsClient { - return &JobStepsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewJobStepsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *JobStepsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &JobStepsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a job step. This will implicitly create a new job version. @@ -93,7 +101,7 @@ func (client *JobStepsClient) createOrUpdateCreateRequest(ctx context.Context, r func (client *JobStepsClient) createOrUpdateHandleResponse(resp *http.Response) (JobStepsCreateOrUpdateResponse, error) { result := JobStepsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobStep); err != nil { - return JobStepsCreateOrUpdateResponse{}, err + return JobStepsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -235,7 +243,7 @@ func (client *JobStepsClient) getCreateRequest(ctx context.Context, resourceGrou func (client *JobStepsClient) getHandleResponse(resp *http.Response) (JobStepsGetResponse, error) { result := JobStepsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobStep); err != nil { - return JobStepsGetResponse{}, err + return JobStepsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -312,7 +320,7 @@ func (client *JobStepsClient) getByVersionCreateRequest(ctx context.Context, res func (client *JobStepsClient) getByVersionHandleResponse(resp *http.Response) (JobStepsGetByVersionResponse, error) { result := JobStepsGetByVersionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobStep); err != nil { - return JobStepsGetByVersionResponse{}, err + return JobStepsGetByVersionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -381,7 +389,7 @@ func (client *JobStepsClient) listByJobCreateRequest(ctx context.Context, resour func (client *JobStepsClient) listByJobHandleResponse(resp *http.Response) (JobStepsListByJobResponse, error) { result := JobStepsListByJobResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobStepListResult); err != nil { - return JobStepsListByJobResponse{}, err + return JobStepsListByJobResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -451,7 +459,7 @@ func (client *JobStepsClient) listByVersionCreateRequest(ctx context.Context, re func (client *JobStepsClient) listByVersionHandleResponse(resp *http.Response) (JobStepsListByVersionResponse, error) { result := JobStepsListByVersionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobStepListResult); err != nil { - return JobStepsListByVersionResponse{}, err + return JobStepsListByVersionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_jobtargetexecutions_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_jobtargetexecutions_client.go index 2fbffc748020..8979563eeb7d 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_jobtargetexecutions_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_jobtargetexecutions_client.go @@ -11,15 +11,16 @@ package armsql import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // JobTargetExecutionsClient contains the methods for the JobTargetExecutions group. @@ -31,8 +32,15 @@ type JobTargetExecutionsClient struct { } // NewJobTargetExecutionsClient creates a new instance of JobTargetExecutionsClient with the specified values. -func NewJobTargetExecutionsClient(con *arm.Connection, subscriptionID string) *JobTargetExecutionsClient { - return &JobTargetExecutionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewJobTargetExecutionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *JobTargetExecutionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &JobTargetExecutionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a target execution. @@ -96,7 +104,7 @@ func (client *JobTargetExecutionsClient) getCreateRequest(ctx context.Context, r func (client *JobTargetExecutionsClient) getHandleResponse(resp *http.Response) (JobTargetExecutionsGetResponse, error) { result := JobTargetExecutionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobExecution); err != nil { - return JobTargetExecutionsGetResponse{}, err + return JobTargetExecutionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -187,7 +195,7 @@ func (client *JobTargetExecutionsClient) listByJobExecutionCreateRequest(ctx con func (client *JobTargetExecutionsClient) listByJobExecutionHandleResponse(resp *http.Response) (JobTargetExecutionsListByJobExecutionResponse, error) { result := JobTargetExecutionsListByJobExecutionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobExecutionListResult); err != nil { - return JobTargetExecutionsListByJobExecutionResponse{}, err + return JobTargetExecutionsListByJobExecutionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -282,7 +290,7 @@ func (client *JobTargetExecutionsClient) listByStepCreateRequest(ctx context.Con func (client *JobTargetExecutionsClient) listByStepHandleResponse(resp *http.Response) (JobTargetExecutionsListByStepResponse, error) { result := JobTargetExecutionsListByStepResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobExecutionListResult); err != nil { - return JobTargetExecutionsListByStepResponse{}, err + return JobTargetExecutionsListByStepResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_jobtargetgroups_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_jobtargetgroups_client.go index 2d92f97428ad..97a1de5ad0d5 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_jobtargetgroups_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_jobtargetgroups_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // JobTargetGroupsClient contains the methods for the JobTargetGroups group. @@ -29,8 +30,15 @@ type JobTargetGroupsClient struct { } // NewJobTargetGroupsClient creates a new instance of JobTargetGroupsClient with the specified values. -func NewJobTargetGroupsClient(con *arm.Connection, subscriptionID string) *JobTargetGroupsClient { - return &JobTargetGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewJobTargetGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *JobTargetGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &JobTargetGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a target group. @@ -88,7 +96,7 @@ func (client *JobTargetGroupsClient) createOrUpdateCreateRequest(ctx context.Con func (client *JobTargetGroupsClient) createOrUpdateHandleResponse(resp *http.Response) (JobTargetGroupsCreateOrUpdateResponse, error) { result := JobTargetGroupsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobTargetGroup); err != nil { - return JobTargetGroupsCreateOrUpdateResponse{}, err + return JobTargetGroupsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -222,7 +230,7 @@ func (client *JobTargetGroupsClient) getCreateRequest(ctx context.Context, resou func (client *JobTargetGroupsClient) getHandleResponse(resp *http.Response) (JobTargetGroupsGetResponse, error) { result := JobTargetGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobTargetGroup); err != nil { - return JobTargetGroupsGetResponse{}, err + return JobTargetGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -287,7 +295,7 @@ func (client *JobTargetGroupsClient) listByAgentCreateRequest(ctx context.Contex func (client *JobTargetGroupsClient) listByAgentHandleResponse(resp *http.Response) (JobTargetGroupsListByAgentResponse, error) { result := JobTargetGroupsListByAgentResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobTargetGroupListResult); err != nil { - return JobTargetGroupsListByAgentResponse{}, err + return JobTargetGroupsListByAgentResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_jobversions_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_jobversions_client.go index 24911a4f88aa..27c9acab4010 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_jobversions_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_jobversions_client.go @@ -11,14 +11,15 @@ package armsql import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // JobVersionsClient contains the methods for the JobVersions group. @@ -30,8 +31,15 @@ type JobVersionsClient struct { } // NewJobVersionsClient creates a new instance of JobVersionsClient with the specified values. -func NewJobVersionsClient(con *arm.Connection, subscriptionID string) *JobVersionsClient { - return &JobVersionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewJobVersionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *JobVersionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &JobVersionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a job version. @@ -90,7 +98,7 @@ func (client *JobVersionsClient) getCreateRequest(ctx context.Context, resourceG func (client *JobVersionsClient) getHandleResponse(resp *http.Response) (JobVersionsGetResponse, error) { result := JobVersionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobVersion); err != nil { - return JobVersionsGetResponse{}, err + return JobVersionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -159,7 +167,7 @@ func (client *JobVersionsClient) listByJobCreateRequest(ctx context.Context, res func (client *JobVersionsClient) listByJobHandleResponse(resp *http.Response) (JobVersionsListByJobResponse, error) { result := JobVersionsListByJobResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.JobVersionListResult); err != nil { - return JobVersionsListByJobResponse{}, err + return JobVersionsListByJobResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_ledgerdigestuploads_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_ledgerdigestuploads_client.go index 93b72227662e..c387821583cc 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_ledgerdigestuploads_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_ledgerdigestuploads_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LedgerDigestUploadsClient contains the methods for the LedgerDigestUploads group. @@ -30,8 +30,15 @@ type LedgerDigestUploadsClient struct { } // NewLedgerDigestUploadsClient creates a new instance of LedgerDigestUploadsClient with the specified values. -func NewLedgerDigestUploadsClient(con *arm.Connection, subscriptionID string) *LedgerDigestUploadsClient { - return &LedgerDigestUploadsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLedgerDigestUploadsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LedgerDigestUploadsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LedgerDigestUploadsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Enables upload ledger digests to an Azure Storage account or an Azure Confidential Ledger instance. @@ -255,7 +262,7 @@ func (client *LedgerDigestUploadsClient) getCreateRequest(ctx context.Context, r func (client *LedgerDigestUploadsClient) getHandleResponse(resp *http.Response) (LedgerDigestUploadsGetResponse, error) { result := LedgerDigestUploadsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LedgerDigestUploads); err != nil { - return LedgerDigestUploadsGetResponse{}, err + return LedgerDigestUploadsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -320,7 +327,7 @@ func (client *LedgerDigestUploadsClient) listByDatabaseCreateRequest(ctx context func (client *LedgerDigestUploadsClient) listByDatabaseHandleResponse(resp *http.Response) (LedgerDigestUploadsListByDatabaseResponse, error) { result := LedgerDigestUploadsListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LedgerDigestUploadsListResult); err != nil { - return LedgerDigestUploadsListByDatabaseResponse{}, err + return LedgerDigestUploadsListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_longtermretentionbackups_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_longtermretentionbackups_client.go index c520e0b3c30b..7e8d266aac5f 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_longtermretentionbackups_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_longtermretentionbackups_client.go @@ -11,15 +11,15 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // LongTermRetentionBackupsClient contains the methods for the LongTermRetentionBackups group. @@ -31,8 +31,15 @@ type LongTermRetentionBackupsClient struct { } // NewLongTermRetentionBackupsClient creates a new instance of LongTermRetentionBackupsClient with the specified values. -func NewLongTermRetentionBackupsClient(con *arm.Connection, subscriptionID string) *LongTermRetentionBackupsClient { - return &LongTermRetentionBackupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLongTermRetentionBackupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LongTermRetentionBackupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LongTermRetentionBackupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCopy - Copy an existing long term retention backup. @@ -428,7 +435,7 @@ func (client *LongTermRetentionBackupsClient) getCreateRequest(ctx context.Conte func (client *LongTermRetentionBackupsClient) getHandleResponse(resp *http.Response) (LongTermRetentionBackupsGetResponse, error) { result := LongTermRetentionBackupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LongTermRetentionBackup); err != nil { - return LongTermRetentionBackupsGetResponse{}, err + return LongTermRetentionBackupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -504,7 +511,7 @@ func (client *LongTermRetentionBackupsClient) getByResourceGroupCreateRequest(ct func (client *LongTermRetentionBackupsClient) getByResourceGroupHandleResponse(resp *http.Response) (LongTermRetentionBackupsGetByResourceGroupResponse, error) { result := LongTermRetentionBackupsGetByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LongTermRetentionBackup); err != nil { - return LongTermRetentionBackupsGetByResourceGroupResponse{}, err + return LongTermRetentionBackupsGetByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -575,7 +582,7 @@ func (client *LongTermRetentionBackupsClient) listByDatabaseCreateRequest(ctx co func (client *LongTermRetentionBackupsClient) listByDatabaseHandleResponse(resp *http.Response) (LongTermRetentionBackupsListByDatabaseResponse, error) { result := LongTermRetentionBackupsListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LongTermRetentionBackupListResult); err != nil { - return LongTermRetentionBackupsListByDatabaseResponse{}, err + return LongTermRetentionBackupsListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -638,7 +645,7 @@ func (client *LongTermRetentionBackupsClient) listByLocationCreateRequest(ctx co func (client *LongTermRetentionBackupsClient) listByLocationHandleResponse(resp *http.Response) (LongTermRetentionBackupsListByLocationResponse, error) { result := LongTermRetentionBackupsListByLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LongTermRetentionBackupListResult); err != nil { - return LongTermRetentionBackupsListByLocationResponse{}, err + return LongTermRetentionBackupsListByLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -713,7 +720,7 @@ func (client *LongTermRetentionBackupsClient) listByResourceGroupDatabaseCreateR func (client *LongTermRetentionBackupsClient) listByResourceGroupDatabaseHandleResponse(resp *http.Response) (LongTermRetentionBackupsListByResourceGroupDatabaseResponse, error) { result := LongTermRetentionBackupsListByResourceGroupDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LongTermRetentionBackupListResult); err != nil { - return LongTermRetentionBackupsListByResourceGroupDatabaseResponse{}, err + return LongTermRetentionBackupsListByResourceGroupDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -780,7 +787,7 @@ func (client *LongTermRetentionBackupsClient) listByResourceGroupLocationCreateR func (client *LongTermRetentionBackupsClient) listByResourceGroupLocationHandleResponse(resp *http.Response) (LongTermRetentionBackupsListByResourceGroupLocationResponse, error) { result := LongTermRetentionBackupsListByResourceGroupLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LongTermRetentionBackupListResult); err != nil { - return LongTermRetentionBackupsListByResourceGroupLocationResponse{}, err + return LongTermRetentionBackupsListByResourceGroupLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -851,7 +858,7 @@ func (client *LongTermRetentionBackupsClient) listByResourceGroupServerCreateReq func (client *LongTermRetentionBackupsClient) listByResourceGroupServerHandleResponse(resp *http.Response) (LongTermRetentionBackupsListByResourceGroupServerResponse, error) { result := LongTermRetentionBackupsListByResourceGroupServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LongTermRetentionBackupListResult); err != nil { - return LongTermRetentionBackupsListByResourceGroupServerResponse{}, err + return LongTermRetentionBackupsListByResourceGroupServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -918,7 +925,7 @@ func (client *LongTermRetentionBackupsClient) listByServerCreateRequest(ctx cont func (client *LongTermRetentionBackupsClient) listByServerHandleResponse(resp *http.Response) (LongTermRetentionBackupsListByServerResponse, error) { result := LongTermRetentionBackupsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LongTermRetentionBackupListResult); err != nil { - return LongTermRetentionBackupsListByServerResponse{}, err + return LongTermRetentionBackupsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_longtermretentionmanagedinstancebackups_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_longtermretentionmanagedinstancebackups_client.go index 5b1b9037e34c..3bca0abfd799 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_longtermretentionmanagedinstancebackups_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_longtermretentionmanagedinstancebackups_client.go @@ -11,15 +11,15 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // LongTermRetentionManagedInstanceBackupsClient contains the methods for the LongTermRetentionManagedInstanceBackups group. @@ -31,8 +31,15 @@ type LongTermRetentionManagedInstanceBackupsClient struct { } // NewLongTermRetentionManagedInstanceBackupsClient creates a new instance of LongTermRetentionManagedInstanceBackupsClient with the specified values. -func NewLongTermRetentionManagedInstanceBackupsClient(con *arm.Connection, subscriptionID string) *LongTermRetentionManagedInstanceBackupsClient { - return &LongTermRetentionManagedInstanceBackupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLongTermRetentionManagedInstanceBackupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LongTermRetentionManagedInstanceBackupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LongTermRetentionManagedInstanceBackupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginDelete - Deletes a long term retention backup. @@ -258,7 +265,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) getCreateRequest(ct func (client *LongTermRetentionManagedInstanceBackupsClient) getHandleResponse(resp *http.Response) (LongTermRetentionManagedInstanceBackupsGetResponse, error) { result := LongTermRetentionManagedInstanceBackupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceLongTermRetentionBackup); err != nil { - return LongTermRetentionManagedInstanceBackupsGetResponse{}, err + return LongTermRetentionManagedInstanceBackupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -334,7 +341,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) getByResourceGroupC func (client *LongTermRetentionManagedInstanceBackupsClient) getByResourceGroupHandleResponse(resp *http.Response) (LongTermRetentionManagedInstanceBackupsGetByResourceGroupResponse, error) { result := LongTermRetentionManagedInstanceBackupsGetByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceLongTermRetentionBackup); err != nil { - return LongTermRetentionManagedInstanceBackupsGetByResourceGroupResponse{}, err + return LongTermRetentionManagedInstanceBackupsGetByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -405,7 +412,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) listByDatabaseCreat func (client *LongTermRetentionManagedInstanceBackupsClient) listByDatabaseHandleResponse(resp *http.Response) (LongTermRetentionManagedInstanceBackupsListByDatabaseResponse, error) { result := LongTermRetentionManagedInstanceBackupsListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceLongTermRetentionBackupListResult); err != nil { - return LongTermRetentionManagedInstanceBackupsListByDatabaseResponse{}, err + return LongTermRetentionManagedInstanceBackupsListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -472,7 +479,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) listByInstanceCreat func (client *LongTermRetentionManagedInstanceBackupsClient) listByInstanceHandleResponse(resp *http.Response) (LongTermRetentionManagedInstanceBackupsListByInstanceResponse, error) { result := LongTermRetentionManagedInstanceBackupsListByInstanceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceLongTermRetentionBackupListResult); err != nil { - return LongTermRetentionManagedInstanceBackupsListByInstanceResponse{}, err + return LongTermRetentionManagedInstanceBackupsListByInstanceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -535,7 +542,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) listByLocationCreat func (client *LongTermRetentionManagedInstanceBackupsClient) listByLocationHandleResponse(resp *http.Response) (LongTermRetentionManagedInstanceBackupsListByLocationResponse, error) { result := LongTermRetentionManagedInstanceBackupsListByLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceLongTermRetentionBackupListResult); err != nil { - return LongTermRetentionManagedInstanceBackupsListByLocationResponse{}, err + return LongTermRetentionManagedInstanceBackupsListByLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -610,7 +617,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) listByResourceGroup func (client *LongTermRetentionManagedInstanceBackupsClient) listByResourceGroupDatabaseHandleResponse(resp *http.Response) (LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseResponse, error) { result := LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceLongTermRetentionBackupListResult); err != nil { - return LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseResponse{}, err + return LongTermRetentionManagedInstanceBackupsListByResourceGroupDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -681,7 +688,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) listByResourceGroup func (client *LongTermRetentionManagedInstanceBackupsClient) listByResourceGroupInstanceHandleResponse(resp *http.Response) (LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceResponse, error) { result := LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceLongTermRetentionBackupListResult); err != nil { - return LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceResponse{}, err + return LongTermRetentionManagedInstanceBackupsListByResourceGroupInstanceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -748,7 +755,7 @@ func (client *LongTermRetentionManagedInstanceBackupsClient) listByResourceGroup func (client *LongTermRetentionManagedInstanceBackupsClient) listByResourceGroupLocationHandleResponse(resp *http.Response) (LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationResponse, error) { result := LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceLongTermRetentionBackupListResult); err != nil { - return LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationResponse{}, err + return LongTermRetentionManagedInstanceBackupsListByResourceGroupLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_longtermretentionpolicies_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_longtermretentionpolicies_client.go index 124a9d26cb34..3215a7f5b0a6 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_longtermretentionpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_longtermretentionpolicies_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // LongTermRetentionPoliciesClient contains the methods for the LongTermRetentionPolicies group. @@ -30,8 +30,15 @@ type LongTermRetentionPoliciesClient struct { } // NewLongTermRetentionPoliciesClient creates a new instance of LongTermRetentionPoliciesClient with the specified values. -func NewLongTermRetentionPoliciesClient(con *arm.Connection, subscriptionID string) *LongTermRetentionPoliciesClient { - return &LongTermRetentionPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewLongTermRetentionPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *LongTermRetentionPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &LongTermRetentionPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Sets a database's long term retention policy. @@ -172,7 +179,7 @@ func (client *LongTermRetentionPoliciesClient) getCreateRequest(ctx context.Cont func (client *LongTermRetentionPoliciesClient) getHandleResponse(resp *http.Response) (LongTermRetentionPoliciesGetResponse, error) { result := LongTermRetentionPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LongTermRetentionPolicy); err != nil { - return LongTermRetentionPoliciesGetResponse{}, err + return LongTermRetentionPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -237,7 +244,7 @@ func (client *LongTermRetentionPoliciesClient) listByDatabaseCreateRequest(ctx c func (client *LongTermRetentionPoliciesClient) listByDatabaseHandleResponse(resp *http.Response) (LongTermRetentionPoliciesListByDatabaseResponse, error) { result := LongTermRetentionPoliciesListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LongTermRetentionPolicyListResult); err != nil { - return LongTermRetentionPoliciesListByDatabaseResponse{}, err + return LongTermRetentionPoliciesListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_maintenancewindowoptions_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_maintenancewindowoptions_client.go index dfbe6ec1206f..1ef653b71968 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_maintenancewindowoptions_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_maintenancewindowoptions_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // MaintenanceWindowOptionsClient contains the methods for the MaintenanceWindowOptions group. @@ -29,8 +30,15 @@ type MaintenanceWindowOptionsClient struct { } // NewMaintenanceWindowOptionsClient creates a new instance of MaintenanceWindowOptionsClient with the specified values. -func NewMaintenanceWindowOptionsClient(con *arm.Connection, subscriptionID string) *MaintenanceWindowOptionsClient { - return &MaintenanceWindowOptionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewMaintenanceWindowOptionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *MaintenanceWindowOptionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MaintenanceWindowOptionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a list of available maintenance windows. @@ -85,7 +93,7 @@ func (client *MaintenanceWindowOptionsClient) getCreateRequest(ctx context.Conte func (client *MaintenanceWindowOptionsClient) getHandleResponse(resp *http.Response) (MaintenanceWindowOptionsGetResponse, error) { result := MaintenanceWindowOptionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MaintenanceWindowOptions); err != nil { - return MaintenanceWindowOptionsGetResponse{}, err + return MaintenanceWindowOptionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_maintenancewindows_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_maintenancewindows_client.go index 38a5ad296fd7..d385535289ee 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_maintenancewindows_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_maintenancewindows_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // MaintenanceWindowsClient contains the methods for the MaintenanceWindows group. @@ -29,8 +30,15 @@ type MaintenanceWindowsClient struct { } // NewMaintenanceWindowsClient creates a new instance of MaintenanceWindowsClient with the specified values. -func NewMaintenanceWindowsClient(con *arm.Connection, subscriptionID string) *MaintenanceWindowsClient { - return &MaintenanceWindowsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewMaintenanceWindowsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *MaintenanceWindowsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &MaintenanceWindowsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Sets maintenance windows settings for a database. @@ -144,7 +152,7 @@ func (client *MaintenanceWindowsClient) getCreateRequest(ctx context.Context, re func (client *MaintenanceWindowsClient) getHandleResponse(resp *http.Response) (MaintenanceWindowsGetResponse, error) { result := MaintenanceWindowsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MaintenanceWindows); err != nil { - return MaintenanceWindowsGetResponse{}, err + return MaintenanceWindowsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_managedbackupshorttermretentionpolicies_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_managedbackupshorttermretentionpolicies_client.go index 0201803a299a..dc6b50a43352 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_managedbackupshorttermretentionpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_managedbackupshorttermretentionpolicies_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedBackupShortTermRetentionPoliciesClient contains the methods for the ManagedBackupShortTermRetentionPolicies group. @@ -30,8 +30,15 @@ type ManagedBackupShortTermRetentionPoliciesClient struct { } // NewManagedBackupShortTermRetentionPoliciesClient creates a new instance of ManagedBackupShortTermRetentionPoliciesClient with the specified values. -func NewManagedBackupShortTermRetentionPoliciesClient(con *arm.Connection, subscriptionID string) *ManagedBackupShortTermRetentionPoliciesClient { - return &ManagedBackupShortTermRetentionPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedBackupShortTermRetentionPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedBackupShortTermRetentionPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedBackupShortTermRetentionPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Updates a managed database's short term retention policy. @@ -172,7 +179,7 @@ func (client *ManagedBackupShortTermRetentionPoliciesClient) getCreateRequest(ct func (client *ManagedBackupShortTermRetentionPoliciesClient) getHandleResponse(resp *http.Response) (ManagedBackupShortTermRetentionPoliciesGetResponse, error) { result := ManagedBackupShortTermRetentionPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedBackupShortTermRetentionPolicy); err != nil { - return ManagedBackupShortTermRetentionPoliciesGetResponse{}, err + return ManagedBackupShortTermRetentionPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -237,7 +244,7 @@ func (client *ManagedBackupShortTermRetentionPoliciesClient) listByDatabaseCreat func (client *ManagedBackupShortTermRetentionPoliciesClient) listByDatabaseHandleResponse(resp *http.Response) (ManagedBackupShortTermRetentionPoliciesListByDatabaseResponse, error) { result := ManagedBackupShortTermRetentionPoliciesListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedBackupShortTermRetentionPolicyListResult); err != nil { - return ManagedBackupShortTermRetentionPoliciesListByDatabaseResponse{}, err + return ManagedBackupShortTermRetentionPoliciesListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasecolumns_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasecolumns_client.go index 1a2ad9433e37..c61ca99847ce 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasecolumns_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasecolumns_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedDatabaseColumnsClient contains the methods for the ManagedDatabaseColumns group. @@ -29,8 +30,15 @@ type ManagedDatabaseColumnsClient struct { } // NewManagedDatabaseColumnsClient creates a new instance of ManagedDatabaseColumnsClient with the specified values. -func NewManagedDatabaseColumnsClient(con *arm.Connection, subscriptionID string) *ManagedDatabaseColumnsClient { - return &ManagedDatabaseColumnsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedDatabaseColumnsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedDatabaseColumnsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedDatabaseColumnsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get managed database column @@ -96,7 +104,7 @@ func (client *ManagedDatabaseColumnsClient) getCreateRequest(ctx context.Context func (client *ManagedDatabaseColumnsClient) getHandleResponse(resp *http.Response) (ManagedDatabaseColumnsGetResponse, error) { result := ManagedDatabaseColumnsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseColumn); err != nil { - return ManagedDatabaseColumnsGetResponse{}, err + return ManagedDatabaseColumnsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -184,7 +192,7 @@ func (client *ManagedDatabaseColumnsClient) listByDatabaseCreateRequest(ctx cont func (client *ManagedDatabaseColumnsClient) listByDatabaseHandleResponse(resp *http.Response) (ManagedDatabaseColumnsListByDatabaseResponse, error) { result := ManagedDatabaseColumnsListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseColumnListResult); err != nil { - return ManagedDatabaseColumnsListByDatabaseResponse{}, err + return ManagedDatabaseColumnsListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -260,7 +268,7 @@ func (client *ManagedDatabaseColumnsClient) listByTableCreateRequest(ctx context func (client *ManagedDatabaseColumnsClient) listByTableHandleResponse(resp *http.Response) (ManagedDatabaseColumnsListByTableResponse, error) { result := ManagedDatabaseColumnsListByTableResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseColumnListResult); err != nil { - return ManagedDatabaseColumnsListByTableResponse{}, err + return ManagedDatabaseColumnsListByTableResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasequeries_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasequeries_client.go index 307d79ff7185..14bdd2ebb65f 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasequeries_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasequeries_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedDatabaseQueriesClient contains the methods for the ManagedDatabaseQueries group. @@ -29,8 +30,15 @@ type ManagedDatabaseQueriesClient struct { } // NewManagedDatabaseQueriesClient creates a new instance of ManagedDatabaseQueriesClient with the specified values. -func NewManagedDatabaseQueriesClient(con *arm.Connection, subscriptionID string) *ManagedDatabaseQueriesClient { - return &ManagedDatabaseQueriesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedDatabaseQueriesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedDatabaseQueriesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedDatabaseQueriesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get query by query id. @@ -88,7 +96,7 @@ func (client *ManagedDatabaseQueriesClient) getCreateRequest(ctx context.Context func (client *ManagedDatabaseQueriesClient) getHandleResponse(resp *http.Response) (ManagedDatabaseQueriesGetResponse, error) { result := ManagedDatabaseQueriesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceQuery); err != nil { - return ManagedDatabaseQueriesGetResponse{}, err + return ManagedDatabaseQueriesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -166,7 +174,7 @@ func (client *ManagedDatabaseQueriesClient) listByQueryCreateRequest(ctx context func (client *ManagedDatabaseQueriesClient) listByQueryHandleResponse(resp *http.Response) (ManagedDatabaseQueriesListByQueryResponse, error) { result := ManagedDatabaseQueriesListByQueryResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceQueryStatistics); err != nil { - return ManagedDatabaseQueriesListByQueryResponse{}, err + return ManagedDatabaseQueriesListByQueryResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabaserecommendedsensitivitylabels_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabaserecommendedsensitivitylabels_client.go index 6ae139b8f942..570cb6c6abca 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabaserecommendedsensitivitylabels_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabaserecommendedsensitivitylabels_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedDatabaseRecommendedSensitivityLabelsClient contains the methods for the ManagedDatabaseRecommendedSensitivityLabels group. @@ -29,8 +30,15 @@ type ManagedDatabaseRecommendedSensitivityLabelsClient struct { } // NewManagedDatabaseRecommendedSensitivityLabelsClient creates a new instance of ManagedDatabaseRecommendedSensitivityLabelsClient with the specified values. -func NewManagedDatabaseRecommendedSensitivityLabelsClient(con *arm.Connection, subscriptionID string) *ManagedDatabaseRecommendedSensitivityLabelsClient { - return &ManagedDatabaseRecommendedSensitivityLabelsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedDatabaseRecommendedSensitivityLabelsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedDatabaseRecommendedSensitivityLabelsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedDatabaseRecommendedSensitivityLabelsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Update - Update recommended sensitivity labels states of a given database using an operations batch. diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabaserestoredetails_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabaserestoredetails_client.go index 45e09d66ed9b..47ac6eea4ede 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabaserestoredetails_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabaserestoredetails_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedDatabaseRestoreDetailsClient contains the methods for the ManagedDatabaseRestoreDetails group. @@ -29,8 +30,15 @@ type ManagedDatabaseRestoreDetailsClient struct { } // NewManagedDatabaseRestoreDetailsClient creates a new instance of ManagedDatabaseRestoreDetailsClient with the specified values. -func NewManagedDatabaseRestoreDetailsClient(con *arm.Connection, subscriptionID string) *ManagedDatabaseRestoreDetailsClient { - return &ManagedDatabaseRestoreDetailsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedDatabaseRestoreDetailsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedDatabaseRestoreDetailsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedDatabaseRestoreDetailsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets managed database restore details. @@ -88,7 +96,7 @@ func (client *ManagedDatabaseRestoreDetailsClient) getCreateRequest(ctx context. func (client *ManagedDatabaseRestoreDetailsClient) getHandleResponse(resp *http.Response) (ManagedDatabaseRestoreDetailsGetResponse, error) { result := ManagedDatabaseRestoreDetailsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedDatabaseRestoreDetailsResult); err != nil { - return ManagedDatabaseRestoreDetailsGetResponse{}, err + return ManagedDatabaseRestoreDetailsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabases_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabases_client.go index 1e34ed950550..0b98d1494ff7 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabases_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabases_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedDatabasesClient contains the methods for the ManagedDatabases group. @@ -30,8 +30,15 @@ type ManagedDatabasesClient struct { } // NewManagedDatabasesClient creates a new instance of ManagedDatabasesClient with the specified values. -func NewManagedDatabasesClient(con *arm.Connection, subscriptionID string) *ManagedDatabasesClient { - return &ManagedDatabasesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedDatabasesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedDatabasesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCompleteRestore - Completes the restore operation on a managed database. @@ -320,7 +327,7 @@ func (client *ManagedDatabasesClient) getCreateRequest(ctx context.Context, reso func (client *ManagedDatabasesClient) getHandleResponse(resp *http.Response) (ManagedDatabasesGetResponse, error) { result := ManagedDatabasesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedDatabase); err != nil { - return ManagedDatabasesGetResponse{}, err + return ManagedDatabasesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -381,7 +388,7 @@ func (client *ManagedDatabasesClient) listByInstanceCreateRequest(ctx context.Co func (client *ManagedDatabasesClient) listByInstanceHandleResponse(resp *http.Response) (ManagedDatabasesListByInstanceResponse, error) { result := ManagedDatabasesListByInstanceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedDatabaseListResult); err != nil { - return ManagedDatabasesListByInstanceResponse{}, err + return ManagedDatabasesListByInstanceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -442,7 +449,7 @@ func (client *ManagedDatabasesClient) listInaccessibleByInstanceCreateRequest(ct func (client *ManagedDatabasesClient) listInaccessibleByInstanceHandleResponse(resp *http.Response) (ManagedDatabasesListInaccessibleByInstanceResponse, error) { result := ManagedDatabasesListInaccessibleByInstanceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedDatabaseListResult); err != nil { - return ManagedDatabasesListInaccessibleByInstanceResponse{}, err + return ManagedDatabasesListInaccessibleByInstanceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabaseschemas_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabaseschemas_client.go index 4c93cc3c2491..47f16a645a74 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabaseschemas_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabaseschemas_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedDatabaseSchemasClient contains the methods for the ManagedDatabaseSchemas group. @@ -29,8 +30,15 @@ type ManagedDatabaseSchemasClient struct { } // NewManagedDatabaseSchemasClient creates a new instance of ManagedDatabaseSchemasClient with the specified values. -func NewManagedDatabaseSchemasClient(con *arm.Connection, subscriptionID string) *ManagedDatabaseSchemasClient { - return &ManagedDatabaseSchemasClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedDatabaseSchemasClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedDatabaseSchemasClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedDatabaseSchemasClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get managed database schema @@ -88,7 +96,7 @@ func (client *ManagedDatabaseSchemasClient) getCreateRequest(ctx context.Context func (client *ManagedDatabaseSchemasClient) getHandleResponse(resp *http.Response) (ManagedDatabaseSchemasGetResponse, error) { result := ManagedDatabaseSchemasGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseSchema); err != nil { - return ManagedDatabaseSchemasGetResponse{}, err + return ManagedDatabaseSchemasGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -156,7 +164,7 @@ func (client *ManagedDatabaseSchemasClient) listByDatabaseCreateRequest(ctx cont func (client *ManagedDatabaseSchemasClient) listByDatabaseHandleResponse(resp *http.Response) (ManagedDatabaseSchemasListByDatabaseResponse, error) { result := ManagedDatabaseSchemasListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseSchemaListResult); err != nil { - return ManagedDatabaseSchemasListByDatabaseResponse{}, err + return ManagedDatabaseSchemasListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasesecurityalertpolicies_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasesecurityalertpolicies_client.go index c31c99303150..5a84b543848e 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasesecurityalertpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasesecurityalertpolicies_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedDatabaseSecurityAlertPoliciesClient contains the methods for the ManagedDatabaseSecurityAlertPolicies group. @@ -29,8 +30,15 @@ type ManagedDatabaseSecurityAlertPoliciesClient struct { } // NewManagedDatabaseSecurityAlertPoliciesClient creates a new instance of ManagedDatabaseSecurityAlertPoliciesClient with the specified values. -func NewManagedDatabaseSecurityAlertPoliciesClient(con *arm.Connection, subscriptionID string) *ManagedDatabaseSecurityAlertPoliciesClient { - return &ManagedDatabaseSecurityAlertPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedDatabaseSecurityAlertPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedDatabaseSecurityAlertPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedDatabaseSecurityAlertPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a database's security alert policy. @@ -88,7 +96,7 @@ func (client *ManagedDatabaseSecurityAlertPoliciesClient) createOrUpdateCreateRe func (client *ManagedDatabaseSecurityAlertPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (ManagedDatabaseSecurityAlertPoliciesCreateOrUpdateResponse, error) { result := ManagedDatabaseSecurityAlertPoliciesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedDatabaseSecurityAlertPolicy); err != nil { - return ManagedDatabaseSecurityAlertPoliciesCreateOrUpdateResponse{}, err + return ManagedDatabaseSecurityAlertPoliciesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -160,7 +168,7 @@ func (client *ManagedDatabaseSecurityAlertPoliciesClient) getCreateRequest(ctx c func (client *ManagedDatabaseSecurityAlertPoliciesClient) getHandleResponse(resp *http.Response) (ManagedDatabaseSecurityAlertPoliciesGetResponse, error) { result := ManagedDatabaseSecurityAlertPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedDatabaseSecurityAlertPolicy); err != nil { - return ManagedDatabaseSecurityAlertPoliciesGetResponse{}, err + return ManagedDatabaseSecurityAlertPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -225,7 +233,7 @@ func (client *ManagedDatabaseSecurityAlertPoliciesClient) listByDatabaseCreateRe func (client *ManagedDatabaseSecurityAlertPoliciesClient) listByDatabaseHandleResponse(resp *http.Response) (ManagedDatabaseSecurityAlertPoliciesListByDatabaseResponse, error) { result := ManagedDatabaseSecurityAlertPoliciesListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedDatabaseSecurityAlertPolicyListResult); err != nil { - return ManagedDatabaseSecurityAlertPoliciesListByDatabaseResponse{}, err + return ManagedDatabaseSecurityAlertPoliciesListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasesecurityevents_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasesecurityevents_client.go index 9609cbe1bb51..0322d1b993b1 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasesecurityevents_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasesecurityevents_client.go @@ -11,14 +11,15 @@ package armsql import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // ManagedDatabaseSecurityEventsClient contains the methods for the ManagedDatabaseSecurityEvents group. @@ -30,8 +31,15 @@ type ManagedDatabaseSecurityEventsClient struct { } // NewManagedDatabaseSecurityEventsClient creates a new instance of ManagedDatabaseSecurityEventsClient with the specified values. -func NewManagedDatabaseSecurityEventsClient(con *arm.Connection, subscriptionID string) *ManagedDatabaseSecurityEventsClient { - return &ManagedDatabaseSecurityEventsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedDatabaseSecurityEventsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedDatabaseSecurityEventsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedDatabaseSecurityEventsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByDatabase - Gets a list of security events. @@ -94,7 +102,7 @@ func (client *ManagedDatabaseSecurityEventsClient) listByDatabaseCreateRequest(c func (client *ManagedDatabaseSecurityEventsClient) listByDatabaseHandleResponse(resp *http.Response) (ManagedDatabaseSecurityEventsListByDatabaseResponse, error) { result := ManagedDatabaseSecurityEventsListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SecurityEventCollection); err != nil { - return ManagedDatabaseSecurityEventsListByDatabaseResponse{}, err + return ManagedDatabaseSecurityEventsListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasesensitivitylabels_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasesensitivitylabels_client.go index a9e65ab1bded..edd08e547737 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasesensitivitylabels_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasesensitivitylabels_client.go @@ -11,14 +11,15 @@ package armsql import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // ManagedDatabaseSensitivityLabelsClient contains the methods for the ManagedDatabaseSensitivityLabels group. @@ -30,8 +31,15 @@ type ManagedDatabaseSensitivityLabelsClient struct { } // NewManagedDatabaseSensitivityLabelsClient creates a new instance of ManagedDatabaseSensitivityLabelsClient with the specified values. -func NewManagedDatabaseSensitivityLabelsClient(con *arm.Connection, subscriptionID string) *ManagedDatabaseSensitivityLabelsClient { - return &ManagedDatabaseSensitivityLabelsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedDatabaseSensitivityLabelsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedDatabaseSensitivityLabelsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedDatabaseSensitivityLabelsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the sensitivity label of a given column @@ -98,7 +106,7 @@ func (client *ManagedDatabaseSensitivityLabelsClient) createOrUpdateCreateReques func (client *ManagedDatabaseSensitivityLabelsClient) createOrUpdateHandleResponse(resp *http.Response) (ManagedDatabaseSensitivityLabelsCreateOrUpdateResponse, error) { result := ManagedDatabaseSensitivityLabelsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SensitivityLabel); err != nil { - return ManagedDatabaseSensitivityLabelsCreateOrUpdateResponse{}, err + return ManagedDatabaseSensitivityLabelsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -395,7 +403,7 @@ func (client *ManagedDatabaseSensitivityLabelsClient) getCreateRequest(ctx conte func (client *ManagedDatabaseSensitivityLabelsClient) getHandleResponse(resp *http.Response) (ManagedDatabaseSensitivityLabelsGetResponse, error) { result := ManagedDatabaseSensitivityLabelsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SensitivityLabel); err != nil { - return ManagedDatabaseSensitivityLabelsGetResponse{}, err + return ManagedDatabaseSensitivityLabelsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -469,7 +477,7 @@ func (client *ManagedDatabaseSensitivityLabelsClient) listCurrentByDatabaseCreat func (client *ManagedDatabaseSensitivityLabelsClient) listCurrentByDatabaseHandleResponse(resp *http.Response) (ManagedDatabaseSensitivityLabelsListCurrentByDatabaseResponse, error) { result := ManagedDatabaseSensitivityLabelsListCurrentByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SensitivityLabelListResult); err != nil { - return ManagedDatabaseSensitivityLabelsListCurrentByDatabaseResponse{}, err + return ManagedDatabaseSensitivityLabelsListCurrentByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -543,7 +551,7 @@ func (client *ManagedDatabaseSensitivityLabelsClient) listRecommendedByDatabaseC func (client *ManagedDatabaseSensitivityLabelsClient) listRecommendedByDatabaseHandleResponse(resp *http.Response) (ManagedDatabaseSensitivityLabelsListRecommendedByDatabaseResponse, error) { result := ManagedDatabaseSensitivityLabelsListRecommendedByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SensitivityLabelListResult); err != nil { - return ManagedDatabaseSensitivityLabelsListRecommendedByDatabaseResponse{}, err + return ManagedDatabaseSensitivityLabelsListRecommendedByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasetables_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasetables_client.go index ab554ee39e3b..91183cffee43 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasetables_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasetables_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedDatabaseTablesClient contains the methods for the ManagedDatabaseTables group. @@ -29,8 +30,15 @@ type ManagedDatabaseTablesClient struct { } // NewManagedDatabaseTablesClient creates a new instance of ManagedDatabaseTablesClient with the specified values. -func NewManagedDatabaseTablesClient(con *arm.Connection, subscriptionID string) *ManagedDatabaseTablesClient { - return &ManagedDatabaseTablesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedDatabaseTablesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedDatabaseTablesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedDatabaseTablesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get managed database table @@ -92,7 +100,7 @@ func (client *ManagedDatabaseTablesClient) getCreateRequest(ctx context.Context, func (client *ManagedDatabaseTablesClient) getHandleResponse(resp *http.Response) (ManagedDatabaseTablesGetResponse, error) { result := ManagedDatabaseTablesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseTable); err != nil { - return ManagedDatabaseTablesGetResponse{}, err + return ManagedDatabaseTablesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -164,7 +172,7 @@ func (client *ManagedDatabaseTablesClient) listBySchemaCreateRequest(ctx context func (client *ManagedDatabaseTablesClient) listBySchemaHandleResponse(resp *http.Response) (ManagedDatabaseTablesListBySchemaResponse, error) { result := ManagedDatabaseTablesListBySchemaResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseTableListResult); err != nil { - return ManagedDatabaseTablesListBySchemaResponse{}, err + return ManagedDatabaseTablesListBySchemaResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasetransparentdataencryption_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasetransparentdataencryption_client.go index a9659d1d27cc..fd67de61fbe1 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasetransparentdataencryption_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasetransparentdataencryption_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedDatabaseTransparentDataEncryptionClient contains the methods for the ManagedDatabaseTransparentDataEncryption group. @@ -29,8 +30,15 @@ type ManagedDatabaseTransparentDataEncryptionClient struct { } // NewManagedDatabaseTransparentDataEncryptionClient creates a new instance of ManagedDatabaseTransparentDataEncryptionClient with the specified values. -func NewManagedDatabaseTransparentDataEncryptionClient(con *arm.Connection, subscriptionID string) *ManagedDatabaseTransparentDataEncryptionClient { - return &ManagedDatabaseTransparentDataEncryptionClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedDatabaseTransparentDataEncryptionClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedDatabaseTransparentDataEncryptionClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedDatabaseTransparentDataEncryptionClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Updates a database's transparent data encryption configuration. @@ -88,7 +96,7 @@ func (client *ManagedDatabaseTransparentDataEncryptionClient) createOrUpdateCrea func (client *ManagedDatabaseTransparentDataEncryptionClient) createOrUpdateHandleResponse(resp *http.Response) (ManagedDatabaseTransparentDataEncryptionCreateOrUpdateResponse, error) { result := ManagedDatabaseTransparentDataEncryptionCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedTransparentDataEncryption); err != nil { - return ManagedDatabaseTransparentDataEncryptionCreateOrUpdateResponse{}, err + return ManagedDatabaseTransparentDataEncryptionCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -160,7 +168,7 @@ func (client *ManagedDatabaseTransparentDataEncryptionClient) getCreateRequest(c func (client *ManagedDatabaseTransparentDataEncryptionClient) getHandleResponse(resp *http.Response) (ManagedDatabaseTransparentDataEncryptionGetResponse, error) { result := ManagedDatabaseTransparentDataEncryptionGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedTransparentDataEncryption); err != nil { - return ManagedDatabaseTransparentDataEncryptionGetResponse{}, err + return ManagedDatabaseTransparentDataEncryptionGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -225,7 +233,7 @@ func (client *ManagedDatabaseTransparentDataEncryptionClient) listByDatabaseCrea func (client *ManagedDatabaseTransparentDataEncryptionClient) listByDatabaseHandleResponse(resp *http.Response) (ManagedDatabaseTransparentDataEncryptionListByDatabaseResponse, error) { result := ManagedDatabaseTransparentDataEncryptionListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedTransparentDataEncryptionListResult); err != nil { - return ManagedDatabaseTransparentDataEncryptionListByDatabaseResponse{}, err + return ManagedDatabaseTransparentDataEncryptionListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasevulnerabilityassessmentrulebaselines_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasevulnerabilityassessmentrulebaselines_client.go index a7698d4009b8..c533265e7371 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasevulnerabilityassessmentrulebaselines_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasevulnerabilityassessmentrulebaselines_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient contains the methods for the ManagedDatabaseVulnerabilityAssessmentRuleBaselines group. @@ -29,8 +30,15 @@ type ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient struct { } // NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient creates a new instance of ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient with the specified values. -func NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient(con *arm.Connection, subscriptionID string) *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient { - return &ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates a database's vulnerability assessment rule baseline. @@ -96,7 +104,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) createO func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) createOrUpdateHandleResponse(resp *http.Response) (ManagedDatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateResponse, error) { result := ManagedDatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseVulnerabilityAssessmentRuleBaseline); err != nil { - return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateResponse{}, err + return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -246,7 +254,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) getCrea func (client *ManagedDatabaseVulnerabilityAssessmentRuleBaselinesClient) getHandleResponse(resp *http.Response) (ManagedDatabaseVulnerabilityAssessmentRuleBaselinesGetResponse, error) { result := ManagedDatabaseVulnerabilityAssessmentRuleBaselinesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseVulnerabilityAssessmentRuleBaseline); err != nil { - return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesGetResponse{}, err + return ManagedDatabaseVulnerabilityAssessmentRuleBaselinesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasevulnerabilityassessments_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasevulnerabilityassessments_client.go index 383c958b73d9..625726f53135 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasevulnerabilityassessments_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasevulnerabilityassessments_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedDatabaseVulnerabilityAssessmentsClient contains the methods for the ManagedDatabaseVulnerabilityAssessments group. @@ -29,8 +30,15 @@ type ManagedDatabaseVulnerabilityAssessmentsClient struct { } // NewManagedDatabaseVulnerabilityAssessmentsClient creates a new instance of ManagedDatabaseVulnerabilityAssessmentsClient with the specified values. -func NewManagedDatabaseVulnerabilityAssessmentsClient(con *arm.Connection, subscriptionID string) *ManagedDatabaseVulnerabilityAssessmentsClient { - return &ManagedDatabaseVulnerabilityAssessmentsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedDatabaseVulnerabilityAssessmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedDatabaseVulnerabilityAssessmentsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedDatabaseVulnerabilityAssessmentsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the database's vulnerability assessment. @@ -88,7 +96,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentsClient) createOrUpdateCreat func (client *ManagedDatabaseVulnerabilityAssessmentsClient) createOrUpdateHandleResponse(resp *http.Response) (ManagedDatabaseVulnerabilityAssessmentsCreateOrUpdateResponse, error) { result := ManagedDatabaseVulnerabilityAssessmentsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseVulnerabilityAssessment); err != nil { - return ManagedDatabaseVulnerabilityAssessmentsCreateOrUpdateResponse{}, err + return ManagedDatabaseVulnerabilityAssessmentsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -222,7 +230,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentsClient) getCreateRequest(ct func (client *ManagedDatabaseVulnerabilityAssessmentsClient) getHandleResponse(resp *http.Response) (ManagedDatabaseVulnerabilityAssessmentsGetResponse, error) { result := ManagedDatabaseVulnerabilityAssessmentsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseVulnerabilityAssessment); err != nil { - return ManagedDatabaseVulnerabilityAssessmentsGetResponse{}, err + return ManagedDatabaseVulnerabilityAssessmentsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -287,7 +295,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentsClient) listByDatabaseCreat func (client *ManagedDatabaseVulnerabilityAssessmentsClient) listByDatabaseHandleResponse(resp *http.Response) (ManagedDatabaseVulnerabilityAssessmentsListByDatabaseResponse, error) { result := ManagedDatabaseVulnerabilityAssessmentsListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseVulnerabilityAssessmentListResult); err != nil { - return ManagedDatabaseVulnerabilityAssessmentsListByDatabaseResponse{}, err + return ManagedDatabaseVulnerabilityAssessmentsListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasevulnerabilityassessmentscans_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasevulnerabilityassessmentscans_client.go index 2a996af03806..a75c705d6546 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasevulnerabilityassessmentscans_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_manageddatabasevulnerabilityassessmentscans_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedDatabaseVulnerabilityAssessmentScansClient contains the methods for the ManagedDatabaseVulnerabilityAssessmentScans group. @@ -30,8 +30,15 @@ type ManagedDatabaseVulnerabilityAssessmentScansClient struct { } // NewManagedDatabaseVulnerabilityAssessmentScansClient creates a new instance of ManagedDatabaseVulnerabilityAssessmentScansClient with the specified values. -func NewManagedDatabaseVulnerabilityAssessmentScansClient(con *arm.Connection, subscriptionID string) *ManagedDatabaseVulnerabilityAssessmentScansClient { - return &ManagedDatabaseVulnerabilityAssessmentScansClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedDatabaseVulnerabilityAssessmentScansClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedDatabaseVulnerabilityAssessmentScansClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedDatabaseVulnerabilityAssessmentScansClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Export - Convert an existing scan result to a human readable format. If already exists nothing happens @@ -93,7 +100,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentScansClient) exportCreateReq func (client *ManagedDatabaseVulnerabilityAssessmentScansClient) exportHandleResponse(resp *http.Response) (ManagedDatabaseVulnerabilityAssessmentScansExportResponse, error) { result := ManagedDatabaseVulnerabilityAssessmentScansExportResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DatabaseVulnerabilityAssessmentScansExport); err != nil { - return ManagedDatabaseVulnerabilityAssessmentScansExportResponse{}, err + return ManagedDatabaseVulnerabilityAssessmentScansExportResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -169,7 +176,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentScansClient) getCreateReques func (client *ManagedDatabaseVulnerabilityAssessmentScansClient) getHandleResponse(resp *http.Response) (ManagedDatabaseVulnerabilityAssessmentScansGetResponse, error) { result := ManagedDatabaseVulnerabilityAssessmentScansGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VulnerabilityAssessmentScanRecord); err != nil { - return ManagedDatabaseVulnerabilityAssessmentScansGetResponse{}, err + return ManagedDatabaseVulnerabilityAssessmentScansGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -324,7 +331,7 @@ func (client *ManagedDatabaseVulnerabilityAssessmentScansClient) listByDatabaseC func (client *ManagedDatabaseVulnerabilityAssessmentScansClient) listByDatabaseHandleResponse(resp *http.Response) (ManagedDatabaseVulnerabilityAssessmentScansListByDatabaseResponse, error) { result := ManagedDatabaseVulnerabilityAssessmentScansListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VulnerabilityAssessmentScanRecordListResult); err != nil { - return ManagedDatabaseVulnerabilityAssessmentScansListByDatabaseResponse{}, err + return ManagedDatabaseVulnerabilityAssessmentScansListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceadministrators_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceadministrators_client.go index e00b51f5fb87..916ebf35100b 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceadministrators_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceadministrators_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedInstanceAdministratorsClient contains the methods for the ManagedInstanceAdministrators group. @@ -30,8 +30,15 @@ type ManagedInstanceAdministratorsClient struct { } // NewManagedInstanceAdministratorsClient creates a new instance of ManagedInstanceAdministratorsClient with the specified values. -func NewManagedInstanceAdministratorsClient(con *arm.Connection, subscriptionID string) *ManagedInstanceAdministratorsClient { - return &ManagedInstanceAdministratorsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedInstanceAdministratorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedInstanceAdministratorsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedInstanceAdministratorsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a managed instance administrator. @@ -242,7 +249,7 @@ func (client *ManagedInstanceAdministratorsClient) getCreateRequest(ctx context. func (client *ManagedInstanceAdministratorsClient) getHandleResponse(resp *http.Response) (ManagedInstanceAdministratorsGetResponse, error) { result := ManagedInstanceAdministratorsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceAdministrator); err != nil { - return ManagedInstanceAdministratorsGetResponse{}, err + return ManagedInstanceAdministratorsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -303,7 +310,7 @@ func (client *ManagedInstanceAdministratorsClient) listByInstanceCreateRequest(c func (client *ManagedInstanceAdministratorsClient) listByInstanceHandleResponse(resp *http.Response) (ManagedInstanceAdministratorsListByInstanceResponse, error) { result := ManagedInstanceAdministratorsListByInstanceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceAdministratorListResult); err != nil { - return ManagedInstanceAdministratorsListByInstanceResponse{}, err + return ManagedInstanceAdministratorsListByInstanceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceazureadonlyauthentications_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceazureadonlyauthentications_client.go index 53c8ccb4e7b1..d29289a38ea5 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceazureadonlyauthentications_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceazureadonlyauthentications_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedInstanceAzureADOnlyAuthenticationsClient contains the methods for the ManagedInstanceAzureADOnlyAuthentications group. @@ -30,8 +30,15 @@ type ManagedInstanceAzureADOnlyAuthenticationsClient struct { } // NewManagedInstanceAzureADOnlyAuthenticationsClient creates a new instance of ManagedInstanceAzureADOnlyAuthenticationsClient with the specified values. -func NewManagedInstanceAzureADOnlyAuthenticationsClient(con *arm.Connection, subscriptionID string) *ManagedInstanceAzureADOnlyAuthenticationsClient { - return &ManagedInstanceAzureADOnlyAuthenticationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedInstanceAzureADOnlyAuthenticationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedInstanceAzureADOnlyAuthenticationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedInstanceAzureADOnlyAuthenticationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Sets Server Active Directory only authentication property or updates an existing server Active Directory only authentication property. @@ -242,7 +249,7 @@ func (client *ManagedInstanceAzureADOnlyAuthenticationsClient) getCreateRequest( func (client *ManagedInstanceAzureADOnlyAuthenticationsClient) getHandleResponse(resp *http.Response) (ManagedInstanceAzureADOnlyAuthenticationsGetResponse, error) { result := ManagedInstanceAzureADOnlyAuthenticationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceAzureADOnlyAuthentication); err != nil { - return ManagedInstanceAzureADOnlyAuthenticationsGetResponse{}, err + return ManagedInstanceAzureADOnlyAuthenticationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -303,7 +310,7 @@ func (client *ManagedInstanceAzureADOnlyAuthenticationsClient) listByInstanceCre func (client *ManagedInstanceAzureADOnlyAuthenticationsClient) listByInstanceHandleResponse(resp *http.Response) (ManagedInstanceAzureADOnlyAuthenticationsListByInstanceResponse, error) { result := ManagedInstanceAzureADOnlyAuthenticationsListByInstanceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceAzureADOnlyAuthListResult); err != nil { - return ManagedInstanceAzureADOnlyAuthenticationsListByInstanceResponse{}, err + return ManagedInstanceAzureADOnlyAuthenticationsListByInstanceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceencryptionprotectors_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceencryptionprotectors_client.go index 6f7366eccecd..36691aed5720 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceencryptionprotectors_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceencryptionprotectors_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedInstanceEncryptionProtectorsClient contains the methods for the ManagedInstanceEncryptionProtectors group. @@ -30,8 +30,15 @@ type ManagedInstanceEncryptionProtectorsClient struct { } // NewManagedInstanceEncryptionProtectorsClient creates a new instance of ManagedInstanceEncryptionProtectorsClient with the specified values. -func NewManagedInstanceEncryptionProtectorsClient(con *arm.Connection, subscriptionID string) *ManagedInstanceEncryptionProtectorsClient { - return &ManagedInstanceEncryptionProtectorsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedInstanceEncryptionProtectorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedInstanceEncryptionProtectorsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedInstanceEncryptionProtectorsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Updates an existing encryption protector. @@ -164,7 +171,7 @@ func (client *ManagedInstanceEncryptionProtectorsClient) getCreateRequest(ctx co func (client *ManagedInstanceEncryptionProtectorsClient) getHandleResponse(resp *http.Response) (ManagedInstanceEncryptionProtectorsGetResponse, error) { result := ManagedInstanceEncryptionProtectorsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceEncryptionProtector); err != nil { - return ManagedInstanceEncryptionProtectorsGetResponse{}, err + return ManagedInstanceEncryptionProtectorsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -225,7 +232,7 @@ func (client *ManagedInstanceEncryptionProtectorsClient) listByInstanceCreateReq func (client *ManagedInstanceEncryptionProtectorsClient) listByInstanceHandleResponse(resp *http.Response) (ManagedInstanceEncryptionProtectorsListByInstanceResponse, error) { result := ManagedInstanceEncryptionProtectorsListByInstanceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceEncryptionProtectorListResult); err != nil { - return ManagedInstanceEncryptionProtectorsListByInstanceResponse{}, err + return ManagedInstanceEncryptionProtectorsListByInstanceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstancekeys_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstancekeys_client.go index 38392734a01c..3864f8368a84 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstancekeys_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstancekeys_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedInstanceKeysClient contains the methods for the ManagedInstanceKeys group. @@ -30,8 +30,15 @@ type ManagedInstanceKeysClient struct { } // NewManagedInstanceKeysClient creates a new instance of ManagedInstanceKeysClient with the specified values. -func NewManagedInstanceKeysClient(con *arm.Connection, subscriptionID string) *ManagedInstanceKeysClient { - return &ManagedInstanceKeysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedInstanceKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedInstanceKeysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedInstanceKeysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a managed instance key. @@ -242,7 +249,7 @@ func (client *ManagedInstanceKeysClient) getCreateRequest(ctx context.Context, r func (client *ManagedInstanceKeysClient) getHandleResponse(resp *http.Response) (ManagedInstanceKeysGetResponse, error) { result := ManagedInstanceKeysGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceKey); err != nil { - return ManagedInstanceKeysGetResponse{}, err + return ManagedInstanceKeysGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -306,7 +313,7 @@ func (client *ManagedInstanceKeysClient) listByInstanceCreateRequest(ctx context func (client *ManagedInstanceKeysClient) listByInstanceHandleResponse(resp *http.Response) (ManagedInstanceKeysListByInstanceResponse, error) { result := ManagedInstanceKeysListByInstanceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceKeyListResult); err != nil { - return ManagedInstanceKeysListByInstanceResponse{}, err + return ManagedInstanceKeysListByInstanceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstancelongtermretentionpolicies_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstancelongtermretentionpolicies_client.go index 36c1f94d6522..74d754de096d 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstancelongtermretentionpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstancelongtermretentionpolicies_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedInstanceLongTermRetentionPoliciesClient contains the methods for the ManagedInstanceLongTermRetentionPolicies group. @@ -30,8 +30,15 @@ type ManagedInstanceLongTermRetentionPoliciesClient struct { } // NewManagedInstanceLongTermRetentionPoliciesClient creates a new instance of ManagedInstanceLongTermRetentionPoliciesClient with the specified values. -func NewManagedInstanceLongTermRetentionPoliciesClient(con *arm.Connection, subscriptionID string) *ManagedInstanceLongTermRetentionPoliciesClient { - return &ManagedInstanceLongTermRetentionPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedInstanceLongTermRetentionPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedInstanceLongTermRetentionPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedInstanceLongTermRetentionPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Sets a managed database's long term retention policy. @@ -172,7 +179,7 @@ func (client *ManagedInstanceLongTermRetentionPoliciesClient) getCreateRequest(c func (client *ManagedInstanceLongTermRetentionPoliciesClient) getHandleResponse(resp *http.Response) (ManagedInstanceLongTermRetentionPoliciesGetResponse, error) { result := ManagedInstanceLongTermRetentionPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceLongTermRetentionPolicy); err != nil { - return ManagedInstanceLongTermRetentionPoliciesGetResponse{}, err + return ManagedInstanceLongTermRetentionPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -237,7 +244,7 @@ func (client *ManagedInstanceLongTermRetentionPoliciesClient) listByDatabaseCrea func (client *ManagedInstanceLongTermRetentionPoliciesClient) listByDatabaseHandleResponse(resp *http.Response) (ManagedInstanceLongTermRetentionPoliciesListByDatabaseResponse, error) { result := ManagedInstanceLongTermRetentionPoliciesListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceLongTermRetentionPolicyListResult); err != nil { - return ManagedInstanceLongTermRetentionPoliciesListByDatabaseResponse{}, err + return ManagedInstanceLongTermRetentionPoliciesListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceoperations_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceoperations_client.go index 83fcbceb5812..e7ed9721bf37 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceoperations_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceoperations_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedInstanceOperationsClient contains the methods for the ManagedInstanceOperations group. @@ -29,8 +30,15 @@ type ManagedInstanceOperationsClient struct { } // NewManagedInstanceOperationsClient creates a new instance of ManagedInstanceOperationsClient with the specified values. -func NewManagedInstanceOperationsClient(con *arm.Connection, subscriptionID string) *ManagedInstanceOperationsClient { - return &ManagedInstanceOperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedInstanceOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedInstanceOperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedInstanceOperationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Cancel - Cancels the asynchronous operation on the managed instance. @@ -136,7 +144,7 @@ func (client *ManagedInstanceOperationsClient) getCreateRequest(ctx context.Cont func (client *ManagedInstanceOperationsClient) getHandleResponse(resp *http.Response) (ManagedInstanceOperationsGetResponse, error) { result := ManagedInstanceOperationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceOperation); err != nil { - return ManagedInstanceOperationsGetResponse{}, err + return ManagedInstanceOperationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -197,7 +205,7 @@ func (client *ManagedInstanceOperationsClient) listByManagedInstanceCreateReques func (client *ManagedInstanceOperationsClient) listByManagedInstanceHandleResponse(resp *http.Response) (ManagedInstanceOperationsListByManagedInstanceResponse, error) { result := ManagedInstanceOperationsListByManagedInstanceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceOperationListResult); err != nil { - return ManagedInstanceOperationsListByManagedInstanceResponse{}, err + return ManagedInstanceOperationsListByManagedInstanceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceprivateendpointconnections_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceprivateendpointconnections_client.go index 837b14b7a463..c020f6917511 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceprivateendpointconnections_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceprivateendpointconnections_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedInstancePrivateEndpointConnectionsClient contains the methods for the ManagedInstancePrivateEndpointConnections group. @@ -30,8 +30,15 @@ type ManagedInstancePrivateEndpointConnectionsClient struct { } // NewManagedInstancePrivateEndpointConnectionsClient creates a new instance of ManagedInstancePrivateEndpointConnectionsClient with the specified values. -func NewManagedInstancePrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *ManagedInstancePrivateEndpointConnectionsClient { - return &ManagedInstancePrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedInstancePrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedInstancePrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedInstancePrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. @@ -242,7 +249,7 @@ func (client *ManagedInstancePrivateEndpointConnectionsClient) getCreateRequest( func (client *ManagedInstancePrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (ManagedInstancePrivateEndpointConnectionsGetResponse, error) { result := ManagedInstancePrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstancePrivateEndpointConnection); err != nil { - return ManagedInstancePrivateEndpointConnectionsGetResponse{}, err + return ManagedInstancePrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -303,7 +310,7 @@ func (client *ManagedInstancePrivateEndpointConnectionsClient) listByManagedInst func (client *ManagedInstancePrivateEndpointConnectionsClient) listByManagedInstanceHandleResponse(resp *http.Response) (ManagedInstancePrivateEndpointConnectionsListByManagedInstanceResponse, error) { result := ManagedInstancePrivateEndpointConnectionsListByManagedInstanceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstancePrivateEndpointConnectionListResult); err != nil { - return ManagedInstancePrivateEndpointConnectionsListByManagedInstanceResponse{}, err + return ManagedInstancePrivateEndpointConnectionsListByManagedInstanceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceprivatelinkresources_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceprivatelinkresources_client.go index 59b3502174bd..92ea8e753c37 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceprivatelinkresources_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstanceprivatelinkresources_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedInstancePrivateLinkResourcesClient contains the methods for the ManagedInstancePrivateLinkResources group. @@ -29,8 +30,15 @@ type ManagedInstancePrivateLinkResourcesClient struct { } // NewManagedInstancePrivateLinkResourcesClient creates a new instance of ManagedInstancePrivateLinkResourcesClient with the specified values. -func NewManagedInstancePrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *ManagedInstancePrivateLinkResourcesClient { - return &ManagedInstancePrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedInstancePrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedInstancePrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedInstancePrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a private link resource for SQL server. @@ -84,7 +92,7 @@ func (client *ManagedInstancePrivateLinkResourcesClient) getCreateRequest(ctx co func (client *ManagedInstancePrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (ManagedInstancePrivateLinkResourcesGetResponse, error) { result := ManagedInstancePrivateLinkResourcesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstancePrivateLink); err != nil { - return ManagedInstancePrivateLinkResourcesGetResponse{}, err + return ManagedInstancePrivateLinkResourcesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -145,7 +153,7 @@ func (client *ManagedInstancePrivateLinkResourcesClient) listByManagedInstanceCr func (client *ManagedInstancePrivateLinkResourcesClient) listByManagedInstanceHandleResponse(resp *http.Response) (ManagedInstancePrivateLinkResourcesListByManagedInstanceResponse, error) { result := ManagedInstancePrivateLinkResourcesListByManagedInstanceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstancePrivateLinkListResult); err != nil { - return ManagedInstancePrivateLinkResourcesListByManagedInstanceResponse{}, err + return ManagedInstancePrivateLinkResourcesListByManagedInstanceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstances_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstances_client.go index 56098da2c3fb..6cda63a3ac73 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstances_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstances_client.go @@ -11,15 +11,15 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // ManagedInstancesClient contains the methods for the ManagedInstances group. @@ -31,8 +31,15 @@ type ManagedInstancesClient struct { } // NewManagedInstancesClient creates a new instance of ManagedInstancesClient with the specified values. -func NewManagedInstancesClient(con *arm.Connection, subscriptionID string) *ManagedInstancesClient { - return &ManagedInstancesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedInstancesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedInstancesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedInstancesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a managed instance. @@ -311,7 +318,7 @@ func (client *ManagedInstancesClient) getCreateRequest(ctx context.Context, reso func (client *ManagedInstancesClient) getHandleResponse(resp *http.Response) (ManagedInstancesGetResponse, error) { result := ManagedInstancesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstance); err != nil { - return ManagedInstancesGetResponse{}, err + return ManagedInstancesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -367,7 +374,7 @@ func (client *ManagedInstancesClient) listCreateRequest(ctx context.Context, opt func (client *ManagedInstancesClient) listHandleResponse(resp *http.Response) (ManagedInstancesListResponse, error) { result := ManagedInstancesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceListResult); err != nil { - return ManagedInstancesListResponse{}, err + return ManagedInstancesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -431,7 +438,7 @@ func (client *ManagedInstancesClient) listByInstancePoolCreateRequest(ctx contex func (client *ManagedInstancesClient) listByInstancePoolHandleResponse(resp *http.Response) (ManagedInstancesListByInstancePoolResponse, error) { result := ManagedInstancesListByInstancePoolResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceListResult); err != nil { - return ManagedInstancesListByInstancePoolResponse{}, err + return ManagedInstancesListByInstancePoolResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -513,7 +520,7 @@ func (client *ManagedInstancesClient) listByManagedInstanceCreateRequest(ctx con func (client *ManagedInstancesClient) listByManagedInstanceHandleResponse(resp *http.Response) (ManagedInstancesListByManagedInstanceResponse, error) { result := ManagedInstancesListByManagedInstanceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TopQueriesListResult); err != nil { - return ManagedInstancesListByManagedInstanceResponse{}, err + return ManagedInstancesListByManagedInstanceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -573,7 +580,7 @@ func (client *ManagedInstancesClient) listByResourceGroupCreateRequest(ctx conte func (client *ManagedInstancesClient) listByResourceGroupHandleResponse(resp *http.Response) (ManagedInstancesListByResourceGroupResponse, error) { result := ManagedInstancesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceListResult); err != nil { - return ManagedInstancesListByResourceGroupResponse{}, err + return ManagedInstancesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstancetdecertificates_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstancetdecertificates_client.go index dc563c04c9e0..d4ca8a9197e9 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstancetdecertificates_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstancetdecertificates_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedInstanceTdeCertificatesClient contains the methods for the ManagedInstanceTdeCertificates group. @@ -30,8 +30,15 @@ type ManagedInstanceTdeCertificatesClient struct { } // NewManagedInstanceTdeCertificatesClient creates a new instance of ManagedInstanceTdeCertificatesClient with the specified values. -func NewManagedInstanceTdeCertificatesClient(con *arm.Connection, subscriptionID string) *ManagedInstanceTdeCertificatesClient { - return &ManagedInstanceTdeCertificatesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedInstanceTdeCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedInstanceTdeCertificatesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedInstanceTdeCertificatesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a TDE certificate for a given server. diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstancevulnerabilityassessments_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstancevulnerabilityassessments_client.go index e45f059b21fd..17130c4ff8fb 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_managedinstancevulnerabilityassessments_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_managedinstancevulnerabilityassessments_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedInstanceVulnerabilityAssessmentsClient contains the methods for the ManagedInstanceVulnerabilityAssessments group. @@ -29,8 +30,15 @@ type ManagedInstanceVulnerabilityAssessmentsClient struct { } // NewManagedInstanceVulnerabilityAssessmentsClient creates a new instance of ManagedInstanceVulnerabilityAssessmentsClient with the specified values. -func NewManagedInstanceVulnerabilityAssessmentsClient(con *arm.Connection, subscriptionID string) *ManagedInstanceVulnerabilityAssessmentsClient { - return &ManagedInstanceVulnerabilityAssessmentsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedInstanceVulnerabilityAssessmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedInstanceVulnerabilityAssessmentsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedInstanceVulnerabilityAssessmentsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the managed instance's vulnerability assessment. Learn more about setting SQL vulnerability assessment with managed @@ -86,7 +94,7 @@ func (client *ManagedInstanceVulnerabilityAssessmentsClient) createOrUpdateCreat func (client *ManagedInstanceVulnerabilityAssessmentsClient) createOrUpdateHandleResponse(resp *http.Response) (ManagedInstanceVulnerabilityAssessmentsCreateOrUpdateResponse, error) { result := ManagedInstanceVulnerabilityAssessmentsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceVulnerabilityAssessment); err != nil { - return ManagedInstanceVulnerabilityAssessmentsCreateOrUpdateResponse{}, err + return ManagedInstanceVulnerabilityAssessmentsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -212,7 +220,7 @@ func (client *ManagedInstanceVulnerabilityAssessmentsClient) getCreateRequest(ct func (client *ManagedInstanceVulnerabilityAssessmentsClient) getHandleResponse(resp *http.Response) (ManagedInstanceVulnerabilityAssessmentsGetResponse, error) { result := ManagedInstanceVulnerabilityAssessmentsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceVulnerabilityAssessment); err != nil { - return ManagedInstanceVulnerabilityAssessmentsGetResponse{}, err + return ManagedInstanceVulnerabilityAssessmentsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -273,7 +281,7 @@ func (client *ManagedInstanceVulnerabilityAssessmentsClient) listByInstanceCreat func (client *ManagedInstanceVulnerabilityAssessmentsClient) listByInstanceHandleResponse(resp *http.Response) (ManagedInstanceVulnerabilityAssessmentsListByInstanceResponse, error) { result := ManagedInstanceVulnerabilityAssessmentsListByInstanceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedInstanceVulnerabilityAssessmentListResult); err != nil { - return ManagedInstanceVulnerabilityAssessmentsListByInstanceResponse{}, err + return ManagedInstanceVulnerabilityAssessmentsListByInstanceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_managedrestorabledroppeddatabasebackupshorttermretentionpolicies_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_managedrestorabledroppeddatabasebackupshorttermretentionpolicies_client.go index d7c1208c194d..83cc771d227c 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_managedrestorabledroppeddatabasebackupshorttermretentionpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_managedrestorabledroppeddatabasebackupshorttermretentionpolicies_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient contains the methods for the ManagedRestorableDroppedDatabaseBackupShortTermRetentionPolicies group. @@ -30,8 +30,15 @@ type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient stru } // NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient creates a new instance of ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient with the specified values. -func NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient(con *arm.Connection, subscriptionID string) *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient { - return &ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Sets a database's short term retention policy. @@ -172,7 +179,7 @@ func (client *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCl func (client *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) getHandleResponse(resp *http.Response) (ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesGetResponse, error) { result := ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedBackupShortTermRetentionPolicy); err != nil { - return ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesGetResponse{}, err + return ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -237,7 +244,7 @@ func (client *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCl func (client *ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesClient) listByRestorableDroppedDatabaseHandleResponse(resp *http.Response) (ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesListByRestorableDroppedDatabaseResponse, error) { result := ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesListByRestorableDroppedDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedBackupShortTermRetentionPolicyListResult); err != nil { - return ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesListByRestorableDroppedDatabaseResponse{}, err + return ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesListByRestorableDroppedDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_managedserversecurityalertpolicies_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_managedserversecurityalertpolicies_client.go index 00e209095e2d..b4447ad36732 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_managedserversecurityalertpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_managedserversecurityalertpolicies_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagedServerSecurityAlertPoliciesClient contains the methods for the ManagedServerSecurityAlertPolicies group. @@ -30,8 +30,15 @@ type ManagedServerSecurityAlertPoliciesClient struct { } // NewManagedServerSecurityAlertPoliciesClient creates a new instance of ManagedServerSecurityAlertPoliciesClient with the specified values. -func NewManagedServerSecurityAlertPoliciesClient(con *arm.Connection, subscriptionID string) *ManagedServerSecurityAlertPoliciesClient { - return &ManagedServerSecurityAlertPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagedServerSecurityAlertPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagedServerSecurityAlertPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagedServerSecurityAlertPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a threat detection policy. @@ -164,7 +171,7 @@ func (client *ManagedServerSecurityAlertPoliciesClient) getCreateRequest(ctx con func (client *ManagedServerSecurityAlertPoliciesClient) getHandleResponse(resp *http.Response) (ManagedServerSecurityAlertPoliciesGetResponse, error) { result := ManagedServerSecurityAlertPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedServerSecurityAlertPolicy); err != nil { - return ManagedServerSecurityAlertPoliciesGetResponse{}, err + return ManagedServerSecurityAlertPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -225,7 +232,7 @@ func (client *ManagedServerSecurityAlertPoliciesClient) listByInstanceCreateRequ func (client *ManagedServerSecurityAlertPoliciesClient) listByInstanceHandleResponse(resp *http.Response) (ManagedServerSecurityAlertPoliciesListByInstanceResponse, error) { result := ManagedServerSecurityAlertPoliciesListByInstanceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagedServerSecurityAlertPolicyListResult); err != nil { - return ManagedServerSecurityAlertPoliciesListByInstanceResponse{}, err + return ManagedServerSecurityAlertPoliciesListByInstanceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_models.go b/sdk/resourcemanager/sql/armsql/zz_generated_models.go index da41b7f3be3f..de068bd52968 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_models.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_models.go @@ -10,10 +10,9 @@ package armsql import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // AdministratorListResult - A list of active directory administrators. @@ -105,7 +104,7 @@ func (a AdvisorProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "advisorStatus", a.AdvisorStatus) populate(objectMap, "autoExecuteStatus", a.AutoExecuteStatus) populate(objectMap, "autoExecuteStatusInheritedFrom", a.AutoExecuteStatusInheritedFrom) - populate(objectMap, "lastChecked", (*timeRFC3339)(a.LastChecked)) + populateTimeRFC3339(objectMap, "lastChecked", a.LastChecked) populate(objectMap, "recommendationsStatus", a.RecommendationsStatus) populate(objectMap, "recommendedActions", a.RecommendedActions) return json.Marshal(objectMap) @@ -130,9 +129,7 @@ func (a *AdvisorProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.AutoExecuteStatusInheritedFrom) delete(rawMsg, key) case "lastChecked": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.LastChecked = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.LastChecked) delete(rawMsg, key) case "recommendationsStatus": err = unpopulate(val, &a.RecommendationsStatus) @@ -1030,14 +1027,14 @@ func (d DatabaseOperationProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "errorCode", d.ErrorCode) populate(objectMap, "errorDescription", d.ErrorDescription) populate(objectMap, "errorSeverity", d.ErrorSeverity) - populate(objectMap, "estimatedCompletionTime", (*timeRFC3339)(d.EstimatedCompletionTime)) + populateTimeRFC3339(objectMap, "estimatedCompletionTime", d.EstimatedCompletionTime) populate(objectMap, "isCancellable", d.IsCancellable) populate(objectMap, "isUserError", d.IsUserError) populate(objectMap, "operation", d.Operation) populate(objectMap, "operationFriendlyName", d.OperationFriendlyName) populate(objectMap, "percentComplete", d.PercentComplete) populate(objectMap, "serverName", d.ServerName) - populate(objectMap, "startTime", (*timeRFC3339)(d.StartTime)) + populateTimeRFC3339(objectMap, "startTime", d.StartTime) populate(objectMap, "state", d.State) return json.Marshal(objectMap) } @@ -1067,9 +1064,7 @@ func (d *DatabaseOperationProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.ErrorSeverity) delete(rawMsg, key) case "estimatedCompletionTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.EstimatedCompletionTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.EstimatedCompletionTime) delete(rawMsg, key) case "isCancellable": err = unpopulate(val, &d.IsCancellable) @@ -1090,9 +1085,7 @@ func (d *DatabaseOperationProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.ServerName) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.StartTime) delete(rawMsg, key) case "state": err = unpopulate(val, &d.State) @@ -1255,13 +1248,13 @@ func (d DatabaseProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "catalogCollation", d.CatalogCollation) populate(objectMap, "collation", d.Collation) populate(objectMap, "createMode", d.CreateMode) - populate(objectMap, "creationDate", (*timeRFC3339)(d.CreationDate)) + populateTimeRFC3339(objectMap, "creationDate", d.CreationDate) populate(objectMap, "currentBackupStorageRedundancy", d.CurrentBackupStorageRedundancy) populate(objectMap, "currentSku", d.CurrentSKU) populate(objectMap, "currentServiceObjectiveName", d.CurrentServiceObjectiveName) populate(objectMap, "databaseId", d.DatabaseID) populate(objectMap, "defaultSecondaryLocation", d.DefaultSecondaryLocation) - populate(objectMap, "earliestRestoreDate", (*timeRFC3339)(d.EarliestRestoreDate)) + populateTimeRFC3339(objectMap, "earliestRestoreDate", d.EarliestRestoreDate) populate(objectMap, "elasticPoolId", d.ElasticPoolID) populate(objectMap, "failoverGroupId", d.FailoverGroupID) populate(objectMap, "highAvailabilityReplicaCount", d.HighAvailabilityReplicaCount) @@ -1273,18 +1266,18 @@ func (d DatabaseProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "maxLogSizeBytes", d.MaxLogSizeBytes) populate(objectMap, "maxSizeBytes", d.MaxSizeBytes) populate(objectMap, "minCapacity", d.MinCapacity) - populate(objectMap, "pausedDate", (*timeRFC3339)(d.PausedDate)) + populateTimeRFC3339(objectMap, "pausedDate", d.PausedDate) populate(objectMap, "readScale", d.ReadScale) populate(objectMap, "recoverableDatabaseId", d.RecoverableDatabaseID) populate(objectMap, "recoveryServicesRecoveryPointId", d.RecoveryServicesRecoveryPointID) populate(objectMap, "requestedBackupStorageRedundancy", d.RequestedBackupStorageRedundancy) populate(objectMap, "requestedServiceObjectiveName", d.RequestedServiceObjectiveName) populate(objectMap, "restorableDroppedDatabaseId", d.RestorableDroppedDatabaseID) - populate(objectMap, "restorePointInTime", (*timeRFC3339)(d.RestorePointInTime)) - populate(objectMap, "resumedDate", (*timeRFC3339)(d.ResumedDate)) + populateTimeRFC3339(objectMap, "restorePointInTime", d.RestorePointInTime) + populateTimeRFC3339(objectMap, "resumedDate", d.ResumedDate) populate(objectMap, "sampleName", d.SampleName) populate(objectMap, "secondaryType", d.SecondaryType) - populate(objectMap, "sourceDatabaseDeletionDate", (*timeRFC3339)(d.SourceDatabaseDeletionDate)) + populateTimeRFC3339(objectMap, "sourceDatabaseDeletionDate", d.SourceDatabaseDeletionDate) populate(objectMap, "sourceDatabaseId", d.SourceDatabaseID) populate(objectMap, "status", d.Status) populate(objectMap, "zoneRedundant", d.ZoneRedundant) @@ -1313,9 +1306,7 @@ func (d *DatabaseProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.CreateMode) delete(rawMsg, key) case "creationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.CreationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.CreationDate) delete(rawMsg, key) case "currentBackupStorageRedundancy": err = unpopulate(val, &d.CurrentBackupStorageRedundancy) @@ -1333,9 +1324,7 @@ func (d *DatabaseProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.DefaultSecondaryLocation) delete(rawMsg, key) case "earliestRestoreDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.EarliestRestoreDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.EarliestRestoreDate) delete(rawMsg, key) case "elasticPoolId": err = unpopulate(val, &d.ElasticPoolID) @@ -1371,9 +1360,7 @@ func (d *DatabaseProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.MinCapacity) delete(rawMsg, key) case "pausedDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.PausedDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.PausedDate) delete(rawMsg, key) case "readScale": err = unpopulate(val, &d.ReadScale) @@ -1394,14 +1381,10 @@ func (d *DatabaseProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.RestorableDroppedDatabaseID) delete(rawMsg, key) case "restorePointInTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.RestorePointInTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.RestorePointInTime) delete(rawMsg, key) case "resumedDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.ResumedDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.ResumedDate) delete(rawMsg, key) case "sampleName": err = unpopulate(val, &d.SampleName) @@ -1410,9 +1393,7 @@ func (d *DatabaseProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.SecondaryType) delete(rawMsg, key) case "sourceDatabaseDeletionDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.SourceDatabaseDeletionDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.SourceDatabaseDeletionDate) delete(rawMsg, key) case "sourceDatabaseId": err = unpopulate(val, &d.SourceDatabaseID) @@ -1958,7 +1939,7 @@ type DeletedServerProperties struct { // MarshalJSON implements the json.Marshaller interface for type DeletedServerProperties. func (d DeletedServerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "deletionTime", (*timeRFC3339)(d.DeletionTime)) + populateTimeRFC3339(objectMap, "deletionTime", d.DeletionTime) populate(objectMap, "fullyQualifiedDomainName", d.FullyQualifiedDomainName) populate(objectMap, "originalId", d.OriginalID) populate(objectMap, "version", d.Version) @@ -1975,9 +1956,7 @@ func (d *DeletedServerProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "deletionTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.DeletionTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.DeletionTime) delete(rawMsg, key) case "fullyQualifiedDomainName": err = unpopulate(val, &d.FullyQualifiedDomainName) @@ -2185,7 +2164,7 @@ type ElasticPoolActivityProperties struct { func (e ElasticPoolActivityProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "elasticPoolName", e.ElasticPoolName) - populate(objectMap, "endTime", (*timeRFC3339)(e.EndTime)) + populateTimeRFC3339(objectMap, "endTime", e.EndTime) populate(objectMap, "errorCode", e.ErrorCode) populate(objectMap, "errorMessage", e.ErrorMessage) populate(objectMap, "errorSeverity", e.ErrorSeverity) @@ -2202,7 +2181,7 @@ func (e ElasticPoolActivityProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "requestedStorageLimitInGB", e.RequestedStorageLimitInGB) populate(objectMap, "requestedStorageLimitInMB", e.RequestedStorageLimitInMB) populate(objectMap, "serverName", e.ServerName) - populate(objectMap, "startTime", (*timeRFC3339)(e.StartTime)) + populateTimeRFC3339(objectMap, "startTime", e.StartTime) populate(objectMap, "state", e.State) return json.Marshal(objectMap) } @@ -2220,9 +2199,7 @@ func (e *ElasticPoolActivityProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.ElasticPoolName) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.EndTime) delete(rawMsg, key) case "errorCode": err = unpopulate(val, &e.ErrorCode) @@ -2273,9 +2250,7 @@ func (e *ElasticPoolActivityProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.ServerName) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.StartTime) delete(rawMsg, key) case "state": err = unpopulate(val, &e.State) @@ -2379,7 +2354,7 @@ func (e ElasticPoolDatabaseActivityProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "currentElasticPoolName", e.CurrentElasticPoolName) populate(objectMap, "currentServiceObjective", e.CurrentServiceObjective) populate(objectMap, "databaseName", e.DatabaseName) - populate(objectMap, "endTime", (*timeRFC3339)(e.EndTime)) + populateTimeRFC3339(objectMap, "endTime", e.EndTime) populate(objectMap, "errorCode", e.ErrorCode) populate(objectMap, "errorMessage", e.ErrorMessage) populate(objectMap, "errorSeverity", e.ErrorSeverity) @@ -2389,7 +2364,7 @@ func (e ElasticPoolDatabaseActivityProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "requestedElasticPoolName", e.RequestedElasticPoolName) populate(objectMap, "requestedServiceObjective", e.RequestedServiceObjective) populate(objectMap, "serverName", e.ServerName) - populate(objectMap, "startTime", (*timeRFC3339)(e.StartTime)) + populateTimeRFC3339(objectMap, "startTime", e.StartTime) populate(objectMap, "state", e.State) return json.Marshal(objectMap) } @@ -2413,9 +2388,7 @@ func (e *ElasticPoolDatabaseActivityProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, &e.DatabaseName) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.EndTime) delete(rawMsg, key) case "errorCode": err = unpopulate(val, &e.ErrorCode) @@ -2445,9 +2418,7 @@ func (e *ElasticPoolDatabaseActivityProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, &e.ServerName) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.StartTime) delete(rawMsg, key) case "state": err = unpopulate(val, &e.State) @@ -2591,14 +2562,14 @@ func (e ElasticPoolOperationProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "errorCode", e.ErrorCode) populate(objectMap, "errorDescription", e.ErrorDescription) populate(objectMap, "errorSeverity", e.ErrorSeverity) - populate(objectMap, "estimatedCompletionTime", (*timeRFC3339)(e.EstimatedCompletionTime)) + populateTimeRFC3339(objectMap, "estimatedCompletionTime", e.EstimatedCompletionTime) populate(objectMap, "isCancellable", e.IsCancellable) populate(objectMap, "isUserError", e.IsUserError) populate(objectMap, "operation", e.Operation) populate(objectMap, "operationFriendlyName", e.OperationFriendlyName) populate(objectMap, "percentComplete", e.PercentComplete) populate(objectMap, "serverName", e.ServerName) - populate(objectMap, "startTime", (*timeRFC3339)(e.StartTime)) + populateTimeRFC3339(objectMap, "startTime", e.StartTime) populate(objectMap, "state", e.State) return json.Marshal(objectMap) } @@ -2628,9 +2599,7 @@ func (e *ElasticPoolOperationProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.ErrorSeverity) delete(rawMsg, key) case "estimatedCompletionTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.EstimatedCompletionTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.EstimatedCompletionTime) delete(rawMsg, key) case "isCancellable": err = unpopulate(val, &e.IsCancellable) @@ -2651,9 +2620,7 @@ func (e *ElasticPoolOperationProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.ServerName) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.StartTime) delete(rawMsg, key) case "state": err = unpopulate(val, &e.State) @@ -2813,7 +2780,7 @@ type ElasticPoolProperties struct { // MarshalJSON implements the json.Marshaller interface for type ElasticPoolProperties. func (e ElasticPoolProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationDate", (*timeRFC3339)(e.CreationDate)) + populateTimeRFC3339(objectMap, "creationDate", e.CreationDate) populate(objectMap, "licenseType", e.LicenseType) populate(objectMap, "maintenanceConfigurationId", e.MaintenanceConfigurationID) populate(objectMap, "maxSizeBytes", e.MaxSizeBytes) @@ -2833,9 +2800,7 @@ func (e *ElasticPoolProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.CreationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.CreationDate) delete(rawMsg, key) case "licenseType": err = unpopulate(val, &e.LicenseType) @@ -4312,16 +4277,16 @@ type JobExecutionProperties struct { // MarshalJSON implements the json.Marshaller interface for type JobExecutionProperties. func (j JobExecutionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createTime", (*timeRFC3339)(j.CreateTime)) - populate(objectMap, "currentAttemptStartTime", (*timeRFC3339)(j.CurrentAttemptStartTime)) + populateTimeRFC3339(objectMap, "createTime", j.CreateTime) + populateTimeRFC3339(objectMap, "currentAttemptStartTime", j.CurrentAttemptStartTime) populate(objectMap, "currentAttempts", j.CurrentAttempts) - populate(objectMap, "endTime", (*timeRFC3339)(j.EndTime)) + populateTimeRFC3339(objectMap, "endTime", j.EndTime) populate(objectMap, "jobExecutionId", j.JobExecutionID) populate(objectMap, "jobVersion", j.JobVersion) populate(objectMap, "lastMessage", j.LastMessage) populate(objectMap, "lifecycle", j.Lifecycle) populate(objectMap, "provisioningState", j.ProvisioningState) - populate(objectMap, "startTime", (*timeRFC3339)(j.StartTime)) + populateTimeRFC3339(objectMap, "startTime", j.StartTime) populate(objectMap, "stepId", j.StepID) populate(objectMap, "stepName", j.StepName) populate(objectMap, "target", j.Target) @@ -4338,22 +4303,16 @@ func (j *JobExecutionProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "createTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.CreateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.CreateTime) delete(rawMsg, key) case "currentAttemptStartTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.CurrentAttemptStartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.CurrentAttemptStartTime) delete(rawMsg, key) case "currentAttempts": err = unpopulate(val, &j.CurrentAttempts) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.EndTime) delete(rawMsg, key) case "jobExecutionId": err = unpopulate(val, &j.JobExecutionID) @@ -4371,9 +4330,7 @@ func (j *JobExecutionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &j.ProvisioningState) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.StartTime) delete(rawMsg, key) case "stepId": err = unpopulate(val, &j.StepID) @@ -4511,9 +4468,9 @@ type JobSchedule struct { func (j JobSchedule) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "enabled", j.Enabled) - populate(objectMap, "endTime", (*timeRFC3339)(j.EndTime)) + populateTimeRFC3339(objectMap, "endTime", j.EndTime) populate(objectMap, "interval", j.Interval) - populate(objectMap, "startTime", (*timeRFC3339)(j.StartTime)) + populateTimeRFC3339(objectMap, "startTime", j.StartTime) populate(objectMap, "type", j.Type) return json.Marshal(objectMap) } @@ -4531,17 +4488,13 @@ func (j *JobSchedule) UnmarshalJSON(data []byte) error { err = unpopulate(val, &j.Enabled) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.EndTime) delete(rawMsg, key) case "interval": err = unpopulate(val, &j.Interval) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - j.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &j.StartTime) delete(rawMsg, key) case "type": err = unpopulate(val, &j.Type) @@ -5137,13 +5090,13 @@ type LongTermRetentionBackupProperties struct { // MarshalJSON implements the json.Marshaller interface for type LongTermRetentionBackupProperties. func (l LongTermRetentionBackupProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "backupExpirationTime", (*timeRFC3339)(l.BackupExpirationTime)) + populateTimeRFC3339(objectMap, "backupExpirationTime", l.BackupExpirationTime) populate(objectMap, "backupStorageRedundancy", l.BackupStorageRedundancy) - populate(objectMap, "backupTime", (*timeRFC3339)(l.BackupTime)) - populate(objectMap, "databaseDeletionTime", (*timeRFC3339)(l.DatabaseDeletionTime)) + populateTimeRFC3339(objectMap, "backupTime", l.BackupTime) + populateTimeRFC3339(objectMap, "databaseDeletionTime", l.DatabaseDeletionTime) populate(objectMap, "databaseName", l.DatabaseName) populate(objectMap, "requestedBackupStorageRedundancy", l.RequestedBackupStorageRedundancy) - populate(objectMap, "serverCreateTime", (*timeRFC3339)(l.ServerCreateTime)) + populateTimeRFC3339(objectMap, "serverCreateTime", l.ServerCreateTime) populate(objectMap, "serverName", l.ServerName) return json.Marshal(objectMap) } @@ -5158,22 +5111,16 @@ func (l *LongTermRetentionBackupProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "backupExpirationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.BackupExpirationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.BackupExpirationTime) delete(rawMsg, key) case "backupStorageRedundancy": err = unpopulate(val, &l.BackupStorageRedundancy) delete(rawMsg, key) case "backupTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.BackupTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.BackupTime) delete(rawMsg, key) case "databaseDeletionTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.DatabaseDeletionTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.DatabaseDeletionTime) delete(rawMsg, key) case "databaseName": err = unpopulate(val, &l.DatabaseName) @@ -5182,9 +5129,7 @@ func (l *LongTermRetentionBackupProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &l.RequestedBackupStorageRedundancy) delete(rawMsg, key) case "serverCreateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.ServerCreateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.ServerCreateTime) delete(rawMsg, key) case "serverName": err = unpopulate(val, &l.ServerName) @@ -5742,15 +5687,15 @@ func (m ManagedDatabaseProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "catalogCollation", m.CatalogCollation) populate(objectMap, "collation", m.Collation) populate(objectMap, "createMode", m.CreateMode) - populate(objectMap, "creationDate", (*timeRFC3339)(m.CreationDate)) + populateTimeRFC3339(objectMap, "creationDate", m.CreationDate) populate(objectMap, "defaultSecondaryLocation", m.DefaultSecondaryLocation) - populate(objectMap, "earliestRestorePoint", (*timeRFC3339)(m.EarliestRestorePoint)) + populateTimeRFC3339(objectMap, "earliestRestorePoint", m.EarliestRestorePoint) populate(objectMap, "failoverGroupId", m.FailoverGroupID) populate(objectMap, "lastBackupName", m.LastBackupName) populate(objectMap, "longTermRetentionBackupResourceId", m.LongTermRetentionBackupResourceID) populate(objectMap, "recoverableDatabaseId", m.RecoverableDatabaseID) populate(objectMap, "restorableDroppedDatabaseId", m.RestorableDroppedDatabaseID) - populate(objectMap, "restorePointInTime", (*timeRFC3339)(m.RestorePointInTime)) + populateTimeRFC3339(objectMap, "restorePointInTime", m.RestorePointInTime) populate(objectMap, "sourceDatabaseId", m.SourceDatabaseID) populate(objectMap, "status", m.Status) populate(objectMap, "storageContainerSasToken", m.StorageContainerSasToken) @@ -5780,17 +5725,13 @@ func (m *ManagedDatabaseProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.CreateMode) delete(rawMsg, key) case "creationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.CreationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.CreationDate) delete(rawMsg, key) case "defaultSecondaryLocation": err = unpopulate(val, &m.DefaultSecondaryLocation) delete(rawMsg, key) case "earliestRestorePoint": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.EarliestRestorePoint = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.EarliestRestorePoint) delete(rawMsg, key) case "failoverGroupId": err = unpopulate(val, &m.FailoverGroupID) @@ -5808,9 +5749,7 @@ func (m *ManagedDatabaseProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.RestorableDroppedDatabaseID) delete(rawMsg, key) case "restorePointInTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.RestorePointInTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.RestorePointInTime) delete(rawMsg, key) case "sourceDatabaseId": err = unpopulate(val, &m.SourceDatabaseID) @@ -5897,9 +5836,9 @@ func (m ManagedDatabaseRestoreDetailsProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "blockReason", m.BlockReason) populate(objectMap, "currentRestoringFileName", m.CurrentRestoringFileName) populate(objectMap, "lastRestoredFileName", m.LastRestoredFileName) - populate(objectMap, "lastRestoredFileTime", (*timeRFC3339)(m.LastRestoredFileTime)) + populateTimeRFC3339(objectMap, "lastRestoredFileTime", m.LastRestoredFileTime) populate(objectMap, "lastUploadedFileName", m.LastUploadedFileName) - populate(objectMap, "lastUploadedFileTime", (*timeRFC3339)(m.LastUploadedFileTime)) + populateTimeRFC3339(objectMap, "lastUploadedFileTime", m.LastUploadedFileTime) populate(objectMap, "numberOfFilesDetected", m.NumberOfFilesDetected) populate(objectMap, "percentCompleted", m.PercentCompleted) populate(objectMap, "status", m.Status) @@ -5926,17 +5865,13 @@ func (m *ManagedDatabaseRestoreDetailsProperties) UnmarshalJSON(data []byte) err err = unpopulate(val, &m.LastRestoredFileName) delete(rawMsg, key) case "lastRestoredFileTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.LastRestoredFileTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.LastRestoredFileTime) delete(rawMsg, key) case "lastUploadedFileName": err = unpopulate(val, &m.LastUploadedFileName) delete(rawMsg, key) case "lastUploadedFileTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.LastUploadedFileTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.LastUploadedFileTime) delete(rawMsg, key) case "numberOfFilesDetected": err = unpopulate(val, &m.NumberOfFilesDetected) @@ -6612,7 +6547,7 @@ type ManagedInstanceKeyProperties struct { func (m ManagedInstanceKeyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "autoRotationEnabled", m.AutoRotationEnabled) - populate(objectMap, "creationDate", (*timeRFC3339)(m.CreationDate)) + populateTimeRFC3339(objectMap, "creationDate", m.CreationDate) populate(objectMap, "serverKeyType", m.ServerKeyType) populate(objectMap, "thumbprint", m.Thumbprint) populate(objectMap, "uri", m.URI) @@ -6632,9 +6567,7 @@ func (m *ManagedInstanceKeyProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.AutoRotationEnabled) delete(rawMsg, key) case "creationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.CreationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.CreationDate) delete(rawMsg, key) case "serverKeyType": err = unpopulate(val, &m.ServerKeyType) @@ -6750,12 +6683,12 @@ type ManagedInstanceLongTermRetentionBackupProperties struct { // MarshalJSON implements the json.Marshaller interface for type ManagedInstanceLongTermRetentionBackupProperties. func (m ManagedInstanceLongTermRetentionBackupProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "backupExpirationTime", (*timeRFC3339)(m.BackupExpirationTime)) + populateTimeRFC3339(objectMap, "backupExpirationTime", m.BackupExpirationTime) populate(objectMap, "backupStorageRedundancy", m.BackupStorageRedundancy) - populate(objectMap, "backupTime", (*timeRFC3339)(m.BackupTime)) - populate(objectMap, "databaseDeletionTime", (*timeRFC3339)(m.DatabaseDeletionTime)) + populateTimeRFC3339(objectMap, "backupTime", m.BackupTime) + populateTimeRFC3339(objectMap, "databaseDeletionTime", m.DatabaseDeletionTime) populate(objectMap, "databaseName", m.DatabaseName) - populate(objectMap, "managedInstanceCreateTime", (*timeRFC3339)(m.ManagedInstanceCreateTime)) + populateTimeRFC3339(objectMap, "managedInstanceCreateTime", m.ManagedInstanceCreateTime) populate(objectMap, "managedInstanceName", m.ManagedInstanceName) return json.Marshal(objectMap) } @@ -6770,30 +6703,22 @@ func (m *ManagedInstanceLongTermRetentionBackupProperties) UnmarshalJSON(data [] var err error switch key { case "backupExpirationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.BackupExpirationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.BackupExpirationTime) delete(rawMsg, key) case "backupStorageRedundancy": err = unpopulate(val, &m.BackupStorageRedundancy) delete(rawMsg, key) case "backupTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.BackupTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.BackupTime) delete(rawMsg, key) case "databaseDeletionTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.DatabaseDeletionTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.DatabaseDeletionTime) delete(rawMsg, key) case "databaseName": err = unpopulate(val, &m.DatabaseName) delete(rawMsg, key) case "managedInstanceCreateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.ManagedInstanceCreateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.ManagedInstanceCreateTime) delete(rawMsg, key) case "managedInstanceName": err = unpopulate(val, &m.ManagedInstanceName) @@ -6963,7 +6888,7 @@ func (m ManagedInstanceOperationProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "errorCode", m.ErrorCode) populate(objectMap, "errorDescription", m.ErrorDescription) populate(objectMap, "errorSeverity", m.ErrorSeverity) - populate(objectMap, "estimatedCompletionTime", (*timeRFC3339)(m.EstimatedCompletionTime)) + populateTimeRFC3339(objectMap, "estimatedCompletionTime", m.EstimatedCompletionTime) populate(objectMap, "isCancellable", m.IsCancellable) populate(objectMap, "isUserError", m.IsUserError) populate(objectMap, "managedInstanceName", m.ManagedInstanceName) @@ -6972,7 +6897,7 @@ func (m ManagedInstanceOperationProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "operationParameters", m.OperationParameters) populate(objectMap, "operationSteps", m.OperationSteps) populate(objectMap, "percentComplete", m.PercentComplete) - populate(objectMap, "startTime", (*timeRFC3339)(m.StartTime)) + populateTimeRFC3339(objectMap, "startTime", m.StartTime) populate(objectMap, "state", m.State) return json.Marshal(objectMap) } @@ -6999,9 +6924,7 @@ func (m *ManagedInstanceOperationProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.ErrorSeverity) delete(rawMsg, key) case "estimatedCompletionTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.EstimatedCompletionTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.EstimatedCompletionTime) delete(rawMsg, key) case "isCancellable": err = unpopulate(val, &m.IsCancellable) @@ -7028,9 +6951,7 @@ func (m *ManagedInstanceOperationProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.PercentComplete) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.StartTime) delete(rawMsg, key) case "state": err = unpopulate(val, &m.State) @@ -7352,7 +7273,7 @@ func (m ManagedInstanceProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "provisioningState", m.ProvisioningState) populate(objectMap, "proxyOverride", m.ProxyOverride) populate(objectMap, "publicDataEndpointEnabled", m.PublicDataEndpointEnabled) - populate(objectMap, "restorePointInTime", (*timeRFC3339)(m.RestorePointInTime)) + populateTimeRFC3339(objectMap, "restorePointInTime", m.RestorePointInTime) populate(objectMap, "sourceManagedInstanceId", m.SourceManagedInstanceID) populate(objectMap, "state", m.State) populate(objectMap, "storageAccountType", m.StorageAccountType) @@ -7428,9 +7349,7 @@ func (m *ManagedInstanceProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.PublicDataEndpointEnabled) delete(rawMsg, key) case "restorePointInTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.RestorePointInTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.RestorePointInTime) delete(rawMsg, key) case "sourceManagedInstanceId": err = unpopulate(val, &m.SourceManagedInstanceID) @@ -7904,10 +7823,10 @@ type Metric struct { // MarshalJSON implements the json.Marshaller interface for type Metric. func (m Metric) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "endTime", (*timeRFC3339)(m.EndTime)) + populateTimeRFC3339(objectMap, "endTime", m.EndTime) populate(objectMap, "metricValues", m.MetricValues) populate(objectMap, "name", m.Name) - populate(objectMap, "startTime", (*timeRFC3339)(m.StartTime)) + populateTimeRFC3339(objectMap, "startTime", m.StartTime) populate(objectMap, "timeGrain", m.TimeGrain) populate(objectMap, "unit", m.Unit) return json.Marshal(objectMap) @@ -7923,9 +7842,7 @@ func (m *Metric) UnmarshalJSON(data []byte) error { var err error switch key { case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.EndTime) delete(rawMsg, key) case "metricValues": err = unpopulate(val, &m.MetricValues) @@ -7934,9 +7851,7 @@ func (m *Metric) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.Name) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.StartTime) delete(rawMsg, key) case "timeGrain": err = unpopulate(val, &m.TimeGrain) @@ -8053,7 +7968,7 @@ func (m MetricValue) MarshalJSON() ([]byte, error) { populate(objectMap, "count", m.Count) populate(objectMap, "maximum", m.Maximum) populate(objectMap, "minimum", m.Minimum) - populate(objectMap, "timestamp", (*timeRFC3339)(m.Timestamp)) + populateTimeRFC3339(objectMap, "timestamp", m.Timestamp) populate(objectMap, "total", m.Total) return json.Marshal(objectMap) } @@ -8080,9 +7995,7 @@ func (m *MetricValue) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.Minimum) delete(rawMsg, key) case "timestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.Timestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.Timestamp) delete(rawMsg, key) case "total": err = unpopulate(val, &m.Total) @@ -8709,7 +8622,7 @@ type RecommendedActionMetricInfo struct { func (r RecommendedActionMetricInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "metricName", r.MetricName) - populate(objectMap, "startTime", (*timeRFC3339)(r.StartTime)) + populateTimeRFC3339(objectMap, "startTime", r.StartTime) populate(objectMap, "timeGrain", r.TimeGrain) populate(objectMap, "unit", r.Unit) populate(objectMap, "value", r.Value) @@ -8729,9 +8642,7 @@ func (r *RecommendedActionMetricInfo) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.MetricName) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.StartTime) delete(rawMsg, key) case "timeGrain": err = unpopulate(val, &r.TimeGrain) @@ -8830,24 +8741,24 @@ func (r RecommendedActionProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "estimatedImpact", r.EstimatedImpact) populate(objectMap, "executeActionDuration", r.ExecuteActionDuration) populate(objectMap, "executeActionInitiatedBy", r.ExecuteActionInitiatedBy) - populate(objectMap, "executeActionInitiatedTime", (*timeRFC3339)(r.ExecuteActionInitiatedTime)) - populate(objectMap, "executeActionStartTime", (*timeRFC3339)(r.ExecuteActionStartTime)) + populateTimeRFC3339(objectMap, "executeActionInitiatedTime", r.ExecuteActionInitiatedTime) + populateTimeRFC3339(objectMap, "executeActionStartTime", r.ExecuteActionStartTime) populate(objectMap, "implementationDetails", r.ImplementationDetails) populate(objectMap, "isArchivedAction", r.IsArchivedAction) populate(objectMap, "isExecutableAction", r.IsExecutableAction) populate(objectMap, "isRevertableAction", r.IsRevertableAction) - populate(objectMap, "lastRefresh", (*timeRFC3339)(r.LastRefresh)) + populateTimeRFC3339(objectMap, "lastRefresh", r.LastRefresh) populate(objectMap, "linkedObjects", r.LinkedObjects) populate(objectMap, "observedImpact", r.ObservedImpact) populate(objectMap, "recommendationReason", r.RecommendationReason) populate(objectMap, "revertActionDuration", r.RevertActionDuration) populate(objectMap, "revertActionInitiatedBy", r.RevertActionInitiatedBy) - populate(objectMap, "revertActionInitiatedTime", (*timeRFC3339)(r.RevertActionInitiatedTime)) - populate(objectMap, "revertActionStartTime", (*timeRFC3339)(r.RevertActionStartTime)) + populateTimeRFC3339(objectMap, "revertActionInitiatedTime", r.RevertActionInitiatedTime) + populateTimeRFC3339(objectMap, "revertActionStartTime", r.RevertActionStartTime) populate(objectMap, "score", r.Score) populate(objectMap, "state", r.State) populate(objectMap, "timeSeries", r.TimeSeries) - populate(objectMap, "validSince", (*timeRFC3339)(r.ValidSince)) + populateTimeRFC3339(objectMap, "validSince", r.ValidSince) return json.Marshal(objectMap) } @@ -8876,14 +8787,10 @@ func (r *RecommendedActionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.ExecuteActionInitiatedBy) delete(rawMsg, key) case "executeActionInitiatedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.ExecuteActionInitiatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.ExecuteActionInitiatedTime) delete(rawMsg, key) case "executeActionStartTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.ExecuteActionStartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.ExecuteActionStartTime) delete(rawMsg, key) case "implementationDetails": err = unpopulate(val, &r.ImplementationDetails) @@ -8898,9 +8805,7 @@ func (r *RecommendedActionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.IsRevertableAction) delete(rawMsg, key) case "lastRefresh": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.LastRefresh = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.LastRefresh) delete(rawMsg, key) case "linkedObjects": err = unpopulate(val, &r.LinkedObjects) @@ -8918,14 +8823,10 @@ func (r *RecommendedActionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.RevertActionInitiatedBy) delete(rawMsg, key) case "revertActionInitiatedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.RevertActionInitiatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.RevertActionInitiatedTime) delete(rawMsg, key) case "revertActionStartTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.RevertActionStartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.RevertActionStartTime) delete(rawMsg, key) case "score": err = unpopulate(val, &r.Score) @@ -8937,9 +8838,7 @@ func (r *RecommendedActionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.TimeSeries) delete(rawMsg, key) case "validSince": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.ValidSince = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.ValidSince) delete(rawMsg, key) } if err != nil { @@ -8976,7 +8875,7 @@ func (r RecommendedActionStateInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "actionInitiatedBy", r.ActionInitiatedBy) populate(objectMap, "currentValue", r.CurrentValue) - populate(objectMap, "lastModified", (*timeRFC3339)(r.LastModified)) + populateTimeRFC3339(objectMap, "lastModified", r.LastModified) return json.Marshal(objectMap) } @@ -8996,9 +8895,7 @@ func (r *RecommendedActionStateInfo) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.CurrentValue) delete(rawMsg, key) case "lastModified": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.LastModified = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.LastModified) delete(rawMsg, key) } if err != nil { @@ -9103,7 +9000,7 @@ func (r RecoverableDatabaseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "edition", r.Edition) populate(objectMap, "elasticPoolName", r.ElasticPoolName) - populate(objectMap, "lastAvailableBackupDate", (*timeRFC3339)(r.LastAvailableBackupDate)) + populateTimeRFC3339(objectMap, "lastAvailableBackupDate", r.LastAvailableBackupDate) populate(objectMap, "serviceLevelObjective", r.ServiceLevelObjective) return json.Marshal(objectMap) } @@ -9124,9 +9021,7 @@ func (r *RecoverableDatabaseProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.ElasticPoolName) delete(rawMsg, key) case "lastAvailableBackupDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.LastAvailableBackupDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.LastAvailableBackupDate) delete(rawMsg, key) case "serviceLevelObjective": err = unpopulate(val, &r.ServiceLevelObjective) @@ -9278,7 +9173,7 @@ func (r ReplicationLinkProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "replicationMode", r.ReplicationMode) populate(objectMap, "replicationState", r.ReplicationState) populate(objectMap, "role", r.Role) - populate(objectMap, "startTime", (*timeRFC3339)(r.StartTime)) + populateTimeRFC3339(objectMap, "startTime", r.StartTime) return json.Marshal(objectMap) } @@ -9322,9 +9217,7 @@ func (r *ReplicationLinkProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.Role) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.StartTime) delete(rawMsg, key) } if err != nil { @@ -9509,10 +9402,10 @@ type RestorableDroppedDatabaseProperties struct { func (r RestorableDroppedDatabaseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "backupStorageRedundancy", r.BackupStorageRedundancy) - populate(objectMap, "creationDate", (*timeRFC3339)(r.CreationDate)) + populateTimeRFC3339(objectMap, "creationDate", r.CreationDate) populate(objectMap, "databaseName", r.DatabaseName) - populate(objectMap, "deletionDate", (*timeRFC3339)(r.DeletionDate)) - populate(objectMap, "earliestRestoreDate", (*timeRFC3339)(r.EarliestRestoreDate)) + populateTimeRFC3339(objectMap, "deletionDate", r.DeletionDate) + populateTimeRFC3339(objectMap, "earliestRestoreDate", r.EarliestRestoreDate) populate(objectMap, "elasticPoolId", r.ElasticPoolID) populate(objectMap, "maxSizeBytes", r.MaxSizeBytes) return json.Marshal(objectMap) @@ -9531,22 +9424,16 @@ func (r *RestorableDroppedDatabaseProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.BackupStorageRedundancy) delete(rawMsg, key) case "creationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.CreationDate) delete(rawMsg, key) case "databaseName": err = unpopulate(val, &r.DatabaseName) delete(rawMsg, key) case "deletionDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.DeletionDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.DeletionDate) delete(rawMsg, key) case "earliestRestoreDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.EarliestRestoreDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.EarliestRestoreDate) delete(rawMsg, key) case "elasticPoolId": err = unpopulate(val, &r.ElasticPoolID) @@ -9622,10 +9509,10 @@ type RestorableDroppedManagedDatabaseProperties struct { // MarshalJSON implements the json.Marshaller interface for type RestorableDroppedManagedDatabaseProperties. func (r RestorableDroppedManagedDatabaseProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationDate", (*timeRFC3339)(r.CreationDate)) + populateTimeRFC3339(objectMap, "creationDate", r.CreationDate) populate(objectMap, "databaseName", r.DatabaseName) - populate(objectMap, "deletionDate", (*timeRFC3339)(r.DeletionDate)) - populate(objectMap, "earliestRestoreDate", (*timeRFC3339)(r.EarliestRestoreDate)) + populateTimeRFC3339(objectMap, "deletionDate", r.DeletionDate) + populateTimeRFC3339(objectMap, "earliestRestoreDate", r.EarliestRestoreDate) return json.Marshal(objectMap) } @@ -9639,22 +9526,16 @@ func (r *RestorableDroppedManagedDatabaseProperties) UnmarshalJSON(data []byte) var err error switch key { case "creationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.CreationDate) delete(rawMsg, key) case "databaseName": err = unpopulate(val, &r.DatabaseName) delete(rawMsg, key) case "deletionDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.DeletionDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.DeletionDate) delete(rawMsg, key) case "earliestRestoreDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.EarliestRestoreDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.EarliestRestoreDate) delete(rawMsg, key) } if err != nil { @@ -9728,8 +9609,8 @@ type RestorePointProperties struct { // MarshalJSON implements the json.Marshaller interface for type RestorePointProperties. func (r RestorePointProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "earliestRestoreDate", (*timeRFC3339)(r.EarliestRestoreDate)) - populate(objectMap, "restorePointCreationDate", (*timeRFC3339)(r.RestorePointCreationDate)) + populateTimeRFC3339(objectMap, "earliestRestoreDate", r.EarliestRestoreDate) + populateTimeRFC3339(objectMap, "restorePointCreationDate", r.RestorePointCreationDate) populate(objectMap, "restorePointLabel", r.RestorePointLabel) populate(objectMap, "restorePointType", r.RestorePointType) return json.Marshal(objectMap) @@ -9745,14 +9626,10 @@ func (r *RestorePointProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "earliestRestoreDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.EarliestRestoreDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.EarliestRestoreDate) delete(rawMsg, key) case "restorePointCreationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.RestorePointCreationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.RestorePointCreationDate) delete(rawMsg, key) case "restorePointLabel": err = unpopulate(val, &r.RestorePointLabel) @@ -9868,7 +9745,7 @@ type SecurityAlertPolicyProperties struct { // MarshalJSON implements the json.Marshaller interface for type SecurityAlertPolicyProperties. func (s SecurityAlertPolicyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(s.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", s.CreationTime) populate(objectMap, "disabledAlerts", s.DisabledAlerts) populate(objectMap, "emailAccountAdmins", s.EmailAccountAdmins) populate(objectMap, "emailAddresses", s.EmailAddresses) @@ -9889,9 +9766,7 @@ func (s *SecurityAlertPolicyProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreationTime) delete(rawMsg, key) case "disabledAlerts": err = unpopulate(val, &s.DisabledAlerts) @@ -9953,7 +9828,7 @@ type SecurityAlertsPolicyProperties struct { // MarshalJSON implements the json.Marshaller interface for type SecurityAlertsPolicyProperties. func (s SecurityAlertsPolicyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(s.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", s.CreationTime) populate(objectMap, "disabledAlerts", s.DisabledAlerts) populate(objectMap, "emailAccountAdmins", s.EmailAccountAdmins) populate(objectMap, "emailAddresses", s.EmailAddresses) @@ -9974,9 +9849,7 @@ func (s *SecurityAlertsPolicyProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreationTime) delete(rawMsg, key) case "disabledAlerts": err = unpopulate(val, &s.DisabledAlerts) @@ -10075,7 +9948,7 @@ func (s SecurityEventProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "applicationName", s.ApplicationName) populate(objectMap, "clientIp", s.ClientIP) populate(objectMap, "database", s.Database) - populate(objectMap, "eventTime", (*timeRFC3339)(s.EventTime)) + populateTimeRFC3339(objectMap, "eventTime", s.EventTime) populate(objectMap, "principalName", s.PrincipalName) populate(objectMap, "securityEventSqlInjectionAdditionalProperties", s.SecurityEventSQLInjectionAdditionalProperties) populate(objectMap, "securityEventType", s.SecurityEventType) @@ -10103,9 +9976,7 @@ func (s *SecurityEventProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Database) delete(rawMsg, key) case "eventTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.EventTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.EventTime) delete(rawMsg, key) case "principalName": err = unpopulate(val, &s.PrincipalName) @@ -10166,7 +10037,7 @@ type SecurityEventsFilterParameters struct { // MarshalJSON implements the json.Marshaller interface for type SecurityEventsFilterParameters. func (s SecurityEventsFilterParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "eventTime", (*timeRFC3339)(s.EventTime)) + populateTimeRFC3339(objectMap, "eventTime", s.EventTime) populate(objectMap, "showServerRecords", s.ShowServerRecords) return json.Marshal(objectMap) } @@ -10181,9 +10052,7 @@ func (s *SecurityEventsFilterParameters) UnmarshalJSON(data []byte) error { var err error switch key { case "eventTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.EventTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.EventTime) delete(rawMsg, key) case "showServerRecords": err = unpopulate(val, &s.ShowServerRecords) @@ -10989,7 +10858,7 @@ type ServerKeyProperties struct { func (s ServerKeyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "autoRotationEnabled", s.AutoRotationEnabled) - populate(objectMap, "creationDate", (*timeRFC3339)(s.CreationDate)) + populateTimeRFC3339(objectMap, "creationDate", s.CreationDate) populate(objectMap, "serverKeyType", s.ServerKeyType) populate(objectMap, "subregion", s.Subregion) populate(objectMap, "thumbprint", s.Thumbprint) @@ -11010,9 +10879,7 @@ func (s *ServerKeyProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.AutoRotationEnabled) delete(rawMsg, key) case "creationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreationDate) delete(rawMsg, key) case "serverKeyType": err = unpopulate(val, &s.ServerKeyType) @@ -11152,14 +11019,14 @@ func (s ServerOperationProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "errorCode", s.ErrorCode) populate(objectMap, "errorDescription", s.ErrorDescription) populate(objectMap, "errorSeverity", s.ErrorSeverity) - populate(objectMap, "estimatedCompletionTime", (*timeRFC3339)(s.EstimatedCompletionTime)) + populateTimeRFC3339(objectMap, "estimatedCompletionTime", s.EstimatedCompletionTime) populate(objectMap, "isCancellable", s.IsCancellable) populate(objectMap, "isUserError", s.IsUserError) populate(objectMap, "operation", s.Operation) populate(objectMap, "operationFriendlyName", s.OperationFriendlyName) populate(objectMap, "percentComplete", s.PercentComplete) populate(objectMap, "serverName", s.ServerName) - populate(objectMap, "startTime", (*timeRFC3339)(s.StartTime)) + populateTimeRFC3339(objectMap, "startTime", s.StartTime) populate(objectMap, "state", s.State) return json.Marshal(objectMap) } @@ -11186,9 +11053,7 @@ func (s *ServerOperationProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.ErrorSeverity) delete(rawMsg, key) case "estimatedCompletionTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.EstimatedCompletionTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.EstimatedCompletionTime) delete(rawMsg, key) case "isCancellable": err = unpopulate(val, &s.IsCancellable) @@ -11209,9 +11074,7 @@ func (s *ServerOperationProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.ServerName) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.StartTime) delete(rawMsg, key) case "state": err = unpopulate(val, &s.State) @@ -11463,7 +11326,7 @@ func (s ServerUsage) MarshalJSON() ([]byte, error) { populate(objectMap, "displayName", s.DisplayName) populate(objectMap, "limit", s.Limit) populate(objectMap, "name", s.Name) - populate(objectMap, "nextResetTime", (*timeRFC3339)(s.NextResetTime)) + populateTimeRFC3339(objectMap, "nextResetTime", s.NextResetTime) populate(objectMap, "resourceName", s.ResourceName) populate(objectMap, "unit", s.Unit) return json.Marshal(objectMap) @@ -11491,9 +11354,7 @@ func (s *ServerUsage) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Name) delete(rawMsg, key) case "nextResetTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.NextResetTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.NextResetTime) delete(rawMsg, key) case "resourceName": err = unpopulate(val, &s.ResourceName) @@ -11990,9 +11851,9 @@ type SyncAgentProperties struct { // MarshalJSON implements the json.Marshaller interface for type SyncAgentProperties. func (s SyncAgentProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "expiryTime", (*timeRFC3339)(s.ExpiryTime)) + populateTimeRFC3339(objectMap, "expiryTime", s.ExpiryTime) populate(objectMap, "isUpToDate", s.IsUpToDate) - populate(objectMap, "lastAliveTime", (*timeRFC3339)(s.LastAliveTime)) + populateTimeRFC3339(objectMap, "lastAliveTime", s.LastAliveTime) populate(objectMap, "name", s.Name) populate(objectMap, "state", s.State) populate(objectMap, "syncDatabaseId", s.SyncDatabaseID) @@ -12010,17 +11871,13 @@ func (s *SyncAgentProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "expiryTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.ExpiryTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.ExpiryTime) delete(rawMsg, key) case "isUpToDate": err = unpopulate(val, &s.IsUpToDate) delete(rawMsg, key) case "lastAliveTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastAliveTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastAliveTime) delete(rawMsg, key) case "name": err = unpopulate(val, &s.Name) @@ -12107,7 +11964,7 @@ type SyncFullSchemaProperties struct { // MarshalJSON implements the json.Marshaller interface for type SyncFullSchemaProperties. func (s SyncFullSchemaProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "lastUpdateTime", (*timeRFC3339)(s.LastUpdateTime)) + populateTimeRFC3339(objectMap, "lastUpdateTime", s.LastUpdateTime) populate(objectMap, "tables", s.Tables) return json.Marshal(objectMap) } @@ -12122,9 +11979,7 @@ func (s *SyncFullSchemaProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "lastUpdateTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastUpdateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastUpdateTime) delete(rawMsg, key) case "tables": err = unpopulate(val, &s.Tables) @@ -12287,7 +12142,7 @@ func (s SyncGroupLogProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "details", s.Details) populate(objectMap, "operationStatus", s.OperationStatus) populate(objectMap, "source", s.Source) - populate(objectMap, "timestamp", (*timeRFC3339)(s.Timestamp)) + populateTimeRFC3339(objectMap, "timestamp", s.Timestamp) populate(objectMap, "tracingId", s.TracingID) populate(objectMap, "type", s.Type) return json.Marshal(objectMap) @@ -12312,9 +12167,7 @@ func (s *SyncGroupLogProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Source) delete(rawMsg, key) case "timestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.Timestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.Timestamp) delete(rawMsg, key) case "tracingId": err = unpopulate(val, &s.TracingID) @@ -12378,7 +12231,7 @@ func (s SyncGroupProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "hubDatabasePassword", s.HubDatabasePassword) populate(objectMap, "hubDatabaseUserName", s.HubDatabaseUserName) populate(objectMap, "interval", s.Interval) - populate(objectMap, "lastSyncTime", (*timeRFC3339)(s.LastSyncTime)) + populateTimeRFC3339(objectMap, "lastSyncTime", s.LastSyncTime) populate(objectMap, "privateEndpointName", s.PrivateEndpointName) populate(objectMap, "schema", s.Schema) populate(objectMap, "syncDatabaseId", s.SyncDatabaseID) @@ -12415,9 +12268,7 @@ func (s *SyncGroupProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.Interval) delete(rawMsg, key) case "lastSyncTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastSyncTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastSyncTime) delete(rawMsg, key) case "privateEndpointName": err = unpopulate(val, &s.PrivateEndpointName) @@ -12674,10 +12525,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -12693,9 +12544,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -12704,9 +12553,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) @@ -13261,11 +13108,11 @@ type VulnerabilityAssessmentScanRecordProperties struct { // MarshalJSON implements the json.Marshaller interface for type VulnerabilityAssessmentScanRecordProperties. func (v VulnerabilityAssessmentScanRecordProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "endTime", (*timeRFC3339)(v.EndTime)) + populateTimeRFC3339(objectMap, "endTime", v.EndTime) populate(objectMap, "errors", v.Errors) populate(objectMap, "numberOfFailedSecurityChecks", v.NumberOfFailedSecurityChecks) populate(objectMap, "scanId", v.ScanID) - populate(objectMap, "startTime", (*timeRFC3339)(v.StartTime)) + populateTimeRFC3339(objectMap, "startTime", v.StartTime) populate(objectMap, "state", v.State) populate(objectMap, "storageContainerPath", v.StorageContainerPath) populate(objectMap, "triggerType", v.TriggerType) @@ -13282,9 +13129,7 @@ func (v *VulnerabilityAssessmentScanRecordProperties) UnmarshalJSON(data []byte) var err error switch key { case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - v.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &v.EndTime) delete(rawMsg, key) case "errors": err = unpopulate(val, &v.Errors) @@ -13296,9 +13141,7 @@ func (v *VulnerabilityAssessmentScanRecordProperties) UnmarshalJSON(data []byte) err = unpopulate(val, &v.ScanID) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - v.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &v.StartTime) delete(rawMsg, key) case "state": err = unpopulate(val, &v.State) diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_operations_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_operations_client.go index af20ca97f8da..42d92afd99f4 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_operations_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armsql import ( "context" "errors" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available SQL Rest API operations. @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_operationshealth_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_operationshealth_client.go index 3f98f2a131c8..c3e0a4124f97 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_operationshealth_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_operationshealth_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // OperationsHealthClient contains the methods for the OperationsHealth group. @@ -29,8 +30,15 @@ type OperationsHealthClient struct { } // NewOperationsHealthClient creates a new instance of OperationsHealthClient with the specified values. -func NewOperationsHealthClient(con *arm.Connection, subscriptionID string) *OperationsHealthClient { - return &OperationsHealthClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewOperationsHealthClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsHealthClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsHealthClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByLocation - Gets a service operation health status. @@ -73,7 +81,7 @@ func (client *OperationsHealthClient) listByLocationCreateRequest(ctx context.Co func (client *OperationsHealthClient) listByLocationHandleResponse(resp *http.Response) (OperationsHealthListByLocationResponse, error) { result := OperationsHealthListByLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationsHealthListResult); err != nil { - return OperationsHealthListByLocationResponse{}, err + return OperationsHealthListByLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_outboundfirewallrules_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_outboundfirewallrules_client.go index 854009f4ecf9..bccd1365f6d0 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_outboundfirewallrules_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_outboundfirewallrules_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // OutboundFirewallRulesClient contains the methods for the OutboundFirewallRules group. @@ -30,8 +30,15 @@ type OutboundFirewallRulesClient struct { } // NewOutboundFirewallRulesClient creates a new instance of OutboundFirewallRulesClient with the specified values. -func NewOutboundFirewallRulesClient(con *arm.Connection, subscriptionID string) *OutboundFirewallRulesClient { - return &OutboundFirewallRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewOutboundFirewallRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OutboundFirewallRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OutboundFirewallRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Create a outbound firewall rule with a given name. @@ -242,7 +249,7 @@ func (client *OutboundFirewallRulesClient) getCreateRequest(ctx context.Context, func (client *OutboundFirewallRulesClient) getHandleResponse(resp *http.Response) (OutboundFirewallRulesGetResponse, error) { result := OutboundFirewallRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OutboundFirewallRule); err != nil { - return OutboundFirewallRulesGetResponse{}, err + return OutboundFirewallRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -303,7 +310,7 @@ func (client *OutboundFirewallRulesClient) listByServerCreateRequest(ctx context func (client *OutboundFirewallRulesClient) listByServerHandleResponse(resp *http.Response) (OutboundFirewallRulesListByServerResponse, error) { result := OutboundFirewallRulesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OutboundFirewallRuleListResult); err != nil { - return OutboundFirewallRulesListByServerResponse{}, err + return OutboundFirewallRulesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_pagers.go b/sdk/resourcemanager/sql/armsql/zz_generated_pagers.go index 1a60093f550a..be508bed7345 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_pagers.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armsql import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // BackupShortTermRetentionPoliciesListByDatabasePager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_pollers.go b/sdk/resourcemanager/sql/armsql/zz_generated_pollers.go index da31556a72f9..9f28e991e4d2 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_pollers.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armsql import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // BackupShortTermRetentionPoliciesCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_privateendpointconnections_client.go index b63ce0735570..ac6c784965ef 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_privateendpointconnections_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. @@ -30,8 +30,15 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { - return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Approve or reject a private endpoint connection with a given name. @@ -242,7 +249,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsGetResponse{}, err + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -303,7 +310,7 @@ func (client *PrivateEndpointConnectionsClient) listByServerCreateRequest(ctx co func (client *PrivateEndpointConnectionsClient) listByServerHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListByServerResponse, error) { result := PrivateEndpointConnectionsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionsListByServerResponse{}, err + return PrivateEndpointConnectionsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_privatelinkresources_client.go index efa38ace7019..57df9c2dd553 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_privatelinkresources_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. @@ -29,8 +30,15 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { - return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a private link resource for SQL server. @@ -84,7 +92,7 @@ func (client *PrivateLinkResourcesClient) getCreateRequest(ctx context.Context, func (client *PrivateLinkResourcesClient) getHandleResponse(resp *http.Response) (PrivateLinkResourcesGetResponse, error) { result := PrivateLinkResourcesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResource); err != nil { - return PrivateLinkResourcesGetResponse{}, err + return PrivateLinkResourcesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -145,7 +153,7 @@ func (client *PrivateLinkResourcesClient) listByServerCreateRequest(ctx context. func (client *PrivateLinkResourcesClient) listByServerHandleResponse(resp *http.Response) (PrivateLinkResourcesListByServerResponse, error) { result := PrivateLinkResourcesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { - return PrivateLinkResourcesListByServerResponse{}, err + return PrivateLinkResourcesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_recommendedsensitivitylabels_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_recommendedsensitivitylabels_client.go index 28127a79f258..f9f3997e6e25 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_recommendedsensitivitylabels_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_recommendedsensitivitylabels_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RecommendedSensitivityLabelsClient contains the methods for the RecommendedSensitivityLabels group. @@ -29,8 +30,15 @@ type RecommendedSensitivityLabelsClient struct { } // NewRecommendedSensitivityLabelsClient creates a new instance of RecommendedSensitivityLabelsClient with the specified values. -func NewRecommendedSensitivityLabelsClient(con *arm.Connection, subscriptionID string) *RecommendedSensitivityLabelsClient { - return &RecommendedSensitivityLabelsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRecommendedSensitivityLabelsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RecommendedSensitivityLabelsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RecommendedSensitivityLabelsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Update - Update recommended sensitivity labels states of a given database using an operations batch. diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_recoverabledatabases_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_recoverabledatabases_client.go index d41215e8287b..1abf7118953f 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_recoverabledatabases_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_recoverabledatabases_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RecoverableDatabasesClient contains the methods for the RecoverableDatabases group. @@ -29,8 +30,15 @@ type RecoverableDatabasesClient struct { } // NewRecoverableDatabasesClient creates a new instance of RecoverableDatabasesClient with the specified values. -func NewRecoverableDatabasesClient(con *arm.Connection, subscriptionID string) *RecoverableDatabasesClient { - return &RecoverableDatabasesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRecoverableDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RecoverableDatabasesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RecoverableDatabasesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a recoverable database, which is a resource representing a database's geo backup @@ -84,7 +92,7 @@ func (client *RecoverableDatabasesClient) getCreateRequest(ctx context.Context, func (client *RecoverableDatabasesClient) getHandleResponse(resp *http.Response) (RecoverableDatabasesGetResponse, error) { result := RecoverableDatabasesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecoverableDatabase); err != nil { - return RecoverableDatabasesGetResponse{}, err + return RecoverableDatabasesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -148,7 +156,7 @@ func (client *RecoverableDatabasesClient) listByServerCreateRequest(ctx context. func (client *RecoverableDatabasesClient) listByServerHandleResponse(resp *http.Response) (RecoverableDatabasesListByServerResponse, error) { result := RecoverableDatabasesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecoverableDatabaseListResult); err != nil { - return RecoverableDatabasesListByServerResponse{}, err + return RecoverableDatabasesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_recoverablemanageddatabases_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_recoverablemanageddatabases_client.go index 3e0e71e07196..8a9d401e4dbf 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_recoverablemanageddatabases_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_recoverablemanageddatabases_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RecoverableManagedDatabasesClient contains the methods for the RecoverableManagedDatabases group. @@ -29,8 +30,15 @@ type RecoverableManagedDatabasesClient struct { } // NewRecoverableManagedDatabasesClient creates a new instance of RecoverableManagedDatabasesClient with the specified values. -func NewRecoverableManagedDatabasesClient(con *arm.Connection, subscriptionID string) *RecoverableManagedDatabasesClient { - return &RecoverableManagedDatabasesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRecoverableManagedDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RecoverableManagedDatabasesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RecoverableManagedDatabasesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a recoverable managed database. @@ -84,7 +92,7 @@ func (client *RecoverableManagedDatabasesClient) getCreateRequest(ctx context.Co func (client *RecoverableManagedDatabasesClient) getHandleResponse(resp *http.Response) (RecoverableManagedDatabasesGetResponse, error) { result := RecoverableManagedDatabasesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecoverableManagedDatabase); err != nil { - return RecoverableManagedDatabasesGetResponse{}, err + return RecoverableManagedDatabasesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -145,7 +153,7 @@ func (client *RecoverableManagedDatabasesClient) listByInstanceCreateRequest(ctx func (client *RecoverableManagedDatabasesClient) listByInstanceHandleResponse(resp *http.Response) (RecoverableManagedDatabasesListByInstanceResponse, error) { result := RecoverableManagedDatabasesListByInstanceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecoverableManagedDatabaseListResult); err != nil { - return RecoverableManagedDatabasesListByInstanceResponse{}, err + return RecoverableManagedDatabasesListByInstanceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_replicationlinks_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_replicationlinks_client.go index 2151f3dfe8c8..ff4cec51f9b8 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_replicationlinks_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_replicationlinks_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ReplicationLinksClient contains the methods for the ReplicationLinks group. @@ -30,8 +30,15 @@ type ReplicationLinksClient struct { } // NewReplicationLinksClient creates a new instance of ReplicationLinksClient with the specified values. -func NewReplicationLinksClient(con *arm.Connection, subscriptionID string) *ReplicationLinksClient { - return &ReplicationLinksClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewReplicationLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ReplicationLinksClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ReplicationLinksClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Delete - Deletes a database replication link. Cannot be done during failover. @@ -317,7 +324,7 @@ func (client *ReplicationLinksClient) getCreateRequest(ctx context.Context, reso func (client *ReplicationLinksClient) getHandleResponse(resp *http.Response) (ReplicationLinksGetResponse, error) { result := ReplicationLinksGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReplicationLink); err != nil { - return ReplicationLinksGetResponse{}, err + return ReplicationLinksGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -382,7 +389,7 @@ func (client *ReplicationLinksClient) listByDatabaseCreateRequest(ctx context.Co func (client *ReplicationLinksClient) listByDatabaseHandleResponse(resp *http.Response) (ReplicationLinksListByDatabaseResponse, error) { result := ReplicationLinksListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReplicationLinkListResult); err != nil { - return ReplicationLinksListByDatabaseResponse{}, err + return ReplicationLinksListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -443,7 +450,7 @@ func (client *ReplicationLinksClient) listByServerCreateRequest(ctx context.Cont func (client *ReplicationLinksClient) listByServerHandleResponse(resp *http.Response) (ReplicationLinksListByServerResponse, error) { result := ReplicationLinksListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ReplicationLinkListResult); err != nil { - return ReplicationLinksListByServerResponse{}, err + return ReplicationLinksListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_response_types.go b/sdk/resourcemanager/sql/armsql/zz_generated_response_types.go index c6aa4dc15d4b..e0c8e52c5dd2 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_response_types.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armsql import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // BackupShortTermRetentionPoliciesCreateOrUpdatePollerResponse contains the response from method BackupShortTermRetentionPolicies.CreateOrUpdate. @@ -26,6 +25,8 @@ type BackupShortTermRetentionPoliciesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l BackupShortTermRetentionPoliciesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BackupShortTermRetentionPoliciesCreateOrUpdateResponse, error) { respType := BackupShortTermRetentionPoliciesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.BackupShortTermRetentionPolicy) @@ -100,6 +101,8 @@ type BackupShortTermRetentionPoliciesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l BackupShortTermRetentionPoliciesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BackupShortTermRetentionPoliciesUpdateResponse, error) { respType := BackupShortTermRetentionPoliciesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.BackupShortTermRetentionPolicy) @@ -367,6 +370,8 @@ type DatabaseExtensionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabaseExtensionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabaseExtensionsCreateOrUpdateResponse, error) { respType := DatabaseExtensionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ImportExportExtensionsOperationResult) @@ -640,6 +645,8 @@ type DatabaseVulnerabilityAssessmentScansInitiateScanPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabaseVulnerabilityAssessmentScansInitiateScanPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabaseVulnerabilityAssessmentScansInitiateScanResponse, error) { respType := DatabaseVulnerabilityAssessmentScansInitiateScanResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -738,6 +745,8 @@ type DatabasesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabasesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesCreateOrUpdateResponse, error) { respType := DatabasesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Database) @@ -788,6 +797,8 @@ type DatabasesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabasesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesDeleteResponse, error) { respType := DatabasesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -832,6 +843,8 @@ type DatabasesExportPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabasesExportPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesExportResponse, error) { respType := DatabasesExportResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ImportExportOperationResult) @@ -882,6 +895,8 @@ type DatabasesFailoverPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabasesFailoverPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesFailoverResponse, error) { respType := DatabasesFailoverResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -938,6 +953,8 @@ type DatabasesImportPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabasesImportPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesImportResponse, error) { respType := DatabasesImportResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ImportExportOperationResult) @@ -1048,6 +1065,8 @@ type DatabasesPausePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabasesPausePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesPauseResponse, error) { respType := DatabasesPauseResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Database) @@ -1104,6 +1123,8 @@ type DatabasesResumePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabasesResumePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesResumeResponse, error) { respType := DatabasesResumeResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Database) @@ -1154,6 +1175,8 @@ type DatabasesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabasesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesUpdateResponse, error) { respType := DatabasesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Database) @@ -1204,6 +1227,8 @@ type DatabasesUpgradeDataWarehousePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DatabasesUpgradeDataWarehousePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DatabasesUpgradeDataWarehouseResponse, error) { respType := DatabasesUpgradeDataWarehouseResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1284,6 +1309,8 @@ type DeletedServersRecoverPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DeletedServersRecoverPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DeletedServersRecoverResponse, error) { respType := DeletedServersRecoverResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.DeletedServer) @@ -1376,6 +1403,8 @@ type ElasticPoolsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ElasticPoolsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ElasticPoolsCreateOrUpdateResponse, error) { respType := ElasticPoolsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ElasticPool) @@ -1426,6 +1455,8 @@ type ElasticPoolsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ElasticPoolsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ElasticPoolsDeleteResponse, error) { respType := ElasticPoolsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1470,6 +1501,8 @@ type ElasticPoolsFailoverPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ElasticPoolsFailoverPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ElasticPoolsFailoverResponse, error) { respType := ElasticPoolsFailoverResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1562,6 +1595,8 @@ type ElasticPoolsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ElasticPoolsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ElasticPoolsUpdateResponse, error) { respType := ElasticPoolsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ElasticPool) @@ -1612,6 +1647,8 @@ type EncryptionProtectorsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l EncryptionProtectorsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (EncryptionProtectorsCreateOrUpdateResponse, error) { respType := EncryptionProtectorsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.EncryptionProtector) @@ -1686,6 +1723,8 @@ type EncryptionProtectorsRevalidatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l EncryptionProtectorsRevalidatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (EncryptionProtectorsRevalidateResponse, error) { respType := EncryptionProtectorsRevalidateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1766,6 +1805,8 @@ type ExtendedServerBlobAuditingPoliciesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ExtendedServerBlobAuditingPoliciesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ExtendedServerBlobAuditingPoliciesCreateOrUpdateResponse, error) { respType := ExtendedServerBlobAuditingPoliciesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ExtendedServerBlobAuditingPolicy) @@ -1840,6 +1881,8 @@ type FailoverGroupsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FailoverGroupsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FailoverGroupsCreateOrUpdateResponse, error) { respType := FailoverGroupsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.FailoverGroup) @@ -1890,6 +1933,8 @@ type FailoverGroupsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FailoverGroupsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FailoverGroupsDeleteResponse, error) { respType := FailoverGroupsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1934,6 +1979,8 @@ type FailoverGroupsFailoverPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FailoverGroupsFailoverPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FailoverGroupsFailoverResponse, error) { respType := FailoverGroupsFailoverResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.FailoverGroup) @@ -1984,6 +2031,8 @@ type FailoverGroupsForceFailoverAllowDataLossPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FailoverGroupsForceFailoverAllowDataLossPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FailoverGroupsForceFailoverAllowDataLossResponse, error) { respType := FailoverGroupsForceFailoverAllowDataLossResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.FailoverGroup) @@ -2058,6 +2107,8 @@ type FailoverGroupsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FailoverGroupsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FailoverGroupsUpdateResponse, error) { respType := FailoverGroupsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.FailoverGroup) @@ -2198,6 +2249,8 @@ type InstanceFailoverGroupsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l InstanceFailoverGroupsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (InstanceFailoverGroupsCreateOrUpdateResponse, error) { respType := InstanceFailoverGroupsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.InstanceFailoverGroup) @@ -2248,6 +2301,8 @@ type InstanceFailoverGroupsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l InstanceFailoverGroupsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (InstanceFailoverGroupsDeleteResponse, error) { respType := InstanceFailoverGroupsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2292,6 +2347,8 @@ type InstanceFailoverGroupsFailoverPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l InstanceFailoverGroupsFailoverPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (InstanceFailoverGroupsFailoverResponse, error) { respType := InstanceFailoverGroupsFailoverResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.InstanceFailoverGroup) @@ -2342,6 +2399,8 @@ type InstanceFailoverGroupsForceFailoverAllowDataLossPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l InstanceFailoverGroupsForceFailoverAllowDataLossPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (InstanceFailoverGroupsForceFailoverAllowDataLossResponse, error) { respType := InstanceFailoverGroupsForceFailoverAllowDataLossResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.InstanceFailoverGroup) @@ -2416,6 +2475,8 @@ type InstancePoolsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l InstancePoolsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (InstancePoolsCreateOrUpdateResponse, error) { respType := InstancePoolsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.InstancePool) @@ -2466,6 +2527,8 @@ type InstancePoolsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l InstancePoolsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (InstancePoolsDeleteResponse, error) { respType := InstancePoolsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2546,6 +2609,8 @@ type InstancePoolsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l InstancePoolsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (InstancePoolsUpdateResponse, error) { respType := InstancePoolsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.InstancePool) @@ -2596,6 +2661,8 @@ type JobAgentsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l JobAgentsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (JobAgentsCreateOrUpdateResponse, error) { respType := JobAgentsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.JobAgent) @@ -2646,6 +2713,8 @@ type JobAgentsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l JobAgentsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (JobAgentsDeleteResponse, error) { respType := JobAgentsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2714,6 +2783,8 @@ type JobAgentsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l JobAgentsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (JobAgentsUpdateResponse, error) { respType := JobAgentsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.JobAgent) @@ -2812,6 +2883,8 @@ type JobExecutionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l JobExecutionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (JobExecutionsCreateOrUpdateResponse, error) { respType := JobExecutionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.JobExecution) @@ -2862,6 +2935,8 @@ type JobExecutionsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l JobExecutionsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (JobExecutionsCreateResponse, error) { respType := JobExecutionsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.JobExecution) @@ -3182,6 +3257,8 @@ type LedgerDigestUploadsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LedgerDigestUploadsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LedgerDigestUploadsCreateOrUpdateResponse, error) { respType := LedgerDigestUploadsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LedgerDigestUploads) @@ -3232,6 +3309,8 @@ type LedgerDigestUploadsDisablePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LedgerDigestUploadsDisablePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LedgerDigestUploadsDisableResponse, error) { respType := LedgerDigestUploadsDisableResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LedgerDigestUploads) @@ -3306,6 +3385,8 @@ type LongTermRetentionBackupsCopyByResourceGroupPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LongTermRetentionBackupsCopyByResourceGroupPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LongTermRetentionBackupsCopyByResourceGroupResponse, error) { respType := LongTermRetentionBackupsCopyByResourceGroupResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LongTermRetentionBackupOperationResult) @@ -3356,6 +3437,8 @@ type LongTermRetentionBackupsCopyPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LongTermRetentionBackupsCopyPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LongTermRetentionBackupsCopyResponse, error) { respType := LongTermRetentionBackupsCopyResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LongTermRetentionBackupOperationResult) @@ -3406,6 +3489,8 @@ type LongTermRetentionBackupsDeleteByResourceGroupPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LongTermRetentionBackupsDeleteByResourceGroupPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LongTermRetentionBackupsDeleteByResourceGroupResponse, error) { respType := LongTermRetentionBackupsDeleteByResourceGroupResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3450,6 +3535,8 @@ type LongTermRetentionBackupsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LongTermRetentionBackupsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LongTermRetentionBackupsDeleteResponse, error) { respType := LongTermRetentionBackupsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3590,6 +3677,8 @@ type LongTermRetentionBackupsUpdateByResourceGroupPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LongTermRetentionBackupsUpdateByResourceGroupPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LongTermRetentionBackupsUpdateByResourceGroupResponse, error) { respType := LongTermRetentionBackupsUpdateByResourceGroupResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LongTermRetentionBackupOperationResult) @@ -3640,6 +3729,8 @@ type LongTermRetentionBackupsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LongTermRetentionBackupsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LongTermRetentionBackupsUpdateResponse, error) { respType := LongTermRetentionBackupsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LongTermRetentionBackupOperationResult) @@ -3690,6 +3781,8 @@ type LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupPollerResponse } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupResponse, error) { respType := LongTermRetentionManagedInstanceBackupsDeleteByResourceGroupResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3734,6 +3827,8 @@ type LongTermRetentionManagedInstanceBackupsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LongTermRetentionManagedInstanceBackupsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LongTermRetentionManagedInstanceBackupsDeleteResponse, error) { respType := LongTermRetentionManagedInstanceBackupsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3874,6 +3969,8 @@ type LongTermRetentionPoliciesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l LongTermRetentionPoliciesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (LongTermRetentionPoliciesCreateOrUpdateResponse, error) { respType := LongTermRetentionPoliciesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.LongTermRetentionPolicy) @@ -3978,6 +4075,8 @@ type ManagedBackupShortTermRetentionPoliciesCreateOrUpdatePollerResponse struct } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedBackupShortTermRetentionPoliciesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedBackupShortTermRetentionPoliciesCreateOrUpdateResponse, error) { respType := ManagedBackupShortTermRetentionPoliciesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedBackupShortTermRetentionPolicy) @@ -4052,6 +4151,8 @@ type ManagedBackupShortTermRetentionPoliciesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedBackupShortTermRetentionPoliciesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedBackupShortTermRetentionPoliciesUpdateResponse, error) { respType := ManagedBackupShortTermRetentionPoliciesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedBackupShortTermRetentionPolicy) @@ -4438,6 +4539,8 @@ type ManagedDatabaseVulnerabilityAssessmentScansInitiateScanPollerResponse struc } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedDatabaseVulnerabilityAssessmentScansInitiateScanPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedDatabaseVulnerabilityAssessmentScansInitiateScanResponse, error) { respType := ManagedDatabaseVulnerabilityAssessmentScansInitiateScanResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4536,6 +4639,8 @@ type ManagedDatabasesCompleteRestorePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedDatabasesCompleteRestorePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedDatabasesCompleteRestoreResponse, error) { respType := ManagedDatabasesCompleteRestoreResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4580,6 +4685,8 @@ type ManagedDatabasesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedDatabasesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedDatabasesCreateOrUpdateResponse, error) { respType := ManagedDatabasesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedDatabase) @@ -4630,6 +4737,8 @@ type ManagedDatabasesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedDatabasesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedDatabasesDeleteResponse, error) { respType := ManagedDatabasesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4710,6 +4819,8 @@ type ManagedDatabasesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedDatabasesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedDatabasesUpdateResponse, error) { respType := ManagedDatabasesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedDatabase) @@ -4760,6 +4871,8 @@ type ManagedInstanceAdministratorsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedInstanceAdministratorsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedInstanceAdministratorsCreateOrUpdateResponse, error) { respType := ManagedInstanceAdministratorsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedInstanceAdministrator) @@ -4810,6 +4923,8 @@ type ManagedInstanceAdministratorsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedInstanceAdministratorsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedInstanceAdministratorsDeleteResponse, error) { respType := ManagedInstanceAdministratorsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4878,6 +4993,8 @@ type ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdatePollerResponse struc } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateResponse, error) { respType := ManagedInstanceAzureADOnlyAuthenticationsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedInstanceAzureADOnlyAuthentication) @@ -4928,6 +5045,8 @@ type ManagedInstanceAzureADOnlyAuthenticationsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedInstanceAzureADOnlyAuthenticationsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedInstanceAzureADOnlyAuthenticationsDeleteResponse, error) { respType := ManagedInstanceAzureADOnlyAuthenticationsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -4996,6 +5115,8 @@ type ManagedInstanceEncryptionProtectorsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedInstanceEncryptionProtectorsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedInstanceEncryptionProtectorsCreateOrUpdateResponse, error) { respType := ManagedInstanceEncryptionProtectorsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedInstanceEncryptionProtector) @@ -5070,6 +5191,8 @@ type ManagedInstanceEncryptionProtectorsRevalidatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedInstanceEncryptionProtectorsRevalidatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedInstanceEncryptionProtectorsRevalidateResponse, error) { respType := ManagedInstanceEncryptionProtectorsRevalidateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5114,6 +5237,8 @@ type ManagedInstanceKeysCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedInstanceKeysCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedInstanceKeysCreateOrUpdateResponse, error) { respType := ManagedInstanceKeysCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedInstanceKey) @@ -5164,6 +5289,8 @@ type ManagedInstanceKeysDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedInstanceKeysDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedInstanceKeysDeleteResponse, error) { respType := ManagedInstanceKeysDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5232,6 +5359,8 @@ type ManagedInstanceLongTermRetentionPoliciesCreateOrUpdatePollerResponse struct } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedInstanceLongTermRetentionPoliciesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateResponse, error) { respType := ManagedInstanceLongTermRetentionPoliciesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedInstanceLongTermRetentionPolicy) @@ -5336,6 +5465,8 @@ type ManagedInstancePrivateEndpointConnectionsCreateOrUpdatePollerResponse struc } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedInstancePrivateEndpointConnectionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedInstancePrivateEndpointConnectionsCreateOrUpdateResponse, error) { respType := ManagedInstancePrivateEndpointConnectionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedInstancePrivateEndpointConnection) @@ -5386,6 +5517,8 @@ type ManagedInstancePrivateEndpointConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedInstancePrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedInstancePrivateEndpointConnectionsDeleteResponse, error) { respType := ManagedInstancePrivateEndpointConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5478,6 +5611,8 @@ type ManagedInstanceTdeCertificatesCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedInstanceTdeCertificatesCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedInstanceTdeCertificatesCreateResponse, error) { respType := ManagedInstanceTdeCertificatesCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5564,6 +5699,8 @@ type ManagedInstancesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedInstancesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedInstancesCreateOrUpdateResponse, error) { respType := ManagedInstancesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedInstance) @@ -5614,6 +5751,8 @@ type ManagedInstancesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedInstancesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedInstancesDeleteResponse, error) { respType := ManagedInstancesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5658,6 +5797,8 @@ type ManagedInstancesFailoverPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedInstancesFailoverPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedInstancesFailoverResponse, error) { respType := ManagedInstancesFailoverResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -5762,6 +5903,8 @@ type ManagedInstancesUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedInstancesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedInstancesUpdateResponse, error) { respType := ManagedInstancesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedInstance) @@ -5812,6 +5955,8 @@ type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpd } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateResponse, error) { respType := ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedBackupShortTermRetentionPolicy) @@ -5887,6 +6032,8 @@ type ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdatePolle } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateResponse, error) { respType := ManagedRestorableDroppedDatabaseBackupShortTermRetentionPoliciesUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedBackupShortTermRetentionPolicy) @@ -5937,6 +6084,8 @@ type ManagedServerSecurityAlertPoliciesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ManagedServerSecurityAlertPoliciesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ManagedServerSecurityAlertPoliciesCreateOrUpdateResponse, error) { respType := ManagedServerSecurityAlertPoliciesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ManagedServerSecurityAlertPolicy) @@ -6035,6 +6184,8 @@ type OutboundFirewallRulesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l OutboundFirewallRulesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (OutboundFirewallRulesCreateOrUpdateResponse, error) { respType := OutboundFirewallRulesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.OutboundFirewallRule) @@ -6085,6 +6236,8 @@ type OutboundFirewallRulesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l OutboundFirewallRulesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (OutboundFirewallRulesDeleteResponse, error) { respType := OutboundFirewallRulesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6153,6 +6306,8 @@ type PrivateEndpointConnectionsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsCreateOrUpdateResponse, error) { respType := PrivateEndpointConnectionsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.PrivateEndpointConnection) @@ -6203,6 +6358,8 @@ type PrivateEndpointConnectionsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointConnectionsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointConnectionsDeleteResponse, error) { respType := PrivateEndpointConnectionsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6355,6 +6512,8 @@ type ReplicationLinksFailoverAllowDataLossPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ReplicationLinksFailoverAllowDataLossPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ReplicationLinksFailoverAllowDataLossResponse, error) { respType := ReplicationLinksFailoverAllowDataLossResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6399,6 +6558,8 @@ type ReplicationLinksFailoverPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ReplicationLinksFailoverPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ReplicationLinksFailoverResponse, error) { respType := ReplicationLinksFailoverResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6479,6 +6640,8 @@ type ReplicationLinksUnlinkPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ReplicationLinksUnlinkPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ReplicationLinksUnlinkResponse, error) { respType := ReplicationLinksUnlinkResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6571,6 +6734,8 @@ type RestorePointsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l RestorePointsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (RestorePointsCreateResponse, error) { respType := RestorePointsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RestorePoint) @@ -6808,6 +6973,8 @@ type ServerAzureADAdministratorsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerAzureADAdministratorsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerAzureADAdministratorsCreateOrUpdateResponse, error) { respType := ServerAzureADAdministratorsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServerAzureADAdministrator) @@ -6858,6 +7025,8 @@ type ServerAzureADAdministratorsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerAzureADAdministratorsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerAzureADAdministratorsDeleteResponse, error) { respType := ServerAzureADAdministratorsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -6926,6 +7095,8 @@ type ServerAzureADOnlyAuthenticationsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerAzureADOnlyAuthenticationsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerAzureADOnlyAuthenticationsCreateOrUpdateResponse, error) { respType := ServerAzureADOnlyAuthenticationsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServerAzureADOnlyAuthentication) @@ -6976,6 +7147,8 @@ type ServerAzureADOnlyAuthenticationsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerAzureADOnlyAuthenticationsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerAzureADOnlyAuthenticationsDeleteResponse, error) { respType := ServerAzureADOnlyAuthenticationsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7044,6 +7217,8 @@ type ServerBlobAuditingPoliciesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerBlobAuditingPoliciesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerBlobAuditingPoliciesCreateOrUpdateResponse, error) { respType := ServerBlobAuditingPoliciesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServerBlobAuditingPolicy) @@ -7118,6 +7293,8 @@ type ServerCommunicationLinksCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerCommunicationLinksCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerCommunicationLinksCreateOrUpdateResponse, error) { respType := ServerCommunicationLinksCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServerCommunicationLink) @@ -7222,6 +7399,8 @@ type ServerDNSAliasesAcquirePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerDNSAliasesAcquirePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerDNSAliasesAcquireResponse, error) { respType := ServerDNSAliasesAcquireResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServerDNSAlias) @@ -7272,6 +7451,8 @@ type ServerDNSAliasesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerDNSAliasesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerDNSAliasesCreateOrUpdateResponse, error) { respType := ServerDNSAliasesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServerDNSAlias) @@ -7322,6 +7503,8 @@ type ServerDNSAliasesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerDNSAliasesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerDNSAliasesDeleteResponse, error) { respType := ServerDNSAliasesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7390,6 +7573,8 @@ type ServerDevOpsAuditSettingsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerDevOpsAuditSettingsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerDevOpsAuditSettingsCreateOrUpdateResponse, error) { respType := ServerDevOpsAuditSettingsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServerDevOpsAuditingSettings) @@ -7464,6 +7649,8 @@ type ServerKeysCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerKeysCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerKeysCreateOrUpdateResponse, error) { respType := ServerKeysCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServerKey) @@ -7514,6 +7701,8 @@ type ServerKeysDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerKeysDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerKeysDeleteResponse, error) { respType := ServerKeysDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7594,6 +7783,8 @@ type ServerSecurityAlertPoliciesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerSecurityAlertPoliciesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerSecurityAlertPoliciesCreateOrUpdateResponse, error) { respType := ServerSecurityAlertPoliciesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServerSecurityAlertPolicy) @@ -7668,6 +7859,8 @@ type ServerTrustGroupsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerTrustGroupsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerTrustGroupsCreateOrUpdateResponse, error) { respType := ServerTrustGroupsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ServerTrustGroup) @@ -7718,6 +7911,8 @@ type ServerTrustGroupsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServerTrustGroupsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServerTrustGroupsDeleteResponse, error) { respType := ServerTrustGroupsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7864,6 +8059,8 @@ type ServersCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersCreateOrUpdateResponse, error) { respType := ServersCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Server) @@ -7914,6 +8111,8 @@ type ServersDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersDeleteResponse, error) { respType := ServersDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7970,6 +8169,8 @@ type ServersImportDatabasePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersImportDatabasePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersImportDatabaseResponse, error) { respType := ServersImportDatabaseResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ImportExportOperationResult) @@ -8044,6 +8245,8 @@ type ServersUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ServersUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ServersUpdateResponse, error) { respType := ServersUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Server) @@ -8142,6 +8345,8 @@ type SyncAgentsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SyncAgentsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SyncAgentsCreateOrUpdateResponse, error) { respType := SyncAgentsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SyncAgent) @@ -8192,6 +8397,8 @@ type SyncAgentsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SyncAgentsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SyncAgentsDeleteResponse, error) { respType := SyncAgentsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -8290,6 +8497,8 @@ type SyncGroupsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SyncGroupsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SyncGroupsCreateOrUpdateResponse, error) { respType := SyncGroupsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SyncGroup) @@ -8340,6 +8549,8 @@ type SyncGroupsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SyncGroupsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SyncGroupsDeleteResponse, error) { respType := SyncGroupsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -8444,6 +8655,8 @@ type SyncGroupsRefreshHubSchemaPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SyncGroupsRefreshHubSchemaPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SyncGroupsRefreshHubSchemaResponse, error) { respType := SyncGroupsRefreshHubSchemaResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -8494,6 +8707,8 @@ type SyncGroupsUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SyncGroupsUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SyncGroupsUpdateResponse, error) { respType := SyncGroupsUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SyncGroup) @@ -8544,6 +8759,8 @@ type SyncMembersCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SyncMembersCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SyncMembersCreateOrUpdateResponse, error) { respType := SyncMembersCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SyncMember) @@ -8594,6 +8811,8 @@ type SyncMembersDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SyncMembersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SyncMembersDeleteResponse, error) { respType := SyncMembersDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -8674,6 +8893,8 @@ type SyncMembersRefreshMemberSchemaPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SyncMembersRefreshMemberSchemaPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SyncMembersRefreshMemberSchemaResponse, error) { respType := SyncMembersRefreshMemberSchemaResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -8718,6 +8939,8 @@ type SyncMembersUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SyncMembersUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SyncMembersUpdateResponse, error) { respType := SyncMembersUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SyncMember) @@ -8768,6 +8991,8 @@ type TdeCertificatesCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l TdeCertificatesCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (TdeCertificatesCreateResponse, error) { respType := TdeCertificatesCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -8884,6 +9109,8 @@ type VirtualClustersDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualClustersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualClustersDeleteResponse, error) { respType := VirtualClustersDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -8976,6 +9203,8 @@ type VirtualClustersUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualClustersUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualClustersUpdateResponse, error) { respType := VirtualClustersUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualCluster) @@ -9026,6 +9255,8 @@ type VirtualNetworkRulesCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkRulesCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkRulesCreateOrUpdateResponse, error) { respType := VirtualNetworkRulesCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.VirtualNetworkRule) @@ -9076,6 +9307,8 @@ type VirtualNetworkRulesDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l VirtualNetworkRulesDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (VirtualNetworkRulesDeleteResponse, error) { respType := VirtualNetworkRulesDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -9144,6 +9377,8 @@ type WorkloadClassifiersCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WorkloadClassifiersCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WorkloadClassifiersCreateOrUpdateResponse, error) { respType := WorkloadClassifiersCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.WorkloadClassifier) @@ -9194,6 +9429,8 @@ type WorkloadClassifiersDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WorkloadClassifiersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WorkloadClassifiersDeleteResponse, error) { respType := WorkloadClassifiersDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -9262,6 +9499,8 @@ type WorkloadGroupsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WorkloadGroupsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WorkloadGroupsCreateOrUpdateResponse, error) { respType := WorkloadGroupsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.WorkloadGroup) @@ -9312,6 +9551,8 @@ type WorkloadGroupsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WorkloadGroupsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WorkloadGroupsDeleteResponse, error) { respType := WorkloadGroupsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_restorabledroppeddatabases_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_restorabledroppeddatabases_client.go index d7b2fea415f7..ae744409c248 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_restorabledroppeddatabases_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_restorabledroppeddatabases_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RestorableDroppedDatabasesClient contains the methods for the RestorableDroppedDatabases group. @@ -29,8 +30,15 @@ type RestorableDroppedDatabasesClient struct { } // NewRestorableDroppedDatabasesClient creates a new instance of RestorableDroppedDatabasesClient with the specified values. -func NewRestorableDroppedDatabasesClient(con *arm.Connection, subscriptionID string) *RestorableDroppedDatabasesClient { - return &RestorableDroppedDatabasesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRestorableDroppedDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RestorableDroppedDatabasesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RestorableDroppedDatabasesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a restorable dropped database. @@ -84,7 +92,7 @@ func (client *RestorableDroppedDatabasesClient) getCreateRequest(ctx context.Con func (client *RestorableDroppedDatabasesClient) getHandleResponse(resp *http.Response) (RestorableDroppedDatabasesGetResponse, error) { result := RestorableDroppedDatabasesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorableDroppedDatabase); err != nil { - return RestorableDroppedDatabasesGetResponse{}, err + return RestorableDroppedDatabasesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -145,7 +153,7 @@ func (client *RestorableDroppedDatabasesClient) listByServerCreateRequest(ctx co func (client *RestorableDroppedDatabasesClient) listByServerHandleResponse(resp *http.Response) (RestorableDroppedDatabasesListByServerResponse, error) { result := RestorableDroppedDatabasesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorableDroppedDatabaseListResult); err != nil { - return RestorableDroppedDatabasesListByServerResponse{}, err + return RestorableDroppedDatabasesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_restorabledroppedmanageddatabases_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_restorabledroppedmanageddatabases_client.go index c3ccdaf92ebc..f63c288e7b83 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_restorabledroppedmanageddatabases_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_restorabledroppedmanageddatabases_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RestorableDroppedManagedDatabasesClient contains the methods for the RestorableDroppedManagedDatabases group. @@ -29,8 +30,15 @@ type RestorableDroppedManagedDatabasesClient struct { } // NewRestorableDroppedManagedDatabasesClient creates a new instance of RestorableDroppedManagedDatabasesClient with the specified values. -func NewRestorableDroppedManagedDatabasesClient(con *arm.Connection, subscriptionID string) *RestorableDroppedManagedDatabasesClient { - return &RestorableDroppedManagedDatabasesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRestorableDroppedManagedDatabasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RestorableDroppedManagedDatabasesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RestorableDroppedManagedDatabasesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a restorable dropped managed database. @@ -84,7 +92,7 @@ func (client *RestorableDroppedManagedDatabasesClient) getCreateRequest(ctx cont func (client *RestorableDroppedManagedDatabasesClient) getHandleResponse(resp *http.Response) (RestorableDroppedManagedDatabasesGetResponse, error) { result := RestorableDroppedManagedDatabasesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorableDroppedManagedDatabase); err != nil { - return RestorableDroppedManagedDatabasesGetResponse{}, err + return RestorableDroppedManagedDatabasesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -145,7 +153,7 @@ func (client *RestorableDroppedManagedDatabasesClient) listByInstanceCreateReque func (client *RestorableDroppedManagedDatabasesClient) listByInstanceHandleResponse(resp *http.Response) (RestorableDroppedManagedDatabasesListByInstanceResponse, error) { result := RestorableDroppedManagedDatabasesListByInstanceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorableDroppedManagedDatabaseListResult); err != nil { - return RestorableDroppedManagedDatabasesListByInstanceResponse{}, err + return RestorableDroppedManagedDatabasesListByInstanceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_restorepoints_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_restorepoints_client.go index 32963aab6068..3e8908560891 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_restorepoints_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_restorepoints_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // RestorePointsClient contains the methods for the RestorePoints group. @@ -30,8 +30,15 @@ type RestorePointsClient struct { } // NewRestorePointsClient creates a new instance of RestorePointsClient with the specified values. -func NewRestorePointsClient(con *arm.Connection, subscriptionID string) *RestorePointsClient { - return &RestorePointsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRestorePointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RestorePointsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RestorePointsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a restore point for a data warehouse. @@ -230,7 +237,7 @@ func (client *RestorePointsClient) getCreateRequest(ctx context.Context, resourc func (client *RestorePointsClient) getHandleResponse(resp *http.Response) (RestorePointsGetResponse, error) { result := RestorePointsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorePoint); err != nil { - return RestorePointsGetResponse{}, err + return RestorePointsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -295,7 +302,7 @@ func (client *RestorePointsClient) listByDatabaseCreateRequest(ctx context.Conte func (client *RestorePointsClient) listByDatabaseHandleResponse(resp *http.Response) (RestorePointsListByDatabaseResponse, error) { result := RestorePointsListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestorePointListResult); err != nil { - return RestorePointsListByDatabaseResponse{}, err + return RestorePointsListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_sensitivitylabels_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_sensitivitylabels_client.go index b292d6224b5c..082393cb5fe0 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_sensitivitylabels_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_sensitivitylabels_client.go @@ -11,14 +11,15 @@ package armsql import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // SensitivityLabelsClient contains the methods for the SensitivityLabels group. @@ -30,8 +31,15 @@ type SensitivityLabelsClient struct { } // NewSensitivityLabelsClient creates a new instance of SensitivityLabelsClient with the specified values. -func NewSensitivityLabelsClient(con *arm.Connection, subscriptionID string) *SensitivityLabelsClient { - return &SensitivityLabelsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSensitivityLabelsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SensitivityLabelsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SensitivityLabelsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the sensitivity label of a given column @@ -98,7 +106,7 @@ func (client *SensitivityLabelsClient) createOrUpdateCreateRequest(ctx context.C func (client *SensitivityLabelsClient) createOrUpdateHandleResponse(resp *http.Response) (SensitivityLabelsCreateOrUpdateResponse, error) { result := SensitivityLabelsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SensitivityLabel); err != nil { - return SensitivityLabelsCreateOrUpdateResponse{}, err + return SensitivityLabelsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -395,7 +403,7 @@ func (client *SensitivityLabelsClient) getCreateRequest(ctx context.Context, res func (client *SensitivityLabelsClient) getHandleResponse(resp *http.Response) (SensitivityLabelsGetResponse, error) { result := SensitivityLabelsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SensitivityLabel); err != nil { - return SensitivityLabelsGetResponse{}, err + return SensitivityLabelsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -469,7 +477,7 @@ func (client *SensitivityLabelsClient) listCurrentByDatabaseCreateRequest(ctx co func (client *SensitivityLabelsClient) listCurrentByDatabaseHandleResponse(resp *http.Response) (SensitivityLabelsListCurrentByDatabaseResponse, error) { result := SensitivityLabelsListCurrentByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SensitivityLabelListResult); err != nil { - return SensitivityLabelsListCurrentByDatabaseResponse{}, err + return SensitivityLabelsListCurrentByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -543,7 +551,7 @@ func (client *SensitivityLabelsClient) listRecommendedByDatabaseCreateRequest(ct func (client *SensitivityLabelsClient) listRecommendedByDatabaseHandleResponse(resp *http.Response) (SensitivityLabelsListRecommendedByDatabaseResponse, error) { result := SensitivityLabelsListRecommendedByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SensitivityLabelListResult); err != nil { - return SensitivityLabelsListRecommendedByDatabaseResponse{}, err + return SensitivityLabelsListRecommendedByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_serveradvisors_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_serveradvisors_client.go index e6192df2cc42..1876f0588e05 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_serveradvisors_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_serveradvisors_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerAdvisorsClient contains the methods for the ServerAdvisors group. @@ -29,8 +30,15 @@ type ServerAdvisorsClient struct { } // NewServerAdvisorsClient creates a new instance of ServerAdvisorsClient with the specified values. -func NewServerAdvisorsClient(con *arm.Connection, subscriptionID string) *ServerAdvisorsClient { - return &ServerAdvisorsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerAdvisorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerAdvisorsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerAdvisorsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a server advisor. @@ -84,7 +92,7 @@ func (client *ServerAdvisorsClient) getCreateRequest(ctx context.Context, resour func (client *ServerAdvisorsClient) getHandleResponse(resp *http.Response) (ServerAdvisorsGetResponse, error) { result := ServerAdvisorsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Advisor); err != nil { - return ServerAdvisorsGetResponse{}, err + return ServerAdvisorsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -151,7 +159,7 @@ func (client *ServerAdvisorsClient) listByServerCreateRequest(ctx context.Contex func (client *ServerAdvisorsClient) listByServerHandleResponse(resp *http.Response) (ServerAdvisorsListByServerResponse, error) { result := ServerAdvisorsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AdvisorArray); err != nil { - return ServerAdvisorsListByServerResponse{}, err + return ServerAdvisorsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -219,7 +227,7 @@ func (client *ServerAdvisorsClient) updateCreateRequest(ctx context.Context, res func (client *ServerAdvisorsClient) updateHandleResponse(resp *http.Response) (ServerAdvisorsUpdateResponse, error) { result := ServerAdvisorsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Advisor); err != nil { - return ServerAdvisorsUpdateResponse{}, err + return ServerAdvisorsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_serverautomatictuning_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_serverautomatictuning_client.go index c6a7106ed5fa..aa8629e51473 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_serverautomatictuning_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_serverautomatictuning_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerAutomaticTuningClient contains the methods for the ServerAutomaticTuning group. @@ -29,8 +30,15 @@ type ServerAutomaticTuningClient struct { } // NewServerAutomaticTuningClient creates a new instance of ServerAutomaticTuningClient with the specified values. -func NewServerAutomaticTuningClient(con *arm.Connection, subscriptionID string) *ServerAutomaticTuningClient { - return &ServerAutomaticTuningClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerAutomaticTuningClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerAutomaticTuningClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerAutomaticTuningClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Retrieves server automatic tuning options. @@ -80,7 +88,7 @@ func (client *ServerAutomaticTuningClient) getCreateRequest(ctx context.Context, func (client *ServerAutomaticTuningClient) getHandleResponse(resp *http.Response) (ServerAutomaticTuningGetResponse, error) { result := ServerAutomaticTuningGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerAutomaticTuning); err != nil { - return ServerAutomaticTuningGetResponse{}, err + return ServerAutomaticTuningGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -144,7 +152,7 @@ func (client *ServerAutomaticTuningClient) updateCreateRequest(ctx context.Conte func (client *ServerAutomaticTuningClient) updateHandleResponse(resp *http.Response) (ServerAutomaticTuningUpdateResponse, error) { result := ServerAutomaticTuningUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerAutomaticTuning); err != nil { - return ServerAutomaticTuningUpdateResponse{}, err + return ServerAutomaticTuningUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_serverazureadadministrators_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_serverazureadadministrators_client.go index 775f2c3c1e65..7b1c5bc2ff8c 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_serverazureadadministrators_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_serverazureadadministrators_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerAzureADAdministratorsClient contains the methods for the ServerAzureADAdministrators group. @@ -30,8 +30,15 @@ type ServerAzureADAdministratorsClient struct { } // NewServerAzureADAdministratorsClient creates a new instance of ServerAzureADAdministratorsClient with the specified values. -func NewServerAzureADAdministratorsClient(con *arm.Connection, subscriptionID string) *ServerAzureADAdministratorsClient { - return &ServerAzureADAdministratorsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerAzureADAdministratorsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerAzureADAdministratorsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerAzureADAdministratorsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates an existing Azure Active Directory administrator. @@ -242,7 +249,7 @@ func (client *ServerAzureADAdministratorsClient) getCreateRequest(ctx context.Co func (client *ServerAzureADAdministratorsClient) getHandleResponse(resp *http.Response) (ServerAzureADAdministratorsGetResponse, error) { result := ServerAzureADAdministratorsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerAzureADAdministrator); err != nil { - return ServerAzureADAdministratorsGetResponse{}, err + return ServerAzureADAdministratorsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -303,7 +310,7 @@ func (client *ServerAzureADAdministratorsClient) listByServerCreateRequest(ctx c func (client *ServerAzureADAdministratorsClient) listByServerHandleResponse(resp *http.Response) (ServerAzureADAdministratorsListByServerResponse, error) { result := ServerAzureADAdministratorsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AdministratorListResult); err != nil { - return ServerAzureADAdministratorsListByServerResponse{}, err + return ServerAzureADAdministratorsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_serverazureadonlyauthentications_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_serverazureadonlyauthentications_client.go index 80256432f4d4..67a88badfcf3 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_serverazureadonlyauthentications_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_serverazureadonlyauthentications_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerAzureADOnlyAuthenticationsClient contains the methods for the ServerAzureADOnlyAuthentications group. @@ -30,8 +30,15 @@ type ServerAzureADOnlyAuthenticationsClient struct { } // NewServerAzureADOnlyAuthenticationsClient creates a new instance of ServerAzureADOnlyAuthenticationsClient with the specified values. -func NewServerAzureADOnlyAuthenticationsClient(con *arm.Connection, subscriptionID string) *ServerAzureADOnlyAuthenticationsClient { - return &ServerAzureADOnlyAuthenticationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerAzureADOnlyAuthenticationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerAzureADOnlyAuthenticationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerAzureADOnlyAuthenticationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Sets Server Active Directory only authentication property or updates an existing server Active Directory only authentication property. @@ -242,7 +249,7 @@ func (client *ServerAzureADOnlyAuthenticationsClient) getCreateRequest(ctx conte func (client *ServerAzureADOnlyAuthenticationsClient) getHandleResponse(resp *http.Response) (ServerAzureADOnlyAuthenticationsGetResponse, error) { result := ServerAzureADOnlyAuthenticationsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerAzureADOnlyAuthentication); err != nil { - return ServerAzureADOnlyAuthenticationsGetResponse{}, err + return ServerAzureADOnlyAuthenticationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -303,7 +310,7 @@ func (client *ServerAzureADOnlyAuthenticationsClient) listByServerCreateRequest( func (client *ServerAzureADOnlyAuthenticationsClient) listByServerHandleResponse(resp *http.Response) (ServerAzureADOnlyAuthenticationsListByServerResponse, error) { result := ServerAzureADOnlyAuthenticationsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AzureADOnlyAuthListResult); err != nil { - return ServerAzureADOnlyAuthenticationsListByServerResponse{}, err + return ServerAzureADOnlyAuthenticationsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_serverblobauditingpolicies_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_serverblobauditingpolicies_client.go index 9fa160818065..a782776c8cd5 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_serverblobauditingpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_serverblobauditingpolicies_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerBlobAuditingPoliciesClient contains the methods for the ServerBlobAuditingPolicies group. @@ -30,8 +30,15 @@ type ServerBlobAuditingPoliciesClient struct { } // NewServerBlobAuditingPoliciesClient creates a new instance of ServerBlobAuditingPoliciesClient with the specified values. -func NewServerBlobAuditingPoliciesClient(con *arm.Connection, subscriptionID string) *ServerBlobAuditingPoliciesClient { - return &ServerBlobAuditingPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerBlobAuditingPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerBlobAuditingPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerBlobAuditingPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a server's blob auditing policy. @@ -158,7 +165,7 @@ func (client *ServerBlobAuditingPoliciesClient) getCreateRequest(ctx context.Con func (client *ServerBlobAuditingPoliciesClient) getHandleResponse(resp *http.Response) (ServerBlobAuditingPoliciesGetResponse, error) { result := ServerBlobAuditingPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerBlobAuditingPolicy); err != nil { - return ServerBlobAuditingPoliciesGetResponse{}, err + return ServerBlobAuditingPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -219,7 +226,7 @@ func (client *ServerBlobAuditingPoliciesClient) listByServerCreateRequest(ctx co func (client *ServerBlobAuditingPoliciesClient) listByServerHandleResponse(resp *http.Response) (ServerBlobAuditingPoliciesListByServerResponse, error) { result := ServerBlobAuditingPoliciesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerBlobAuditingPolicyListResult); err != nil { - return ServerBlobAuditingPoliciesListByServerResponse{}, err + return ServerBlobAuditingPoliciesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_servercommunicationlinks_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_servercommunicationlinks_client.go index 2cfd3a32f5e7..3939e8b5e3af 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_servercommunicationlinks_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_servercommunicationlinks_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerCommunicationLinksClient contains the methods for the ServerCommunicationLinks group. @@ -30,8 +30,15 @@ type ServerCommunicationLinksClient struct { } // NewServerCommunicationLinksClient creates a new instance of ServerCommunicationLinksClient with the specified values. -func NewServerCommunicationLinksClient(con *arm.Connection, subscriptionID string) *ServerCommunicationLinksClient { - return &ServerCommunicationLinksClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerCommunicationLinksClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerCommunicationLinksClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerCommunicationLinksClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a server communication link. @@ -222,7 +229,7 @@ func (client *ServerCommunicationLinksClient) getCreateRequest(ctx context.Conte func (client *ServerCommunicationLinksClient) getHandleResponse(resp *http.Response) (ServerCommunicationLinksGetResponse, error) { result := ServerCommunicationLinksGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerCommunicationLink); err != nil { - return ServerCommunicationLinksGetResponse{}, err + return ServerCommunicationLinksGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -286,7 +293,7 @@ func (client *ServerCommunicationLinksClient) listByServerCreateRequest(ctx cont func (client *ServerCommunicationLinksClient) listByServerHandleResponse(resp *http.Response) (ServerCommunicationLinksListByServerResponse, error) { result := ServerCommunicationLinksListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerCommunicationLinkListResult); err != nil { - return ServerCommunicationLinksListByServerResponse{}, err + return ServerCommunicationLinksListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_serverconnectionpolicies_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_serverconnectionpolicies_client.go index 0aff771a167f..128e88b8afb1 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_serverconnectionpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_serverconnectionpolicies_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerConnectionPoliciesClient contains the methods for the ServerConnectionPolicies group. @@ -29,8 +30,15 @@ type ServerConnectionPoliciesClient struct { } // NewServerConnectionPoliciesClient creates a new instance of ServerConnectionPoliciesClient with the specified values. -func NewServerConnectionPoliciesClient(con *arm.Connection, subscriptionID string) *ServerConnectionPoliciesClient { - return &ServerConnectionPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerConnectionPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerConnectionPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerConnectionPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the server's connection policy. @@ -84,7 +92,7 @@ func (client *ServerConnectionPoliciesClient) createOrUpdateCreateRequest(ctx co func (client *ServerConnectionPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (ServerConnectionPoliciesCreateOrUpdateResponse, error) { result := ServerConnectionPoliciesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerConnectionPolicy); err != nil { - return ServerConnectionPoliciesCreateOrUpdateResponse{}, err + return ServerConnectionPoliciesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -152,7 +160,7 @@ func (client *ServerConnectionPoliciesClient) getCreateRequest(ctx context.Conte func (client *ServerConnectionPoliciesClient) getHandleResponse(resp *http.Response) (ServerConnectionPoliciesGetResponse, error) { result := ServerConnectionPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerConnectionPolicy); err != nil { - return ServerConnectionPoliciesGetResponse{}, err + return ServerConnectionPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_serverdevopsauditsettings_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_serverdevopsauditsettings_client.go index ffee911d172f..83234b894b53 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_serverdevopsauditsettings_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_serverdevopsauditsettings_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerDevOpsAuditSettingsClient contains the methods for the ServerDevOpsAuditSettings group. @@ -30,8 +30,15 @@ type ServerDevOpsAuditSettingsClient struct { } // NewServerDevOpsAuditSettingsClient creates a new instance of ServerDevOpsAuditSettingsClient with the specified values. -func NewServerDevOpsAuditSettingsClient(con *arm.Connection, subscriptionID string) *ServerDevOpsAuditSettingsClient { - return &ServerDevOpsAuditSettingsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerDevOpsAuditSettingsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerDevOpsAuditSettingsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerDevOpsAuditSettingsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a server's DevOps audit settings. @@ -164,7 +171,7 @@ func (client *ServerDevOpsAuditSettingsClient) getCreateRequest(ctx context.Cont func (client *ServerDevOpsAuditSettingsClient) getHandleResponse(resp *http.Response) (ServerDevOpsAuditSettingsGetResponse, error) { result := ServerDevOpsAuditSettingsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerDevOpsAuditingSettings); err != nil { - return ServerDevOpsAuditSettingsGetResponse{}, err + return ServerDevOpsAuditSettingsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -225,7 +232,7 @@ func (client *ServerDevOpsAuditSettingsClient) listByServerCreateRequest(ctx con func (client *ServerDevOpsAuditSettingsClient) listByServerHandleResponse(resp *http.Response) (ServerDevOpsAuditSettingsListByServerResponse, error) { result := ServerDevOpsAuditSettingsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerDevOpsAuditSettingsListResult); err != nil { - return ServerDevOpsAuditSettingsListByServerResponse{}, err + return ServerDevOpsAuditSettingsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_serverdnsaliases_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_serverdnsaliases_client.go index c36d74c4af3d..505f16936cb7 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_serverdnsaliases_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_serverdnsaliases_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerDNSAliasesClient contains the methods for the ServerDNSAliases group. @@ -30,8 +30,15 @@ type ServerDNSAliasesClient struct { } // NewServerDNSAliasesClient creates a new instance of ServerDNSAliasesClient with the specified values. -func NewServerDNSAliasesClient(con *arm.Connection, subscriptionID string) *ServerDNSAliasesClient { - return &ServerDNSAliasesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerDNSAliasesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerDNSAliasesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerDNSAliasesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginAcquire - Acquires server DNS alias from another server. @@ -321,7 +328,7 @@ func (client *ServerDNSAliasesClient) getCreateRequest(ctx context.Context, reso func (client *ServerDNSAliasesClient) getHandleResponse(resp *http.Response) (ServerDNSAliasesGetResponse, error) { result := ServerDNSAliasesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerDNSAlias); err != nil { - return ServerDNSAliasesGetResponse{}, err + return ServerDNSAliasesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -382,7 +389,7 @@ func (client *ServerDNSAliasesClient) listByServerCreateRequest(ctx context.Cont func (client *ServerDNSAliasesClient) listByServerHandleResponse(resp *http.Response) (ServerDNSAliasesListByServerResponse, error) { result := ServerDNSAliasesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerDNSAliasListResult); err != nil { - return ServerDNSAliasesListByServerResponse{}, err + return ServerDNSAliasesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_serverkeys_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_serverkeys_client.go index 60d06c75211b..8e866b32bd2b 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_serverkeys_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_serverkeys_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerKeysClient contains the methods for the ServerKeys group. @@ -30,8 +30,15 @@ type ServerKeysClient struct { } // NewServerKeysClient creates a new instance of ServerKeysClient with the specified values. -func NewServerKeysClient(con *arm.Connection, subscriptionID string) *ServerKeysClient { - return &ServerKeysClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerKeysClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerKeysClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerKeysClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a server key. @@ -242,7 +249,7 @@ func (client *ServerKeysClient) getCreateRequest(ctx context.Context, resourceGr func (client *ServerKeysClient) getHandleResponse(resp *http.Response) (ServerKeysGetResponse, error) { result := ServerKeysGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerKey); err != nil { - return ServerKeysGetResponse{}, err + return ServerKeysGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -303,7 +310,7 @@ func (client *ServerKeysClient) listByServerCreateRequest(ctx context.Context, r func (client *ServerKeysClient) listByServerHandleResponse(resp *http.Response) (ServerKeysListByServerResponse, error) { result := ServerKeysListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerKeyListResult); err != nil { - return ServerKeysListByServerResponse{}, err + return ServerKeysListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_serveroperations_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_serveroperations_client.go index e73d693a0fe4..ef85e4300f37 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_serveroperations_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_serveroperations_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerOperationsClient contains the methods for the ServerOperations group. @@ -29,8 +30,15 @@ type ServerOperationsClient struct { } // NewServerOperationsClient creates a new instance of ServerOperationsClient with the specified values. -func NewServerOperationsClient(con *arm.Connection, subscriptionID string) *ServerOperationsClient { - return &ServerOperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerOperationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerOperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerOperationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByServer - Gets a list of operations performed on the server. @@ -77,7 +85,7 @@ func (client *ServerOperationsClient) listByServerCreateRequest(ctx context.Cont func (client *ServerOperationsClient) listByServerHandleResponse(resp *http.Response) (ServerOperationsListByServerResponse, error) { result := ServerOperationsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerOperationListResult); err != nil { - return ServerOperationsListByServerResponse{}, err + return ServerOperationsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_servers_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_servers_client.go index 8a534e1e79ea..8c5b3a837442 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_servers_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_servers_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServersClient contains the methods for the Servers group. @@ -30,8 +30,15 @@ type ServersClient struct { } // NewServersClient creates a new instance of ServersClient with the specified values. -func NewServersClient(con *arm.Connection, subscriptionID string) *ServersClient { - return &ServersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNameAvailability - Determines whether a resource can be created with the specified name. @@ -73,7 +80,7 @@ func (client *ServersClient) checkNameAvailabilityCreateRequest(ctx context.Cont func (client *ServersClient) checkNameAvailabilityHandleResponse(resp *http.Response) (ServersCheckNameAvailabilityResponse, error) { result := ServersCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResponse); err != nil { - return ServersCheckNameAvailabilityResponse{}, err + return ServersCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -289,7 +296,7 @@ func (client *ServersClient) getCreateRequest(ctx context.Context, resourceGroup func (client *ServersClient) getHandleResponse(resp *http.Response) (ServersGetResponse, error) { result := ServersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Server); err != nil { - return ServersGetResponse{}, err + return ServersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -420,7 +427,7 @@ func (client *ServersClient) listCreateRequest(ctx context.Context, options *Ser func (client *ServersClient) listHandleResponse(resp *http.Response) (ServersListResponse, error) { result := ServersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerListResult); err != nil { - return ServersListResponse{}, err + return ServersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -480,7 +487,7 @@ func (client *ServersClient) listByResourceGroupCreateRequest(ctx context.Contex func (client *ServersClient) listByResourceGroupHandleResponse(resp *http.Response) (ServersListByResourceGroupResponse, error) { result := ServersListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerListResult); err != nil { - return ServersListByResourceGroupResponse{}, err + return ServersListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_serversecurityalertpolicies_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_serversecurityalertpolicies_client.go index f3fc1c428894..a5412fb71532 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_serversecurityalertpolicies_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_serversecurityalertpolicies_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerSecurityAlertPoliciesClient contains the methods for the ServerSecurityAlertPolicies group. @@ -30,8 +30,15 @@ type ServerSecurityAlertPoliciesClient struct { } // NewServerSecurityAlertPoliciesClient creates a new instance of ServerSecurityAlertPoliciesClient with the specified values. -func NewServerSecurityAlertPoliciesClient(con *arm.Connection, subscriptionID string) *ServerSecurityAlertPoliciesClient { - return &ServerSecurityAlertPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerSecurityAlertPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerSecurityAlertPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerSecurityAlertPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a threat detection policy. @@ -164,7 +171,7 @@ func (client *ServerSecurityAlertPoliciesClient) getCreateRequest(ctx context.Co func (client *ServerSecurityAlertPoliciesClient) getHandleResponse(resp *http.Response) (ServerSecurityAlertPoliciesGetResponse, error) { result := ServerSecurityAlertPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerSecurityAlertPolicy); err != nil { - return ServerSecurityAlertPoliciesGetResponse{}, err + return ServerSecurityAlertPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -225,7 +232,7 @@ func (client *ServerSecurityAlertPoliciesClient) listByServerCreateRequest(ctx c func (client *ServerSecurityAlertPoliciesClient) listByServerHandleResponse(resp *http.Response) (ServerSecurityAlertPoliciesListByServerResponse, error) { result := ServerSecurityAlertPoliciesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LogicalServerSecurityAlertPolicyListResult); err != nil { - return ServerSecurityAlertPoliciesListByServerResponse{}, err + return ServerSecurityAlertPoliciesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_servertrustgroups_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_servertrustgroups_client.go index 6d34d6d6fc77..a6866186cb77 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_servertrustgroups_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_servertrustgroups_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerTrustGroupsClient contains the methods for the ServerTrustGroups group. @@ -30,8 +30,15 @@ type ServerTrustGroupsClient struct { } // NewServerTrustGroupsClient creates a new instance of ServerTrustGroupsClient with the specified values. -func NewServerTrustGroupsClient(con *arm.Connection, subscriptionID string) *ServerTrustGroupsClient { - return &ServerTrustGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerTrustGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerTrustGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerTrustGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a server trust group. @@ -242,7 +249,7 @@ func (client *ServerTrustGroupsClient) getCreateRequest(ctx context.Context, res func (client *ServerTrustGroupsClient) getHandleResponse(resp *http.Response) (ServerTrustGroupsGetResponse, error) { result := ServerTrustGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerTrustGroup); err != nil { - return ServerTrustGroupsGetResponse{}, err + return ServerTrustGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -303,7 +310,7 @@ func (client *ServerTrustGroupsClient) listByInstanceCreateRequest(ctx context.C func (client *ServerTrustGroupsClient) listByInstanceHandleResponse(resp *http.Response) (ServerTrustGroupsListByInstanceResponse, error) { result := ServerTrustGroupsListByInstanceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerTrustGroupListResult); err != nil { - return ServerTrustGroupsListByInstanceResponse{}, err + return ServerTrustGroupsListByInstanceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -364,7 +371,7 @@ func (client *ServerTrustGroupsClient) listByLocationCreateRequest(ctx context.C func (client *ServerTrustGroupsClient) listByLocationHandleResponse(resp *http.Response) (ServerTrustGroupsListByLocationResponse, error) { result := ServerTrustGroupsListByLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerTrustGroupListResult); err != nil { - return ServerTrustGroupsListByLocationResponse{}, err + return ServerTrustGroupsListByLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_serverusages_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_serverusages_client.go index a31903f26eca..0627ce0992bc 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_serverusages_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_serverusages_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerUsagesClient contains the methods for the ServerUsages group. @@ -29,8 +30,15 @@ type ServerUsagesClient struct { } // NewServerUsagesClient creates a new instance of ServerUsagesClient with the specified values. -func NewServerUsagesClient(con *arm.Connection, subscriptionID string) *ServerUsagesClient { - return &ServerUsagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerUsagesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerUsagesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByServer - Returns server usages. @@ -80,7 +88,7 @@ func (client *ServerUsagesClient) listByServerCreateRequest(ctx context.Context, func (client *ServerUsagesClient) listByServerHandleResponse(resp *http.Response) (ServerUsagesListByServerResponse, error) { result := ServerUsagesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerUsageListResult); err != nil { - return ServerUsagesListByServerResponse{}, err + return ServerUsagesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_servervulnerabilityassessments_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_servervulnerabilityassessments_client.go index ea7c91c81cbc..ad8f7b390e41 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_servervulnerabilityassessments_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_servervulnerabilityassessments_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServerVulnerabilityAssessmentsClient contains the methods for the ServerVulnerabilityAssessments group. @@ -29,8 +30,15 @@ type ServerVulnerabilityAssessmentsClient struct { } // NewServerVulnerabilityAssessmentsClient creates a new instance of ServerVulnerabilityAssessmentsClient with the specified values. -func NewServerVulnerabilityAssessmentsClient(con *arm.Connection, subscriptionID string) *ServerVulnerabilityAssessmentsClient { - return &ServerVulnerabilityAssessmentsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServerVulnerabilityAssessmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServerVulnerabilityAssessmentsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServerVulnerabilityAssessmentsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates or updates the server's vulnerability assessment. Learn more about setting SQL vulnerability assessment with managed identity @@ -86,7 +94,7 @@ func (client *ServerVulnerabilityAssessmentsClient) createOrUpdateCreateRequest( func (client *ServerVulnerabilityAssessmentsClient) createOrUpdateHandleResponse(resp *http.Response) (ServerVulnerabilityAssessmentsCreateOrUpdateResponse, error) { result := ServerVulnerabilityAssessmentsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerVulnerabilityAssessment); err != nil { - return ServerVulnerabilityAssessmentsCreateOrUpdateResponse{}, err + return ServerVulnerabilityAssessmentsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -212,7 +220,7 @@ func (client *ServerVulnerabilityAssessmentsClient) getCreateRequest(ctx context func (client *ServerVulnerabilityAssessmentsClient) getHandleResponse(resp *http.Response) (ServerVulnerabilityAssessmentsGetResponse, error) { result := ServerVulnerabilityAssessmentsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerVulnerabilityAssessment); err != nil { - return ServerVulnerabilityAssessmentsGetResponse{}, err + return ServerVulnerabilityAssessmentsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -273,7 +281,7 @@ func (client *ServerVulnerabilityAssessmentsClient) listByServerCreateRequest(ct func (client *ServerVulnerabilityAssessmentsClient) listByServerHandleResponse(resp *http.Response) (ServerVulnerabilityAssessmentsListByServerResponse, error) { result := ServerVulnerabilityAssessmentsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServerVulnerabilityAssessmentListResult); err != nil { - return ServerVulnerabilityAssessmentsListByServerResponse{}, err + return ServerVulnerabilityAssessmentsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_serviceobjectives_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_serviceobjectives_client.go index cb00239d4cd3..aa32b507db4c 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_serviceobjectives_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_serviceobjectives_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ServiceObjectivesClient contains the methods for the ServiceObjectives group. @@ -29,8 +30,15 @@ type ServiceObjectivesClient struct { } // NewServiceObjectivesClient creates a new instance of ServiceObjectivesClient with the specified values. -func NewServiceObjectivesClient(con *arm.Connection, subscriptionID string) *ServiceObjectivesClient { - return &ServiceObjectivesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewServiceObjectivesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ServiceObjectivesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ServiceObjectivesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a database service objective. @@ -84,7 +92,7 @@ func (client *ServiceObjectivesClient) getCreateRequest(ctx context.Context, res func (client *ServiceObjectivesClient) getHandleResponse(resp *http.Response) (ServiceObjectivesGetResponse, error) { result := ServiceObjectivesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServiceObjective); err != nil { - return ServiceObjectivesGetResponse{}, err + return ServiceObjectivesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -148,7 +156,7 @@ func (client *ServiceObjectivesClient) listByServerCreateRequest(ctx context.Con func (client *ServiceObjectivesClient) listByServerHandleResponse(resp *http.Response) (ServiceObjectivesListByServerResponse, error) { result := ServiceObjectivesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ServiceObjectiveListResult); err != nil { - return ServiceObjectivesListByServerResponse{}, err + return ServiceObjectivesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_sqlagent_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_sqlagent_client.go index 745949a01061..7b4697d73908 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_sqlagent_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_sqlagent_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SQLAgentClient contains the methods for the SQLAgent group. @@ -29,8 +30,15 @@ type SQLAgentClient struct { } // NewSQLAgentClient creates a new instance of SQLAgentClient with the specified values. -func NewSQLAgentClient(con *arm.Connection, subscriptionID string) *SQLAgentClient { - return &SQLAgentClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSQLAgentClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SQLAgentClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SQLAgentClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Puts new sql agent configuration to instance. @@ -80,7 +88,7 @@ func (client *SQLAgentClient) createOrUpdateCreateRequest(ctx context.Context, r func (client *SQLAgentClient) createOrUpdateHandleResponse(resp *http.Response) (SQLAgentCreateOrUpdateResponse, error) { result := SQLAgentCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SQLAgentConfiguration); err != nil { - return SQLAgentCreateOrUpdateResponse{}, err + return SQLAgentCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -144,7 +152,7 @@ func (client *SQLAgentClient) getCreateRequest(ctx context.Context, resourceGrou func (client *SQLAgentClient) getHandleResponse(resp *http.Response) (SQLAgentGetResponse, error) { result := SQLAgentGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SQLAgentConfiguration); err != nil { - return SQLAgentGetResponse{}, err + return SQLAgentGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_subscriptionusages_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_subscriptionusages_client.go index b5c8d12e2b0b..587c36213d6f 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_subscriptionusages_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_subscriptionusages_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SubscriptionUsagesClient contains the methods for the SubscriptionUsages group. @@ -29,8 +30,15 @@ type SubscriptionUsagesClient struct { } // NewSubscriptionUsagesClient creates a new instance of SubscriptionUsagesClient with the specified values. -func NewSubscriptionUsagesClient(con *arm.Connection, subscriptionID string) *SubscriptionUsagesClient { - return &SubscriptionUsagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSubscriptionUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SubscriptionUsagesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SubscriptionUsagesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a subscription usage metric. @@ -80,7 +88,7 @@ func (client *SubscriptionUsagesClient) getCreateRequest(ctx context.Context, lo func (client *SubscriptionUsagesClient) getHandleResponse(resp *http.Response) (SubscriptionUsagesGetResponse, error) { result := SubscriptionUsagesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionUsage); err != nil { - return SubscriptionUsagesGetResponse{}, err + return SubscriptionUsagesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -137,7 +145,7 @@ func (client *SubscriptionUsagesClient) listByLocationCreateRequest(ctx context. func (client *SubscriptionUsagesClient) listByLocationHandleResponse(resp *http.Response) (SubscriptionUsagesListByLocationResponse, error) { result := SubscriptionUsagesListByLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionUsageListResult); err != nil { - return SubscriptionUsagesListByLocationResponse{}, err + return SubscriptionUsagesListByLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_syncagents_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_syncagents_client.go index 46f18668801b..7778ceee89b6 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_syncagents_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_syncagents_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SyncAgentsClient contains the methods for the SyncAgents group. @@ -30,8 +30,15 @@ type SyncAgentsClient struct { } // NewSyncAgentsClient creates a new instance of SyncAgentsClient with the specified values. -func NewSyncAgentsClient(con *arm.Connection, subscriptionID string) *SyncAgentsClient { - return &SyncAgentsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSyncAgentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SyncAgentsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SyncAgentsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a sync agent. @@ -242,7 +249,7 @@ func (client *SyncAgentsClient) generateKeyCreateRequest(ctx context.Context, re func (client *SyncAgentsClient) generateKeyHandleResponse(resp *http.Response) (SyncAgentsGenerateKeyResponse, error) { result := SyncAgentsGenerateKeyResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SyncAgentKeyProperties); err != nil { - return SyncAgentsGenerateKeyResponse{}, err + return SyncAgentsGenerateKeyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -310,7 +317,7 @@ func (client *SyncAgentsClient) getCreateRequest(ctx context.Context, resourceGr func (client *SyncAgentsClient) getHandleResponse(resp *http.Response) (SyncAgentsGetResponse, error) { result := SyncAgentsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SyncAgent); err != nil { - return SyncAgentsGetResponse{}, err + return SyncAgentsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -371,7 +378,7 @@ func (client *SyncAgentsClient) listByServerCreateRequest(ctx context.Context, r func (client *SyncAgentsClient) listByServerHandleResponse(resp *http.Response) (SyncAgentsListByServerResponse, error) { result := SyncAgentsListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SyncAgentListResult); err != nil { - return SyncAgentsListByServerResponse{}, err + return SyncAgentsListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -436,7 +443,7 @@ func (client *SyncAgentsClient) listLinkedDatabasesCreateRequest(ctx context.Con func (client *SyncAgentsClient) listLinkedDatabasesHandleResponse(resp *http.Response) (SyncAgentsListLinkedDatabasesResponse, error) { result := SyncAgentsListLinkedDatabasesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SyncAgentLinkedDatabaseListResult); err != nil { - return SyncAgentsListLinkedDatabasesResponse{}, err + return SyncAgentsListLinkedDatabasesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_syncgroups_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_syncgroups_client.go index c269045f78e1..a872dcfd7083 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_syncgroups_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_syncgroups_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SyncGroupsClient contains the methods for the SyncGroups group. @@ -30,8 +30,15 @@ type SyncGroupsClient struct { } // NewSyncGroupsClient creates a new instance of SyncGroupsClient with the specified values. -func NewSyncGroupsClient(con *arm.Connection, subscriptionID string) *SyncGroupsClient { - return &SyncGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSyncGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SyncGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SyncGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CancelSync - Cancels a sync group synchronization. @@ -316,7 +323,7 @@ func (client *SyncGroupsClient) getCreateRequest(ctx context.Context, resourceGr func (client *SyncGroupsClient) getHandleResponse(resp *http.Response) (SyncGroupsGetResponse, error) { result := SyncGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SyncGroup); err != nil { - return SyncGroupsGetResponse{}, err + return SyncGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -381,7 +388,7 @@ func (client *SyncGroupsClient) listByDatabaseCreateRequest(ctx context.Context, func (client *SyncGroupsClient) listByDatabaseHandleResponse(resp *http.Response) (SyncGroupsListByDatabaseResponse, error) { result := SyncGroupsListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SyncGroupListResult); err != nil { - return SyncGroupsListByDatabaseResponse{}, err + return SyncGroupsListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -450,7 +457,7 @@ func (client *SyncGroupsClient) listHubSchemasCreateRequest(ctx context.Context, func (client *SyncGroupsClient) listHubSchemasHandleResponse(resp *http.Response) (SyncGroupsListHubSchemasResponse, error) { result := SyncGroupsListHubSchemasResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SyncFullSchemaPropertiesListResult); err != nil { - return SyncGroupsListHubSchemasResponse{}, err + return SyncGroupsListHubSchemasResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -525,7 +532,7 @@ func (client *SyncGroupsClient) listLogsCreateRequest(ctx context.Context, resou func (client *SyncGroupsClient) listLogsHandleResponse(resp *http.Response) (SyncGroupsListLogsResponse, error) { result := SyncGroupsListLogsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SyncGroupLogListResult); err != nil { - return SyncGroupsListLogsResponse{}, err + return SyncGroupsListLogsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -582,7 +589,7 @@ func (client *SyncGroupsClient) listSyncDatabaseIDsCreateRequest(ctx context.Con func (client *SyncGroupsClient) listSyncDatabaseIDsHandleResponse(resp *http.Response) (SyncGroupsListSyncDatabaseIDsResponse, error) { result := SyncGroupsListSyncDatabaseIDsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SyncDatabaseIDListResult); err != nil { - return SyncGroupsListSyncDatabaseIDsResponse{}, err + return SyncGroupsListSyncDatabaseIDsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_syncmembers_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_syncmembers_client.go index bafc4fdacba1..3cd9d3ac127a 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_syncmembers_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_syncmembers_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SyncMembersClient contains the methods for the SyncMembers group. @@ -30,8 +30,15 @@ type SyncMembersClient struct { } // NewSyncMembersClient creates a new instance of SyncMembersClient with the specified values. -func NewSyncMembersClient(con *arm.Connection, subscriptionID string) *SyncMembersClient { - return &SyncMembersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSyncMembersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SyncMembersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SyncMembersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a sync member. @@ -266,7 +273,7 @@ func (client *SyncMembersClient) getCreateRequest(ctx context.Context, resourceG func (client *SyncMembersClient) getHandleResponse(resp *http.Response) (SyncMembersGetResponse, error) { result := SyncMembersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SyncMember); err != nil { - return SyncMembersGetResponse{}, err + return SyncMembersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -335,7 +342,7 @@ func (client *SyncMembersClient) listBySyncGroupCreateRequest(ctx context.Contex func (client *SyncMembersClient) listBySyncGroupHandleResponse(resp *http.Response) (SyncMembersListBySyncGroupResponse, error) { result := SyncMembersListBySyncGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SyncMemberListResult); err != nil { - return SyncMembersListBySyncGroupResponse{}, err + return SyncMembersListBySyncGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -408,7 +415,7 @@ func (client *SyncMembersClient) listMemberSchemasCreateRequest(ctx context.Cont func (client *SyncMembersClient) listMemberSchemasHandleResponse(resp *http.Response) (SyncMembersListMemberSchemasResponse, error) { result := SyncMembersListMemberSchemasResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SyncFullSchemaPropertiesListResult); err != nil { - return SyncMembersListMemberSchemasResponse{}, err + return SyncMembersListMemberSchemasResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_tdecertificates_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_tdecertificates_client.go index 3af091e4b510..488b71f87b74 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_tdecertificates_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_tdecertificates_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TdeCertificatesClient contains the methods for the TdeCertificates group. @@ -30,8 +30,15 @@ type TdeCertificatesClient struct { } // NewTdeCertificatesClient creates a new instance of TdeCertificatesClient with the specified values. -func NewTdeCertificatesClient(con *arm.Connection, subscriptionID string) *TdeCertificatesClient { - return &TdeCertificatesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTdeCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TdeCertificatesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TdeCertificatesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreate - Creates a TDE certificate for a given server. diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_time_rfc3339.go b/sdk/resourcemanager/sql/armsql/zz_generated_time_rfc3339.go index e9d4281584fb..6eca3099d8a4 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armsql import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_timezones_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_timezones_client.go index 21248f27c7e3..46a14b94ef6b 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_timezones_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_timezones_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TimeZonesClient contains the methods for the TimeZones group. @@ -29,8 +30,15 @@ type TimeZonesClient struct { } // NewTimeZonesClient creates a new instance of TimeZonesClient with the specified values. -func NewTimeZonesClient(con *arm.Connection, subscriptionID string) *TimeZonesClient { - return &TimeZonesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTimeZonesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TimeZonesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TimeZonesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Gets a managed instance time zone. @@ -80,7 +88,7 @@ func (client *TimeZonesClient) getCreateRequest(ctx context.Context, locationNam func (client *TimeZonesClient) getHandleResponse(resp *http.Response) (TimeZonesGetResponse, error) { result := TimeZonesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TimeZone); err != nil { - return TimeZonesGetResponse{}, err + return TimeZonesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -137,7 +145,7 @@ func (client *TimeZonesClient) listByLocationCreateRequest(ctx context.Context, func (client *TimeZonesClient) listByLocationHandleResponse(resp *http.Response) (TimeZonesListByLocationResponse, error) { result := TimeZonesListByLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TimeZoneListResult); err != nil { - return TimeZonesListByLocationResponse{}, err + return TimeZonesListByLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_transparentdataencryptions_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_transparentdataencryptions_client.go index 57546a416462..daccff1877c9 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_transparentdataencryptions_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_transparentdataencryptions_client.go @@ -11,13 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TransparentDataEncryptionsClient contains the methods for the TransparentDataEncryptions group. @@ -29,8 +30,15 @@ type TransparentDataEncryptionsClient struct { } // NewTransparentDataEncryptionsClient creates a new instance of TransparentDataEncryptionsClient with the specified values. -func NewTransparentDataEncryptionsClient(con *arm.Connection, subscriptionID string) *TransparentDataEncryptionsClient { - return &TransparentDataEncryptionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTransparentDataEncryptionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TransparentDataEncryptionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TransparentDataEncryptionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Updates a logical database's transparent data encryption configuration. @@ -88,7 +96,7 @@ func (client *TransparentDataEncryptionsClient) createOrUpdateCreateRequest(ctx func (client *TransparentDataEncryptionsClient) createOrUpdateHandleResponse(resp *http.Response) (TransparentDataEncryptionsCreateOrUpdateResponse, error) { result := TransparentDataEncryptionsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LogicalDatabaseTransparentDataEncryption); err != nil { - return TransparentDataEncryptionsCreateOrUpdateResponse{}, err + return TransparentDataEncryptionsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -160,7 +168,7 @@ func (client *TransparentDataEncryptionsClient) getCreateRequest(ctx context.Con func (client *TransparentDataEncryptionsClient) getHandleResponse(resp *http.Response) (TransparentDataEncryptionsGetResponse, error) { result := TransparentDataEncryptionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LogicalDatabaseTransparentDataEncryption); err != nil { - return TransparentDataEncryptionsGetResponse{}, err + return TransparentDataEncryptionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -225,7 +233,7 @@ func (client *TransparentDataEncryptionsClient) listByDatabaseCreateRequest(ctx func (client *TransparentDataEncryptionsClient) listByDatabaseHandleResponse(resp *http.Response) (TransparentDataEncryptionsListByDatabaseResponse, error) { result := TransparentDataEncryptionsListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LogicalDatabaseTransparentDataEncryptionListResult); err != nil { - return TransparentDataEncryptionsListByDatabaseResponse{}, err + return TransparentDataEncryptionsListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_usages_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_usages_client.go index b3215893b768..8d324ad2653c 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_usages_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_usages_client.go @@ -11,14 +11,15 @@ package armsql import ( "context" "errors" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // UsagesClient contains the methods for the Usages group. @@ -30,8 +31,15 @@ type UsagesClient struct { } // NewUsagesClient creates a new instance of UsagesClient with the specified values. -func NewUsagesClient(con *arm.Connection, subscriptionID string) *UsagesClient { - return &UsagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UsagesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &UsagesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByInstancePool - Gets all instance pool usage metrics @@ -81,7 +89,7 @@ func (client *UsagesClient) listByInstancePoolCreateRequest(ctx context.Context, func (client *UsagesClient) listByInstancePoolHandleResponse(resp *http.Response) (UsagesListByInstancePoolResponse, error) { result := UsagesListByInstancePoolResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UsageListResult); err != nil { - return UsagesListByInstancePoolResponse{}, err + return UsagesListByInstancePoolResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_virtualclusters_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_virtualclusters_client.go index b7caca577032..e9a8004509e3 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_virtualclusters_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_virtualclusters_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualClustersClient contains the methods for the VirtualClusters group. @@ -30,8 +30,15 @@ type VirtualClustersClient struct { } // NewVirtualClustersClient creates a new instance of VirtualClustersClient with the specified values. -func NewVirtualClustersClient(con *arm.Connection, subscriptionID string) *VirtualClustersClient { - return &VirtualClustersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualClustersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualClustersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginDelete - Deletes a virtual cluster. @@ -155,7 +162,7 @@ func (client *VirtualClustersClient) getCreateRequest(ctx context.Context, resou func (client *VirtualClustersClient) getHandleResponse(resp *http.Response) (VirtualClustersGetResponse, error) { result := VirtualClustersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualCluster); err != nil { - return VirtualClustersGetResponse{}, err + return VirtualClustersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -208,7 +215,7 @@ func (client *VirtualClustersClient) listCreateRequest(ctx context.Context, opti func (client *VirtualClustersClient) listHandleResponse(resp *http.Response) (VirtualClustersListResponse, error) { result := VirtualClustersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualClusterListResult); err != nil { - return VirtualClustersListResponse{}, err + return VirtualClustersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -265,7 +272,7 @@ func (client *VirtualClustersClient) listByResourceGroupCreateRequest(ctx contex func (client *VirtualClustersClient) listByResourceGroupHandleResponse(resp *http.Response) (VirtualClustersListByResourceGroupResponse, error) { result := VirtualClustersListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualClusterListResult); err != nil { - return VirtualClustersListByResourceGroupResponse{}, err + return VirtualClustersListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -404,7 +411,7 @@ func (client *VirtualClustersClient) updateDNSServersCreateRequest(ctx context.C func (client *VirtualClustersClient) updateDNSServersHandleResponse(resp *http.Response) (VirtualClustersUpdateDNSServersResponse, error) { result := VirtualClustersUpdateDNSServersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UpdateManagedInstanceDNSServersOperation); err != nil { - return VirtualClustersUpdateDNSServersResponse{}, err + return VirtualClustersUpdateDNSServersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_virtualnetworkrules_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_virtualnetworkrules_client.go index 073606b36cdb..ccb7cfc6e262 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_virtualnetworkrules_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_virtualnetworkrules_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // VirtualNetworkRulesClient contains the methods for the VirtualNetworkRules group. @@ -30,8 +30,15 @@ type VirtualNetworkRulesClient struct { } // NewVirtualNetworkRulesClient creates a new instance of VirtualNetworkRulesClient with the specified values. -func NewVirtualNetworkRulesClient(con *arm.Connection, subscriptionID string) *VirtualNetworkRulesClient { - return &VirtualNetworkRulesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewVirtualNetworkRulesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *VirtualNetworkRulesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &VirtualNetworkRulesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates an existing virtual network rule. @@ -242,7 +249,7 @@ func (client *VirtualNetworkRulesClient) getCreateRequest(ctx context.Context, r func (client *VirtualNetworkRulesClient) getHandleResponse(resp *http.Response) (VirtualNetworkRulesGetResponse, error) { result := VirtualNetworkRulesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkRule); err != nil { - return VirtualNetworkRulesGetResponse{}, err + return VirtualNetworkRulesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -303,7 +310,7 @@ func (client *VirtualNetworkRulesClient) listByServerCreateRequest(ctx context.C func (client *VirtualNetworkRulesClient) listByServerHandleResponse(resp *http.Response) (VirtualNetworkRulesListByServerResponse, error) { result := VirtualNetworkRulesListByServerResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VirtualNetworkRuleListResult); err != nil { - return VirtualNetworkRulesListByServerResponse{}, err + return VirtualNetworkRulesListByServerResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_workloadclassifiers_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_workloadclassifiers_client.go index 4576af1a8690..620332b4efb3 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_workloadclassifiers_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_workloadclassifiers_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // WorkloadClassifiersClient contains the methods for the WorkloadClassifiers group. @@ -30,8 +30,15 @@ type WorkloadClassifiersClient struct { } // NewWorkloadClassifiersClient creates a new instance of WorkloadClassifiersClient with the specified values. -func NewWorkloadClassifiersClient(con *arm.Connection, subscriptionID string) *WorkloadClassifiersClient { - return &WorkloadClassifiersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWorkloadClassifiersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkloadClassifiersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WorkloadClassifiersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a workload classifier. @@ -266,7 +273,7 @@ func (client *WorkloadClassifiersClient) getCreateRequest(ctx context.Context, r func (client *WorkloadClassifiersClient) getHandleResponse(resp *http.Response) (WorkloadClassifiersGetResponse, error) { result := WorkloadClassifiersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkloadClassifier); err != nil { - return WorkloadClassifiersGetResponse{}, err + return WorkloadClassifiersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -335,7 +342,7 @@ func (client *WorkloadClassifiersClient) listByWorkloadGroupCreateRequest(ctx co func (client *WorkloadClassifiersClient) listByWorkloadGroupHandleResponse(resp *http.Response) (WorkloadClassifiersListByWorkloadGroupResponse, error) { result := WorkloadClassifiersListByWorkloadGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkloadClassifierListResult); err != nil { - return WorkloadClassifiersListByWorkloadGroupResponse{}, err + return WorkloadClassifiersListByWorkloadGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/sql/armsql/zz_generated_workloadgroups_client.go b/sdk/resourcemanager/sql/armsql/zz_generated_workloadgroups_client.go index 7cf283bd80f9..a6c2a5847e3c 100644 --- a/sdk/resourcemanager/sql/armsql/zz_generated_workloadgroups_client.go +++ b/sdk/resourcemanager/sql/armsql/zz_generated_workloadgroups_client.go @@ -11,14 +11,14 @@ package armsql import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // WorkloadGroupsClient contains the methods for the WorkloadGroups group. @@ -30,8 +30,15 @@ type WorkloadGroupsClient struct { } // NewWorkloadGroupsClient creates a new instance of WorkloadGroupsClient with the specified values. -func NewWorkloadGroupsClient(con *arm.Connection, subscriptionID string) *WorkloadGroupsClient { - return &WorkloadGroupsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWorkloadGroupsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WorkloadGroupsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WorkloadGroupsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates or updates a workload group. @@ -254,7 +261,7 @@ func (client *WorkloadGroupsClient) getCreateRequest(ctx context.Context, resour func (client *WorkloadGroupsClient) getHandleResponse(resp *http.Response) (WorkloadGroupsGetResponse, error) { result := WorkloadGroupsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkloadGroup); err != nil { - return WorkloadGroupsGetResponse{}, err + return WorkloadGroupsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -319,7 +326,7 @@ func (client *WorkloadGroupsClient) listByDatabaseCreateRequest(ctx context.Cont func (client *WorkloadGroupsClient) listByDatabaseHandleResponse(resp *http.Response) (WorkloadGroupsListByDatabaseResponse, error) { result := WorkloadGroupsListByDatabaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkloadGroupListResult); err != nil { - return WorkloadGroupsListByDatabaseResponse{}, err + return WorkloadGroupsListByDatabaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/storage/armstorage/CHANGELOG.md b/sdk/resourcemanager/storage/armstorage/CHANGELOG.md index eff39baed6a8..91ff781351a8 100644 --- a/sdk/resourcemanager/storage/armstorage/CHANGELOG.md +++ b/sdk/resourcemanager/storage/armstorage/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-09-29) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/storage/armstorage") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/storage/armstorage/README.md b/sdk/resourcemanager/storage/armstorage/README.md index 554e6e9ab441..e2240ca4f724 100644 --- a/sdk/resourcemanager/storage/armstorage/README.md +++ b/sdk/resourcemanager/storage/armstorage/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Storage +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Storage modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armstorage.NewFileSharesClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Storage modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armstorage.NewFileSharesClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armstorage.NewFileSharesClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/storage/armstorage/autorest.md b/sdk/resourcemanager/storage/armstorage/autorest.md index 67e894aa3990..e05ce6e6a87b 100644 --- a/sdk/resourcemanager/storage/armstorage/autorest.md +++ b/sdk/resourcemanager/storage/armstorage/autorest.md @@ -5,10 +5,10 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/7919a8694f46cea4259ea5b62b1e797573175e16/specification/storage/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/7919a8694f46cea4259ea5b62b1e797573175e16/specification/storage/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/storage/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/storage/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 modelerfour: seal-single-value-enum-by-default: true ``` \ No newline at end of file diff --git a/sdk/resourcemanager/storage/armstorage/example_blobcontainers_test.go b/sdk/resourcemanager/storage/armstorage/example_blobcontainers_test.go index 0f8e5e914d35..2cace8498351 100644 --- a/sdk/resourcemanager/storage/armstorage/example_blobcontainers_test.go +++ b/sdk/resourcemanager/storage/armstorage/example_blobcontainers_test.go @@ -10,7 +10,6 @@ import ( "context" "log" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) @@ -20,7 +19,7 @@ func ExampleBlobContainersClient_Create() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armstorage.NewBlobContainersClient(arm.NewDefaultConnection(cred, nil), "") + client := armstorage.NewBlobContainersClient("", cred, nil) resp, err := client.Create( context.Background(), "", @@ -38,7 +37,7 @@ func ExampleBlobContainersClient_Get() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armstorage.NewBlobContainersClient(arm.NewDefaultConnection(cred, nil), "") + client := armstorage.NewBlobContainersClient("", cred, nil) resp, err := client.Get( context.Background(), "", @@ -55,7 +54,7 @@ func ExampleBlobContainersClient_List() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armstorage.NewBlobContainersClient(arm.NewDefaultConnection(cred, nil), "") + client := armstorage.NewBlobContainersClient("", cred, nil) pager := client.List("", "", nil) for pager.NextPage(context.Background()) { resp := pager.PageResponse() @@ -76,7 +75,7 @@ func ExampleBlobContainersClient_Delete() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armstorage.NewBlobContainersClient(arm.NewDefaultConnection(cred, nil), "") + client := armstorage.NewBlobContainersClient("", cred, nil) _, err = client.Delete( context.Background(), "", diff --git a/sdk/resourcemanager/storage/armstorage/example_storageaccounts_test.go b/sdk/resourcemanager/storage/armstorage/example_storageaccounts_test.go index 81c73af8a2c9..1c7b14110ef1 100644 --- a/sdk/resourcemanager/storage/armstorage/example_storageaccounts_test.go +++ b/sdk/resourcemanager/storage/armstorage/example_storageaccounts_test.go @@ -11,7 +11,6 @@ import ( "log" "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azcore/to" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" @@ -22,7 +21,7 @@ func ExampleStorageAccountsClient_BeginCreate() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armstorage.NewStorageAccountsClient(arm.NewDefaultConnection(cred, nil), "") + client := armstorage.NewStorageAccountsClient("", cred, nil) poller, err := client.BeginCreate( context.Background(), "", @@ -53,7 +52,7 @@ func ExampleStorageAccountsClient_List() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armstorage.NewStorageAccountsClient(arm.NewDefaultConnection(cred, nil), "") + client := armstorage.NewStorageAccountsClient("", cred, nil) pager := client.List(nil) for pager.NextPage(context.Background()) { resp := pager.PageResponse() @@ -74,7 +73,7 @@ func ExampleStorageAccountsClient_ListByResourceGroup() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armstorage.NewStorageAccountsClient(arm.NewDefaultConnection(cred, nil), "") + client := armstorage.NewStorageAccountsClient("", cred, nil) pager := client.ListByResourceGroup("", nil) for pager.NextPage(context.Background()) { resp := pager.PageResponse() @@ -95,7 +94,7 @@ func ExampleStorageAccountsClient_CheckNameAvailability() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armstorage.NewStorageAccountsClient(arm.NewDefaultConnection(cred, nil), "") + client := armstorage.NewStorageAccountsClient("", cred, nil) resp, err := client.CheckNameAvailability( context.Background(), armstorage.StorageAccountCheckNameAvailabilityParameters{ @@ -114,7 +113,7 @@ func ExampleStorageAccountsClient_ListKeys() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armstorage.NewStorageAccountsClient(arm.NewDefaultConnection(cred, nil), "") + client := armstorage.NewStorageAccountsClient("", cred, nil) resp, err := client.ListKeys(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to delete account: %v", err) @@ -129,7 +128,7 @@ func ExampleStorageAccountsClient_GetProperties() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armstorage.NewStorageAccountsClient(arm.NewDefaultConnection(cred, nil), "") + client := armstorage.NewStorageAccountsClient("", cred, nil) resp, err := client.GetProperties(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to delete account: %v", err) @@ -142,7 +141,7 @@ func ExampleStorageAccountsClient_RegenerateKey() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armstorage.NewStorageAccountsClient(arm.NewDefaultConnection(cred, nil), "") + client := armstorage.NewStorageAccountsClient("", cred, nil) resp, err := client.RegenerateKey(context.Background(), "", "", armstorage.StorageAccountRegenerateKeyParameters{KeyName: to.StringPtr("")}, nil) if err != nil { log.Fatalf("failed to delete account: %v", err) @@ -157,7 +156,7 @@ func ExampleStorageAccountsClient_Update() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armstorage.NewStorageAccountsClient(arm.NewDefaultConnection(cred, nil), "") + client := armstorage.NewStorageAccountsClient("", cred, nil) resp, err := client.Update( context.Background(), "", @@ -176,7 +175,7 @@ func ExampleStorageAccountsClient_Delete() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armstorage.NewStorageAccountsClient(arm.NewDefaultConnection(cred, nil), "") + client := armstorage.NewStorageAccountsClient("", cred, nil) _, err = client.Delete(context.Background(), "", "", nil) if err != nil { log.Fatalf("failed to delete account: %v", err) diff --git a/sdk/resourcemanager/storage/armstorage/example_usage_test.go b/sdk/resourcemanager/storage/armstorage/example_usage_test.go index 974874b1302a..13e2797209a7 100644 --- a/sdk/resourcemanager/storage/armstorage/example_usage_test.go +++ b/sdk/resourcemanager/storage/armstorage/example_usage_test.go @@ -10,7 +10,6 @@ import ( "context" "log" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" "github.com/Azure/azure-sdk-for-go/sdk/azidentity" "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage" ) @@ -20,7 +19,7 @@ func ExampleUsagesClient_ListByLocation() { if err != nil { log.Fatalf("failed to obtain a credential: %v", err) } - client := armstorage.NewUsagesClient(arm.NewDefaultConnection(cred, nil), "") + client := armstorage.NewUsagesClient("", cred, nil) resp, err := client.ListByLocation(context.Background(), "", nil) if err != nil { log.Fatalf("failed to delete account: %v", err) diff --git a/sdk/resourcemanager/storage/armstorage/go.mod b/sdk/resourcemanager/storage/armstorage/go.mod index a1f16af652fb..c77c745056f6 100644 --- a/sdk/resourcemanager/storage/armstorage/go.mod +++ b/sdk/resourcemanager/storage/armstorage/go.mod @@ -3,7 +3,9 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/storage/armstorage go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.1.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0 ) + +replace github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0 => ../../../azidentity diff --git a/sdk/resourcemanager/storage/armstorage/go.sum b/sdk/resourcemanager/storage/armstorage/go.sum index c0f8422a0531..0a36ef05b718 100644 --- a/sdk/resourcemanager/storage/armstorage/go.sum +++ b/sdk/resourcemanager/storage/armstorage/go.sum @@ -1,15 +1,13 @@ -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible h1:WFsr3Efy7uweykOAEfOHO3ACtuwIv+rrFmSn9K48VnA= -github.com/Azure/azure-sdk-for-go v58.1.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0 h1:OYa9vmRX2XC5GXRAzeggG12sF/z5D9Ahtdm9EJ00WN4= -github.com/Azure/azure-sdk-for-go/sdk/azidentity v0.11.0/go.mod h1:HcM1YX14R7CJcghJGOYCgdezslRSVzqwLf/q+4Y2r/0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 h1:49lOXmGaUpV9Fz3gd7TFZY106KVlPVa5jcYD1gaQf98= github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4/go.mod h1:4OwLy04Bl9Ef3GJJCoec+30X3LQs/0/m4HFRt/2LUSA= @@ -19,22 +17,26 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+ github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897 h1:pLI5jrR7OSLijeIDcmRxNmw2api+jEfxLoykJVice/E= golang.org/x/crypto v0.0.0-20201016220609-9e8e0b390897/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_blobcontainers_client.go b/sdk/resourcemanager/storage/armstorage/zz_generated_blobcontainers_client.go index dff129bd6031..6086a67215a8 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_blobcontainers_client.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_blobcontainers_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // BlobContainersClient contains the methods for the BlobContainers group. @@ -31,8 +31,15 @@ type BlobContainersClient struct { } // NewBlobContainersClient creates a new instance of BlobContainersClient with the specified values. -func NewBlobContainersClient(con *arm.Connection, subscriptionID string) *BlobContainersClient { - return &BlobContainersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewBlobContainersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *BlobContainersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &BlobContainersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ClearLegalHold - Clears legal hold tags. Clearing the same or non-existent tag results in an idempotent operation. ClearLegalHold clears out only the @@ -87,7 +94,7 @@ func (client *BlobContainersClient) clearLegalHoldCreateRequest(ctx context.Cont func (client *BlobContainersClient) clearLegalHoldHandleResponse(resp *http.Response) (BlobContainersClearLegalHoldResponse, error) { result := BlobContainersClearLegalHoldResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LegalHold); err != nil { - return BlobContainersClearLegalHoldResponse{}, err + return BlobContainersClearLegalHoldResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -157,7 +164,7 @@ func (client *BlobContainersClient) createCreateRequest(ctx context.Context, res func (client *BlobContainersClient) createHandleResponse(resp *http.Response) (BlobContainersCreateResponse, error) { result := BlobContainersCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BlobContainer); err != nil { - return BlobContainersCreateResponse{}, err + return BlobContainersCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -236,7 +243,7 @@ func (client *BlobContainersClient) createOrUpdateImmutabilityPolicyHandleRespon result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ImmutabilityPolicy); err != nil { - return BlobContainersCreateOrUpdateImmutabilityPolicyResponse{}, err + return BlobContainersCreateOrUpdateImmutabilityPolicyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -369,7 +376,7 @@ func (client *BlobContainersClient) deleteImmutabilityPolicyHandleResponse(resp result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ImmutabilityPolicy); err != nil { - return BlobContainersDeleteImmutabilityPolicyResponse{}, err + return BlobContainersDeleteImmutabilityPolicyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -445,7 +452,7 @@ func (client *BlobContainersClient) extendImmutabilityPolicyHandleResponse(resp result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ImmutabilityPolicy); err != nil { - return BlobContainersExtendImmutabilityPolicyResponse{}, err + return BlobContainersExtendImmutabilityPolicyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -513,7 +520,7 @@ func (client *BlobContainersClient) getCreateRequest(ctx context.Context, resour func (client *BlobContainersClient) getHandleResponse(resp *http.Response) (BlobContainersGetResponse, error) { result := BlobContainersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BlobContainer); err != nil { - return BlobContainersGetResponse{}, err + return BlobContainersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -588,7 +595,7 @@ func (client *BlobContainersClient) getImmutabilityPolicyHandleResponse(resp *ht result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ImmutabilityPolicy); err != nil { - return BlobContainersGetImmutabilityPolicyResponse{}, err + return BlobContainersGetImmutabilityPolicyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -660,7 +667,7 @@ func (client *BlobContainersClient) leaseCreateRequest(ctx context.Context, reso func (client *BlobContainersClient) leaseHandleResponse(resp *http.Response) (BlobContainersLeaseResponse, error) { result := BlobContainersLeaseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LeaseContainerResponse); err != nil { - return BlobContainersLeaseResponse{}, err + return BlobContainersLeaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -730,7 +737,7 @@ func (client *BlobContainersClient) listCreateRequest(ctx context.Context, resou func (client *BlobContainersClient) listHandleResponse(resp *http.Response) (BlobContainersListResponse, error) { result := BlobContainersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListContainerItems); err != nil { - return BlobContainersListResponse{}, err + return BlobContainersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -803,7 +810,7 @@ func (client *BlobContainersClient) lockImmutabilityPolicyHandleResponse(resp *h result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.ImmutabilityPolicy); err != nil { - return BlobContainersLockImmutabilityPolicyResponse{}, err + return BlobContainersLockImmutabilityPolicyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -956,7 +963,7 @@ func (client *BlobContainersClient) setLegalHoldCreateRequest(ctx context.Contex func (client *BlobContainersClient) setLegalHoldHandleResponse(resp *http.Response) (BlobContainersSetLegalHoldResponse, error) { result := BlobContainersSetLegalHoldResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.LegalHold); err != nil { - return BlobContainersSetLegalHoldResponse{}, err + return BlobContainersSetLegalHoldResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1025,7 +1032,7 @@ func (client *BlobContainersClient) updateCreateRequest(ctx context.Context, res func (client *BlobContainersClient) updateHandleResponse(resp *http.Response) (BlobContainersUpdateResponse, error) { result := BlobContainersUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BlobContainer); err != nil { - return BlobContainersUpdateResponse{}, err + return BlobContainersUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_blobinventorypolicies_client.go b/sdk/resourcemanager/storage/armstorage/zz_generated_blobinventorypolicies_client.go index 57d2a05435f5..df0f4c8c9b0f 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_blobinventorypolicies_client.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_blobinventorypolicies_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // BlobInventoryPoliciesClient contains the methods for the BlobInventoryPolicies group. @@ -30,8 +31,15 @@ type BlobInventoryPoliciesClient struct { } // NewBlobInventoryPoliciesClient creates a new instance of BlobInventoryPoliciesClient with the specified values. -func NewBlobInventoryPoliciesClient(con *arm.Connection, subscriptionID string) *BlobInventoryPoliciesClient { - return &BlobInventoryPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewBlobInventoryPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *BlobInventoryPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &BlobInventoryPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Sets the blob inventory policy to the specified storage account. @@ -85,7 +93,7 @@ func (client *BlobInventoryPoliciesClient) createOrUpdateCreateRequest(ctx conte func (client *BlobInventoryPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (BlobInventoryPoliciesCreateOrUpdateResponse, error) { result := BlobInventoryPoliciesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BlobInventoryPolicy); err != nil { - return BlobInventoryPoliciesCreateOrUpdateResponse{}, err + return BlobInventoryPoliciesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *BlobInventoryPoliciesClient) getCreateRequest(ctx context.Context, func (client *BlobInventoryPoliciesClient) getHandleResponse(resp *http.Response) (BlobInventoryPoliciesGetResponse, error) { result := BlobInventoryPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BlobInventoryPolicy); err != nil { - return BlobInventoryPoliciesGetResponse{}, err + return BlobInventoryPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -279,7 +287,7 @@ func (client *BlobInventoryPoliciesClient) listCreateRequest(ctx context.Context func (client *BlobInventoryPoliciesClient) listHandleResponse(resp *http.Response) (BlobInventoryPoliciesListResponse, error) { result := BlobInventoryPoliciesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListBlobInventoryPolicy); err != nil { - return BlobInventoryPoliciesListResponse{}, err + return BlobInventoryPoliciesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_blobservices_client.go b/sdk/resourcemanager/storage/armstorage/zz_generated_blobservices_client.go index cfba6e7982cf..a9e3760e15f5 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_blobservices_client.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_blobservices_client.go @@ -11,13 +11,14 @@ package armstorage import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // BlobServicesClient contains the methods for the BlobServices group. @@ -29,8 +30,15 @@ type BlobServicesClient struct { } // NewBlobServicesClient creates a new instance of BlobServicesClient with the specified values. -func NewBlobServicesClient(con *arm.Connection, subscriptionID string) *BlobServicesClient { - return &BlobServicesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewBlobServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *BlobServicesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &BlobServicesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetServiceProperties - Gets the properties of a storage account’s Blob service, including properties for Storage Analytics and CORS (Cross-Origin Resource @@ -82,7 +90,7 @@ func (client *BlobServicesClient) getServicePropertiesCreateRequest(ctx context. func (client *BlobServicesClient) getServicePropertiesHandleResponse(resp *http.Response) (BlobServicesGetServicePropertiesResponse, error) { result := BlobServicesGetServicePropertiesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BlobServiceProperties); err != nil { - return BlobServicesGetServicePropertiesResponse{}, err + return BlobServicesGetServicePropertiesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -146,7 +154,7 @@ func (client *BlobServicesClient) listCreateRequest(ctx context.Context, resourc func (client *BlobServicesClient) listHandleResponse(resp *http.Response) (BlobServicesListResponse, error) { result := BlobServicesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BlobServiceItems); err != nil { - return BlobServicesListResponse{}, err + return BlobServicesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -212,7 +220,7 @@ func (client *BlobServicesClient) setServicePropertiesCreateRequest(ctx context. func (client *BlobServicesClient) setServicePropertiesHandleResponse(resp *http.Response) (BlobServicesSetServicePropertiesResponse, error) { result := BlobServicesSetServicePropertiesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BlobServiceProperties); err != nil { - return BlobServicesSetServicePropertiesResponse{}, err + return BlobServicesSetServicePropertiesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_constants.go b/sdk/resourcemanager/storage/armstorage/zz_generated_constants.go index 6ced1ff8ce21..ce4d4286b442 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_constants.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_constants.go @@ -10,7 +10,7 @@ package armstorage const ( module = "armstorage" - version = "v0.1.0" + version = "v0.2.0" ) // AccessTier - Required for storage accounts where kind = BlobStorage. The access tier used for billing. diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_deletedaccounts_client.go b/sdk/resourcemanager/storage/armstorage/zz_generated_deletedaccounts_client.go index 26baa92251ff..352a3188c793 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_deletedaccounts_client.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_deletedaccounts_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DeletedAccountsClient contains the methods for the DeletedAccounts group. @@ -30,8 +31,15 @@ type DeletedAccountsClient struct { } // NewDeletedAccountsClient creates a new instance of DeletedAccountsClient with the specified values. -func NewDeletedAccountsClient(con *arm.Connection, subscriptionID string) *DeletedAccountsClient { - return &DeletedAccountsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDeletedAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DeletedAccountsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DeletedAccountsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Get properties of specified deleted account resource. @@ -81,7 +89,7 @@ func (client *DeletedAccountsClient) getCreateRequest(ctx context.Context, delet func (client *DeletedAccountsClient) getHandleResponse(resp *http.Response) (DeletedAccountsGetResponse, error) { result := DeletedAccountsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeletedAccount); err != nil { - return DeletedAccountsGetResponse{}, err + return DeletedAccountsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -135,7 +143,7 @@ func (client *DeletedAccountsClient) listCreateRequest(ctx context.Context, opti func (client *DeletedAccountsClient) listHandleResponse(resp *http.Response) (DeletedAccountsListResponse, error) { result := DeletedAccountsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeletedAccountListResult); err != nil { - return DeletedAccountsListResponse{}, err + return DeletedAccountsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_encryptionscopes_client.go b/sdk/resourcemanager/storage/armstorage/zz_generated_encryptionscopes_client.go index 32bd3c872174..7cbbfcc0f469 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_encryptionscopes_client.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_encryptionscopes_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // EncryptionScopesClient contains the methods for the EncryptionScopes group. @@ -30,8 +31,15 @@ type EncryptionScopesClient struct { } // NewEncryptionScopesClient creates a new instance of EncryptionScopesClient with the specified values. -func NewEncryptionScopesClient(con *arm.Connection, subscriptionID string) *EncryptionScopesClient { - return &EncryptionScopesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewEncryptionScopesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *EncryptionScopesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &EncryptionScopesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Returns the properties for the specified encryption scope. @@ -85,7 +93,7 @@ func (client *EncryptionScopesClient) getCreateRequest(ctx context.Context, reso func (client *EncryptionScopesClient) getHandleResponse(resp *http.Response) (EncryptionScopesGetResponse, error) { result := EncryptionScopesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionScope); err != nil { - return EncryptionScopesGetResponse{}, err + return EncryptionScopesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -147,7 +155,7 @@ func (client *EncryptionScopesClient) listCreateRequest(ctx context.Context, res func (client *EncryptionScopesClient) listHandleResponse(resp *http.Response) (EncryptionScopesListResponse, error) { result := EncryptionScopesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionScopeListResult); err != nil { - return EncryptionScopesListResponse{}, err + return EncryptionScopesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -215,7 +223,7 @@ func (client *EncryptionScopesClient) patchCreateRequest(ctx context.Context, re func (client *EncryptionScopesClient) patchHandleResponse(resp *http.Response) (EncryptionScopesPatchResponse, error) { result := EncryptionScopesPatchResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionScope); err != nil { - return EncryptionScopesPatchResponse{}, err + return EncryptionScopesPatchResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -286,7 +294,7 @@ func (client *EncryptionScopesClient) putCreateRequest(ctx context.Context, reso func (client *EncryptionScopesClient) putHandleResponse(resp *http.Response) (EncryptionScopesPutResponse, error) { result := EncryptionScopesPutResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.EncryptionScope); err != nil { - return EncryptionScopesPutResponse{}, err + return EncryptionScopesPutResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_fileservices_client.go b/sdk/resourcemanager/storage/armstorage/zz_generated_fileservices_client.go index 0dbc93848fbc..f30d9e3332fd 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_fileservices_client.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_fileservices_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // FileServicesClient contains the methods for the FileServices group. @@ -30,8 +31,15 @@ type FileServicesClient struct { } // NewFileServicesClient creates a new instance of FileServicesClient with the specified values. -func NewFileServicesClient(con *arm.Connection, subscriptionID string) *FileServicesClient { - return &FileServicesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewFileServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FileServicesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FileServicesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetServiceProperties - Gets the properties of file services in storage accounts, including CORS (Cross-Origin Resource Sharing) rules. @@ -82,7 +90,7 @@ func (client *FileServicesClient) getServicePropertiesCreateRequest(ctx context. func (client *FileServicesClient) getServicePropertiesHandleResponse(resp *http.Response) (FileServicesGetServicePropertiesResponse, error) { result := FileServicesGetServicePropertiesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FileServiceProperties); err != nil { - return FileServicesGetServicePropertiesResponse{}, err + return FileServicesGetServicePropertiesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -147,7 +155,7 @@ func (client *FileServicesClient) listCreateRequest(ctx context.Context, resourc func (client *FileServicesClient) listHandleResponse(resp *http.Response) (FileServicesListResponse, error) { result := FileServicesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FileServiceItems); err != nil { - return FileServicesListResponse{}, err + return FileServicesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -213,7 +221,7 @@ func (client *FileServicesClient) setServicePropertiesCreateRequest(ctx context. func (client *FileServicesClient) setServicePropertiesHandleResponse(resp *http.Response) (FileServicesSetServicePropertiesResponse, error) { result := FileServicesSetServicePropertiesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FileServiceProperties); err != nil { - return FileServicesSetServicePropertiesResponse{}, err + return FileServicesSetServicePropertiesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_fileshares_client.go b/sdk/resourcemanager/storage/armstorage/zz_generated_fileshares_client.go index 1a0c30891d31..33c6ee38524c 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_fileshares_client.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_fileshares_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // FileSharesClient contains the methods for the FileShares group. @@ -30,8 +31,15 @@ type FileSharesClient struct { } // NewFileSharesClient creates a new instance of FileSharesClient with the specified values. -func NewFileSharesClient(con *arm.Connection, subscriptionID string) *FileSharesClient { - return &FileSharesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewFileSharesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FileSharesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FileSharesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Creates a new share under the specified account as described by request body. The share resource includes metadata and properties for that share. @@ -90,7 +98,7 @@ func (client *FileSharesClient) createCreateRequest(ctx context.Context, resourc func (client *FileSharesClient) createHandleResponse(resp *http.Response) (FileSharesCreateResponse, error) { result := FileSharesCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FileShare); err != nil { - return FileSharesCreateResponse{}, err + return FileSharesCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -231,7 +239,7 @@ func (client *FileSharesClient) getCreateRequest(ctx context.Context, resourceGr func (client *FileSharesClient) getHandleResponse(resp *http.Response) (FileSharesGetResponse, error) { result := FileSharesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FileShare); err != nil { - return FileSharesGetResponse{}, err + return FileSharesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -310,7 +318,7 @@ func (client *FileSharesClient) leaseHandleResponse(resp *http.Response) (FileSh result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.LeaseShareResponse); err != nil { - return FileSharesLeaseResponse{}, err + return FileSharesLeaseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -381,7 +389,7 @@ func (client *FileSharesClient) listCreateRequest(ctx context.Context, resourceG func (client *FileSharesClient) listHandleResponse(resp *http.Response) (FileSharesListResponse, error) { result := FileSharesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FileShareItems); err != nil { - return FileSharesListResponse{}, err + return FileSharesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -511,7 +519,7 @@ func (client *FileSharesClient) updateCreateRequest(ctx context.Context, resourc func (client *FileSharesClient) updateHandleResponse(resp *http.Response) (FileSharesUpdateResponse, error) { result := FileSharesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FileShare); err != nil { - return FileSharesUpdateResponse{}, err + return FileSharesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_managementpolicies_client.go b/sdk/resourcemanager/storage/armstorage/zz_generated_managementpolicies_client.go index e8625300518c..5a232baf57e7 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_managementpolicies_client.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_managementpolicies_client.go @@ -11,13 +11,14 @@ package armstorage import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ManagementPoliciesClient contains the methods for the ManagementPolicies group. @@ -29,8 +30,15 @@ type ManagementPoliciesClient struct { } // NewManagementPoliciesClient creates a new instance of ManagementPoliciesClient with the specified values. -func NewManagementPoliciesClient(con *arm.Connection, subscriptionID string) *ManagementPoliciesClient { - return &ManagementPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewManagementPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ManagementPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ManagementPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Sets the managementpolicy to the specified storage account. @@ -84,7 +92,7 @@ func (client *ManagementPoliciesClient) createOrUpdateCreateRequest(ctx context. func (client *ManagementPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (ManagementPoliciesCreateOrUpdateResponse, error) { result := ManagementPoliciesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagementPolicy); err != nil { - return ManagementPoliciesCreateOrUpdateResponse{}, err + return ManagementPoliciesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -210,7 +218,7 @@ func (client *ManagementPoliciesClient) getCreateRequest(ctx context.Context, re func (client *ManagementPoliciesClient) getHandleResponse(resp *http.Response) (ManagementPoliciesGetResponse, error) { result := ManagementPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ManagementPolicy); err != nil { - return ManagementPoliciesGetResponse{}, err + return ManagementPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_models.go b/sdk/resourcemanager/storage/armstorage/zz_generated_models.go index eb40caea2938..d19375d4a967 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_models.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_models.go @@ -10,10 +10,9 @@ package armstorage import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) type AccessPolicy struct { @@ -30,9 +29,9 @@ type AccessPolicy struct { // MarshalJSON implements the json.Marshaller interface for type AccessPolicy. func (a AccessPolicy) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "expiryTime", (*timeRFC3339)(a.ExpiryTime)) + populateTimeRFC3339(objectMap, "expiryTime", a.ExpiryTime) populate(objectMap, "permission", a.Permission) - populate(objectMap, "startTime", (*timeRFC3339)(a.StartTime)) + populateTimeRFC3339(objectMap, "startTime", a.StartTime) return json.Marshal(objectMap) } @@ -46,17 +45,13 @@ func (a *AccessPolicy) UnmarshalJSON(data []byte) error { var err error switch key { case "expiryTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.ExpiryTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.ExpiryTime) delete(rawMsg, key) case "permission": err = unpopulate(val, &a.Permission) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.StartTime) delete(rawMsg, key) } if err != nil { @@ -123,8 +118,8 @@ func (a AccountSasParameters) MarshalJSON() ([]byte, error) { populate(objectMap, "signedProtocol", a.Protocols) populate(objectMap, "signedResourceTypes", a.ResourceTypes) populate(objectMap, "signedServices", a.Services) - populate(objectMap, "signedExpiry", (*timeRFC3339)(a.SharedAccessExpiryTime)) - populate(objectMap, "signedStart", (*timeRFC3339)(a.SharedAccessStartTime)) + populateTimeRFC3339(objectMap, "signedExpiry", a.SharedAccessExpiryTime) + populateTimeRFC3339(objectMap, "signedStart", a.SharedAccessStartTime) return json.Marshal(objectMap) } @@ -156,14 +151,10 @@ func (a *AccountSasParameters) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.Services) delete(rawMsg, key) case "signedExpiry": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.SharedAccessExpiryTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.SharedAccessExpiryTime) delete(rawMsg, key) case "signedStart": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.SharedAccessStartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.SharedAccessStartTime) delete(rawMsg, key) } if err != nil { @@ -443,7 +434,7 @@ type BlobInventoryPolicyProperties struct { // MarshalJSON implements the json.Marshaller interface for type BlobInventoryPolicyProperties. func (b BlobInventoryPolicyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(b.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", b.LastModifiedTime) populate(objectMap, "policy", b.Policy) return json.Marshal(objectMap) } @@ -458,9 +449,7 @@ func (b *BlobInventoryPolicyProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - b.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &b.LastModifiedTime) delete(rawMsg, key) case "policy": err = unpopulate(val, &b.Policy) @@ -522,7 +511,7 @@ type BlobRestoreParameters struct { func (b BlobRestoreParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "blobRanges", b.BlobRanges) - populate(objectMap, "timeToRestore", (*timeRFC3339)(b.TimeToRestore)) + populateTimeRFC3339(objectMap, "timeToRestore", b.TimeToRestore) return json.Marshal(objectMap) } @@ -539,9 +528,7 @@ func (b *BlobRestoreParameters) UnmarshalJSON(data []byte) error { err = unpopulate(val, &b.BlobRanges) delete(rawMsg, key) case "timeToRestore": - var aux timeRFC3339 - err = unpopulate(val, &aux) - b.TimeToRestore = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &b.TimeToRestore) delete(rawMsg, key) } if err != nil { @@ -828,7 +815,7 @@ func (c ContainerProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "defaultEncryptionScope", c.DefaultEncryptionScope) populate(objectMap, "deleted", c.Deleted) - populate(objectMap, "deletedTime", (*timeRFC3339)(c.DeletedTime)) + populateTimeRFC3339(objectMap, "deletedTime", c.DeletedTime) populate(objectMap, "denyEncryptionScopeOverride", c.DenyEncryptionScopeOverride) populate(objectMap, "enableNfsV3AllSquash", c.EnableNfsV3AllSquash) populate(objectMap, "enableNfsV3RootSquash", c.EnableNfsV3RootSquash) @@ -836,7 +823,7 @@ func (c ContainerProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "hasLegalHold", c.HasLegalHold) populate(objectMap, "immutabilityPolicy", c.ImmutabilityPolicy) populate(objectMap, "immutableStorageWithVersioning", c.ImmutableStorageWithVersioning) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(c.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", c.LastModifiedTime) populate(objectMap, "leaseDuration", c.LeaseDuration) populate(objectMap, "leaseState", c.LeaseState) populate(objectMap, "leaseStatus", c.LeaseStatus) @@ -864,9 +851,7 @@ func (c *ContainerProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.Deleted) delete(rawMsg, key) case "deletedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.DeletedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.DeletedTime) delete(rawMsg, key) case "denyEncryptionScopeOverride": err = unpopulate(val, &c.DenyEncryptionScopeOverride) @@ -890,9 +875,7 @@ func (c *ContainerProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.ImmutableStorageWithVersioning) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.LastModifiedTime) delete(rawMsg, key) case "leaseDuration": err = unpopulate(val, &c.LeaseDuration) @@ -1139,7 +1122,7 @@ func (e EncryptionScopeKeyVaultProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "currentVersionedKeyIdentifier", e.CurrentVersionedKeyIdentifier) populate(objectMap, "keyUri", e.KeyURI) - populate(objectMap, "lastKeyRotationTimestamp", (*timeRFC3339)(e.LastKeyRotationTimestamp)) + populateTimeRFC3339(objectMap, "lastKeyRotationTimestamp", e.LastKeyRotationTimestamp) return json.Marshal(objectMap) } @@ -1159,9 +1142,7 @@ func (e *EncryptionScopeKeyVaultProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.KeyURI) delete(rawMsg, key) case "lastKeyRotationTimestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.LastKeyRotationTimestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.LastKeyRotationTimestamp) delete(rawMsg, key) } if err != nil { @@ -1213,9 +1194,9 @@ type EncryptionScopeProperties struct { // MarshalJSON implements the json.Marshaller interface for type EncryptionScopeProperties. func (e EncryptionScopeProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(e.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", e.CreationTime) populate(objectMap, "keyVaultProperties", e.KeyVaultProperties) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(e.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", e.LastModifiedTime) populate(objectMap, "requireInfrastructureEncryption", e.RequireInfrastructureEncryption) populate(objectMap, "source", e.Source) populate(objectMap, "state", e.State) @@ -1232,17 +1213,13 @@ func (e *EncryptionScopeProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.CreationTime) delete(rawMsg, key) case "keyVaultProperties": err = unpopulate(val, &e.KeyVaultProperties) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.LastModifiedTime) delete(rawMsg, key) case "requireInfrastructureEncryption": err = unpopulate(val, &e.RequireInfrastructureEncryption) @@ -1301,7 +1278,7 @@ func (e EncryptionService) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "enabled", e.Enabled) populate(objectMap, "keyType", e.KeyType) - populate(objectMap, "lastEnabledTime", (*timeRFC3339)(e.LastEnabledTime)) + populateTimeRFC3339(objectMap, "lastEnabledTime", e.LastEnabledTime) return json.Marshal(objectMap) } @@ -1321,9 +1298,7 @@ func (e *EncryptionService) UnmarshalJSON(data []byte) error { err = unpopulate(val, &e.KeyType) delete(rawMsg, key) case "lastEnabledTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - e.LastEnabledTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &e.LastEnabledTime) delete(rawMsg, key) } if err != nil { @@ -1576,12 +1551,12 @@ type FileShareProperties struct { func (f FileShareProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "accessTier", f.AccessTier) - populate(objectMap, "accessTierChangeTime", (*timeRFC3339)(f.AccessTierChangeTime)) + populateTimeRFC3339(objectMap, "accessTierChangeTime", f.AccessTierChangeTime) populate(objectMap, "accessTierStatus", f.AccessTierStatus) populate(objectMap, "deleted", f.Deleted) - populate(objectMap, "deletedTime", (*timeRFC3339)(f.DeletedTime)) + populateTimeRFC3339(objectMap, "deletedTime", f.DeletedTime) populate(objectMap, "enabledProtocols", f.EnabledProtocols) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(f.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", f.LastModifiedTime) populate(objectMap, "leaseDuration", f.LeaseDuration) populate(objectMap, "leaseState", f.LeaseState) populate(objectMap, "leaseStatus", f.LeaseStatus) @@ -1591,7 +1566,7 @@ func (f FileShareProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "shareQuota", f.ShareQuota) populate(objectMap, "shareUsageBytes", f.ShareUsageBytes) populate(objectMap, "signedIdentifiers", f.SignedIdentifiers) - populate(objectMap, "snapshotTime", (*timeRFC3339)(f.SnapshotTime)) + populateTimeRFC3339(objectMap, "snapshotTime", f.SnapshotTime) populate(objectMap, "version", f.Version) return json.Marshal(objectMap) } @@ -1609,9 +1584,7 @@ func (f *FileShareProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &f.AccessTier) delete(rawMsg, key) case "accessTierChangeTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - f.AccessTierChangeTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &f.AccessTierChangeTime) delete(rawMsg, key) case "accessTierStatus": err = unpopulate(val, &f.AccessTierStatus) @@ -1620,17 +1593,13 @@ func (f *FileShareProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &f.Deleted) delete(rawMsg, key) case "deletedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - f.DeletedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &f.DeletedTime) delete(rawMsg, key) case "enabledProtocols": err = unpopulate(val, &f.EnabledProtocols) delete(rawMsg, key) case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - f.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &f.LastModifiedTime) delete(rawMsg, key) case "leaseDuration": err = unpopulate(val, &f.LeaseDuration) @@ -1660,9 +1629,7 @@ func (f *FileShareProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &f.SignedIdentifiers) delete(rawMsg, key) case "snapshotTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - f.SnapshotTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &f.SnapshotTime) delete(rawMsg, key) case "version": err = unpopulate(val, &f.Version) @@ -1751,7 +1718,7 @@ type GeoReplicationStats struct { func (g GeoReplicationStats) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "canFailover", g.CanFailover) - populate(objectMap, "lastSyncTime", (*timeRFC3339)(g.LastSyncTime)) + populateTimeRFC3339(objectMap, "lastSyncTime", g.LastSyncTime) populate(objectMap, "status", g.Status) return json.Marshal(objectMap) } @@ -1769,9 +1736,7 @@ func (g *GeoReplicationStats) UnmarshalJSON(data []byte) error { err = unpopulate(val, &g.CanFailover) delete(rawMsg, key) case "lastSyncTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - g.LastSyncTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &g.LastSyncTime) delete(rawMsg, key) case "status": err = unpopulate(val, &g.Status) @@ -1905,7 +1870,7 @@ func (i ImmutableStorageWithVersioning) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "enabled", i.Enabled) populate(objectMap, "migrationState", i.MigrationState) - populate(objectMap, "timeStamp", (*timeRFC3339)(i.TimeStamp)) + populateTimeRFC3339(objectMap, "timeStamp", i.TimeStamp) return json.Marshal(objectMap) } @@ -1925,9 +1890,7 @@ func (i *ImmutableStorageWithVersioning) UnmarshalJSON(data []byte) error { err = unpopulate(val, &i.MigrationState) delete(rawMsg, key) case "timeStamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - i.TimeStamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &i.TimeStamp) delete(rawMsg, key) } if err != nil { @@ -1946,8 +1909,8 @@ type KeyCreationTime struct { // MarshalJSON implements the json.Marshaller interface for type KeyCreationTime. func (k KeyCreationTime) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "key1", (*timeRFC3339)(k.Key1)) - populate(objectMap, "key2", (*timeRFC3339)(k.Key2)) + populateTimeRFC3339(objectMap, "key1", k.Key1) + populateTimeRFC3339(objectMap, "key2", k.Key2) return json.Marshal(objectMap) } @@ -1961,14 +1924,10 @@ func (k *KeyCreationTime) UnmarshalJSON(data []byte) error { var err error switch key { case "key1": - var aux timeRFC3339 - err = unpopulate(val, &aux) - k.Key1 = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &k.Key1) delete(rawMsg, key) case "key2": - var aux timeRFC3339 - err = unpopulate(val, &aux) - k.Key2 = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &k.Key2) delete(rawMsg, key) } if err != nil { @@ -2009,7 +1968,7 @@ func (k KeyVaultProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "keyname", k.KeyName) populate(objectMap, "keyvaulturi", k.KeyVaultURI) populate(objectMap, "keyversion", k.KeyVersion) - populate(objectMap, "lastKeyRotationTimestamp", (*timeRFC3339)(k.LastKeyRotationTimestamp)) + populateTimeRFC3339(objectMap, "lastKeyRotationTimestamp", k.LastKeyRotationTimestamp) return json.Marshal(objectMap) } @@ -2035,9 +1994,7 @@ func (k *KeyVaultProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &k.KeyVersion) delete(rawMsg, key) case "lastKeyRotationTimestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - k.LastKeyRotationTimestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &k.LastKeyRotationTimestamp) delete(rawMsg, key) } if err != nil { @@ -2416,7 +2373,7 @@ type ManagementPolicyProperties struct { // MarshalJSON implements the json.Marshaller interface for type ManagementPolicyProperties. func (m ManagementPolicyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "lastModifiedTime", (*timeRFC3339)(m.LastModifiedTime)) + populateTimeRFC3339(objectMap, "lastModifiedTime", m.LastModifiedTime) populate(objectMap, "policy", m.Policy) return json.Marshal(objectMap) } @@ -2431,9 +2388,7 @@ func (m *ManagementPolicyProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "lastModifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.LastModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.LastModifiedTime) delete(rawMsg, key) case "policy": err = unpopulate(val, &m.Policy) @@ -2669,7 +2624,7 @@ type ObjectReplicationPolicyProperties struct { func (o ObjectReplicationPolicyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "destinationAccount", o.DestinationAccount) - populate(objectMap, "enabledTime", (*timeRFC3339)(o.EnabledTime)) + populateTimeRFC3339(objectMap, "enabledTime", o.EnabledTime) populate(objectMap, "policyId", o.PolicyID) populate(objectMap, "rules", o.Rules) populate(objectMap, "sourceAccount", o.SourceAccount) @@ -2689,9 +2644,7 @@ func (o *ObjectReplicationPolicyProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &o.DestinationAccount) delete(rawMsg, key) case "enabledTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - o.EnabledTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &o.EnabledTime) delete(rawMsg, key) case "policyId": err = unpopulate(val, &o.PolicyID) @@ -2926,7 +2879,7 @@ type ProtectedAppendWritesHistory struct { func (p ProtectedAppendWritesHistory) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "allowProtectedAppendWritesAll", p.AllowProtectedAppendWritesAll) - populate(objectMap, "timestamp", (*timeRFC3339)(p.Timestamp)) + populateTimeRFC3339(objectMap, "timestamp", p.Timestamp) return json.Marshal(objectMap) } @@ -2943,9 +2896,7 @@ func (p *ProtectedAppendWritesHistory) UnmarshalJSON(data []byte) error { err = unpopulate(val, &p.AllowProtectedAppendWritesAll) delete(rawMsg, key) case "timestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - p.Timestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &p.Timestamp) delete(rawMsg, key) } if err != nil { @@ -3107,8 +3058,8 @@ func (r RestorePolicyProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "days", r.Days) populate(objectMap, "enabled", r.Enabled) - populate(objectMap, "lastEnabledTime", (*timeRFC3339)(r.LastEnabledTime)) - populate(objectMap, "minRestoreTime", (*timeRFC3339)(r.MinRestoreTime)) + populateTimeRFC3339(objectMap, "lastEnabledTime", r.LastEnabledTime) + populateTimeRFC3339(objectMap, "minRestoreTime", r.MinRestoreTime) return json.Marshal(objectMap) } @@ -3128,14 +3079,10 @@ func (r *RestorePolicyProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.Enabled) delete(rawMsg, key) case "lastEnabledTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.LastEnabledTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.LastEnabledTime) delete(rawMsg, key) case "minRestoreTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.MinRestoreTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.MinRestoreTime) delete(rawMsg, key) } if err != nil { @@ -3328,8 +3275,8 @@ func (s ServiceSasParameters) MarshalJSON() ([]byte, error) { populate(objectMap, "signedResource", s.Resource) populate(objectMap, "endRk", s.RowKeyEnd) populate(objectMap, "startRk", s.RowKeyStart) - populate(objectMap, "signedExpiry", (*timeRFC3339)(s.SharedAccessExpiryTime)) - populate(objectMap, "signedStart", (*timeRFC3339)(s.SharedAccessStartTime)) + populateTimeRFC3339(objectMap, "signedExpiry", s.SharedAccessExpiryTime) + populateTimeRFC3339(objectMap, "signedStart", s.SharedAccessStartTime) return json.Marshal(objectMap) } @@ -3391,14 +3338,10 @@ func (s *ServiceSasParameters) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.RowKeyStart) delete(rawMsg, key) case "signedExpiry": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.SharedAccessExpiryTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.SharedAccessExpiryTime) delete(rawMsg, key) case "signedStart": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.SharedAccessStartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.SharedAccessStartTime) delete(rawMsg, key) } if err != nil { @@ -3562,7 +3505,7 @@ type StorageAccountKey struct { // MarshalJSON implements the json.Marshaller interface for type StorageAccountKey. func (s StorageAccountKey) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "creationTime", (*timeRFC3339)(s.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", s.CreationTime) populate(objectMap, "keyName", s.KeyName) populate(objectMap, "permissions", s.Permissions) populate(objectMap, "value", s.Value) @@ -3579,9 +3522,7 @@ func (s *StorageAccountKey) UnmarshalJSON(data []byte) error { var err error switch key { case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreationTime) delete(rawMsg, key) case "keyName": err = unpopulate(val, &s.KeyName) @@ -3772,7 +3713,7 @@ func (s StorageAccountProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "allowSharedKeyAccess", s.AllowSharedKeyAccess) populate(objectMap, "azureFilesIdentityBasedAuthentication", s.AzureFilesIdentityBasedAuthentication) populate(objectMap, "blobRestoreStatus", s.BlobRestoreStatus) - populate(objectMap, "creationTime", (*timeRFC3339)(s.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", s.CreationTime) populate(objectMap, "customDomain", s.CustomDomain) populate(objectMap, "defaultToOAuthAuthentication", s.DefaultToOAuthAuthentication) populate(objectMap, "supportsHttpsTrafficOnly", s.EnableHTTPSTrafficOnly) @@ -3785,7 +3726,7 @@ func (s StorageAccountProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "keyCreationTime", s.KeyCreationTime) populate(objectMap, "keyPolicy", s.KeyPolicy) populate(objectMap, "largeFileSharesState", s.LargeFileSharesState) - populate(objectMap, "lastGeoFailoverTime", (*timeRFC3339)(s.LastGeoFailoverTime)) + populateTimeRFC3339(objectMap, "lastGeoFailoverTime", s.LastGeoFailoverTime) populate(objectMap, "minimumTlsVersion", s.MinimumTLSVersion) populate(objectMap, "networkAcls", s.NetworkRuleSet) populate(objectMap, "primaryEndpoints", s.PrimaryEndpoints) @@ -3830,9 +3771,7 @@ func (s *StorageAccountProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.BlobRestoreStatus) delete(rawMsg, key) case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreationTime) delete(rawMsg, key) case "customDomain": err = unpopulate(val, &s.CustomDomain) @@ -3871,9 +3810,7 @@ func (s *StorageAccountProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.LargeFileSharesState) delete(rawMsg, key) case "lastGeoFailoverTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastGeoFailoverTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastGeoFailoverTime) delete(rawMsg, key) case "minimumTlsVersion": err = unpopulate(val, &s.MinimumTLSVersion) @@ -4220,10 +4157,10 @@ type SystemData struct { // MarshalJSON implements the json.Marshaller interface for type SystemData. func (s SystemData) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdAt", (*timeRFC3339)(s.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", s.CreatedAt) populate(objectMap, "createdBy", s.CreatedBy) populate(objectMap, "createdByType", s.CreatedByType) - populate(objectMap, "lastModifiedAt", (*timeRFC3339)(s.LastModifiedAt)) + populateTimeRFC3339(objectMap, "lastModifiedAt", s.LastModifiedAt) populate(objectMap, "lastModifiedBy", s.LastModifiedBy) populate(objectMap, "lastModifiedByType", s.LastModifiedByType) return json.Marshal(objectMap) @@ -4239,9 +4176,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { var err error switch key { case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedAt) delete(rawMsg, key) case "createdBy": err = unpopulate(val, &s.CreatedBy) @@ -4250,9 +4185,7 @@ func (s *SystemData) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.CreatedByType) delete(rawMsg, key) case "lastModifiedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedAt) delete(rawMsg, key) case "lastModifiedBy": err = unpopulate(val, &s.LastModifiedBy) @@ -4387,7 +4320,7 @@ func (t TagProperty) MarshalJSON() ([]byte, error) { populate(objectMap, "objectIdentifier", t.ObjectIdentifier) populate(objectMap, "tag", t.Tag) populate(objectMap, "tenantId", t.TenantID) - populate(objectMap, "timestamp", (*timeRFC3339)(t.Timestamp)) + populateTimeRFC3339(objectMap, "timestamp", t.Timestamp) populate(objectMap, "upn", t.Upn) return json.Marshal(objectMap) } @@ -4411,9 +4344,7 @@ func (t *TagProperty) UnmarshalJSON(data []byte) error { err = unpopulate(val, &t.TenantID) delete(rawMsg, key) case "timestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.Timestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.Timestamp) delete(rawMsg, key) case "upn": err = unpopulate(val, &t.Upn) @@ -4490,7 +4421,7 @@ func (u UpdateHistoryProperty) MarshalJSON() ([]byte, error) { populate(objectMap, "immutabilityPeriodSinceCreationInDays", u.ImmutabilityPeriodSinceCreationInDays) populate(objectMap, "objectIdentifier", u.ObjectIdentifier) populate(objectMap, "tenantId", u.TenantID) - populate(objectMap, "timestamp", (*timeRFC3339)(u.Timestamp)) + populateTimeRFC3339(objectMap, "timestamp", u.Timestamp) populate(objectMap, "update", u.Update) populate(objectMap, "upn", u.Upn) return json.Marshal(objectMap) @@ -4521,9 +4452,7 @@ func (u *UpdateHistoryProperty) UnmarshalJSON(data []byte) error { err = unpopulate(val, &u.TenantID) delete(rawMsg, key) case "timestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - u.Timestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &u.Timestamp) delete(rawMsg, key) case "update": err = unpopulate(val, &u.Update) diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_objectreplicationpolicies_client.go b/sdk/resourcemanager/storage/armstorage/zz_generated_objectreplicationpolicies_client.go index 47c5e6f09308..cf3504717241 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_objectreplicationpolicies_client.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_objectreplicationpolicies_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ObjectReplicationPoliciesClient contains the methods for the ObjectReplicationPolicies group. @@ -30,8 +31,15 @@ type ObjectReplicationPoliciesClient struct { } // NewObjectReplicationPoliciesClient creates a new instance of ObjectReplicationPoliciesClient with the specified values. -func NewObjectReplicationPoliciesClient(con *arm.Connection, subscriptionID string) *ObjectReplicationPoliciesClient { - return &ObjectReplicationPoliciesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewObjectReplicationPoliciesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ObjectReplicationPoliciesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ObjectReplicationPoliciesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Create or update the object replication policy of the storage account. @@ -85,7 +93,7 @@ func (client *ObjectReplicationPoliciesClient) createOrUpdateCreateRequest(ctx c func (client *ObjectReplicationPoliciesClient) createOrUpdateHandleResponse(resp *http.Response) (ObjectReplicationPoliciesCreateOrUpdateResponse, error) { result := ObjectReplicationPoliciesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ObjectReplicationPolicy); err != nil { - return ObjectReplicationPoliciesCreateOrUpdateResponse{}, err + return ObjectReplicationPoliciesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *ObjectReplicationPoliciesClient) getCreateRequest(ctx context.Cont func (client *ObjectReplicationPoliciesClient) getHandleResponse(resp *http.Response) (ObjectReplicationPoliciesGetResponse, error) { result := ObjectReplicationPoliciesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ObjectReplicationPolicy); err != nil { - return ObjectReplicationPoliciesGetResponse{}, err + return ObjectReplicationPoliciesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -279,7 +287,7 @@ func (client *ObjectReplicationPoliciesClient) listCreateRequest(ctx context.Con func (client *ObjectReplicationPoliciesClient) listHandleResponse(resp *http.Response) (ObjectReplicationPoliciesListResponse, error) { result := ObjectReplicationPoliciesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ObjectReplicationPolicies); err != nil { - return ObjectReplicationPoliciesListResponse{}, err + return ObjectReplicationPoliciesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_operations_client.go b/sdk/resourcemanager/storage/armstorage/zz_generated_operations_client.go index 86c0654cdd98..9e4f138ff4d1 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_operations_client.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armstorage import ( "context" "errors" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available Storage Rest API operations. @@ -65,7 +73,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_pagers.go b/sdk/resourcemanager/storage/armstorage/zz_generated_pagers.go index ba6cd041feb1..7fee967c4713 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_pagers.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armstorage import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // BlobContainersListPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_pollers.go b/sdk/resourcemanager/storage/armstorage/zz_generated_pollers.go index e6ccb262f885..f45a3cf5a536 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_pollers.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armstorage import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // BlobContainersObjectLevelWormPoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_privateendpointconnections_client.go b/sdk/resourcemanager/storage/armstorage/zz_generated_privateendpointconnections_client.go index c380bdc9a696..5906b72dbd5e 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_privateendpointconnections_client.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_privateendpointconnections_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateEndpointConnectionsClient contains the methods for the PrivateEndpointConnections group. @@ -30,8 +31,15 @@ type PrivateEndpointConnectionsClient struct { } // NewPrivateEndpointConnectionsClient creates a new instance of PrivateEndpointConnectionsClient with the specified values. -func NewPrivateEndpointConnectionsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointConnectionsClient { - return &PrivateEndpointConnectionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointConnectionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointConnectionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointConnectionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Delete - Deletes the specified private endpoint connection associated with the storage account. @@ -145,7 +153,7 @@ func (client *PrivateEndpointConnectionsClient) getCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) getHandleResponse(resp *http.Response) (PrivateEndpointConnectionsGetResponse, error) { result := PrivateEndpointConnectionsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsGetResponse{}, err + return PrivateEndpointConnectionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -210,7 +218,7 @@ func (client *PrivateEndpointConnectionsClient) listCreateRequest(ctx context.Co func (client *PrivateEndpointConnectionsClient) listHandleResponse(resp *http.Response) (PrivateEndpointConnectionsListResponse, error) { result := PrivateEndpointConnectionsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionListResult); err != nil { - return PrivateEndpointConnectionsListResponse{}, err + return PrivateEndpointConnectionsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -278,7 +286,7 @@ func (client *PrivateEndpointConnectionsClient) putCreateRequest(ctx context.Con func (client *PrivateEndpointConnectionsClient) putHandleResponse(resp *http.Response) (PrivateEndpointConnectionsPutResponse, error) { result := PrivateEndpointConnectionsPutResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnection); err != nil { - return PrivateEndpointConnectionsPutResponse{}, err + return PrivateEndpointConnectionsPutResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_privatelinkresources_client.go b/sdk/resourcemanager/storage/armstorage/zz_generated_privatelinkresources_client.go index 3f3985bff6fb..551d7398ee70 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_privatelinkresources_client.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_privatelinkresources_client.go @@ -11,13 +11,14 @@ package armstorage import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateLinkResourcesClient contains the methods for the PrivateLinkResources group. @@ -29,8 +30,15 @@ type PrivateLinkResourcesClient struct { } // NewPrivateLinkResourcesClient creates a new instance of PrivateLinkResourcesClient with the specified values. -func NewPrivateLinkResourcesClient(con *arm.Connection, subscriptionID string) *PrivateLinkResourcesClient { - return &PrivateLinkResourcesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateLinkResourcesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateLinkResourcesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateLinkResourcesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByStorageAccount - Gets the private link resources that need to be created for a storage account. @@ -80,7 +88,7 @@ func (client *PrivateLinkResourcesClient) listByStorageAccountCreateRequest(ctx func (client *PrivateLinkResourcesClient) listByStorageAccountHandleResponse(resp *http.Response) (PrivateLinkResourcesListByStorageAccountResponse, error) { result := PrivateLinkResourcesListByStorageAccountResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourceListResult); err != nil { - return PrivateLinkResourcesListByStorageAccountResponse{}, err + return PrivateLinkResourcesListByStorageAccountResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_queue_client.go b/sdk/resourcemanager/storage/armstorage/zz_generated_queue_client.go index ebe51a91d20c..d43c64f69b84 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_queue_client.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_queue_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // QueueClient contains the methods for the Queue group. @@ -30,8 +31,15 @@ type QueueClient struct { } // NewQueueClient creates a new instance of QueueClient with the specified values. -func NewQueueClient(con *arm.Connection, subscriptionID string) *QueueClient { - return &QueueClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewQueueClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *QueueClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &QueueClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Creates a new queue with the specified queue name, under the specified account. @@ -85,7 +93,7 @@ func (client *QueueClient) createCreateRequest(ctx context.Context, resourceGrou func (client *QueueClient) createHandleResponse(resp *http.Response) (QueueCreateResponse, error) { result := QueueCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StorageQueue); err != nil { - return QueueCreateResponse{}, err + return QueueCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *QueueClient) getCreateRequest(ctx context.Context, resourceGroupNa func (client *QueueClient) getHandleResponse(resp *http.Response) (QueueGetResponse, error) { result := QueueGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StorageQueue); err != nil { - return QueueGetResponse{}, err + return QueueGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -282,7 +290,7 @@ func (client *QueueClient) listCreateRequest(ctx context.Context, resourceGroupN func (client *QueueClient) listHandleResponse(resp *http.Response) (QueueListResponse, error) { result := QueueListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListQueueResource); err != nil { - return QueueListResponse{}, err + return QueueListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -351,7 +359,7 @@ func (client *QueueClient) updateCreateRequest(ctx context.Context, resourceGrou func (client *QueueClient) updateHandleResponse(resp *http.Response) (QueueUpdateResponse, error) { result := QueueUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StorageQueue); err != nil { - return QueueUpdateResponse{}, err + return QueueUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_queueservices_client.go b/sdk/resourcemanager/storage/armstorage/zz_generated_queueservices_client.go index 56d77a695bf2..028c4437686e 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_queueservices_client.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_queueservices_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // QueueServicesClient contains the methods for the QueueServices group. @@ -30,8 +31,15 @@ type QueueServicesClient struct { } // NewQueueServicesClient creates a new instance of QueueServicesClient with the specified values. -func NewQueueServicesClient(con *arm.Connection, subscriptionID string) *QueueServicesClient { - return &QueueServicesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewQueueServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *QueueServicesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &QueueServicesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetServiceProperties - Gets the properties of a storage account’s Queue service, including properties for Storage Analytics and CORS (Cross-Origin Resource @@ -83,7 +91,7 @@ func (client *QueueServicesClient) getServicePropertiesCreateRequest(ctx context func (client *QueueServicesClient) getServicePropertiesHandleResponse(resp *http.Response) (QueueServicesGetServicePropertiesResponse, error) { result := QueueServicesGetServicePropertiesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.QueueServiceProperties); err != nil { - return QueueServicesGetServicePropertiesResponse{}, err + return QueueServicesGetServicePropertiesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -148,7 +156,7 @@ func (client *QueueServicesClient) listCreateRequest(ctx context.Context, resour func (client *QueueServicesClient) listHandleResponse(resp *http.Response) (QueueServicesListResponse, error) { result := QueueServicesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListQueueServices); err != nil { - return QueueServicesListResponse{}, err + return QueueServicesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -215,7 +223,7 @@ func (client *QueueServicesClient) setServicePropertiesCreateRequest(ctx context func (client *QueueServicesClient) setServicePropertiesHandleResponse(resp *http.Response) (QueueServicesSetServicePropertiesResponse, error) { result := QueueServicesSetServicePropertiesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.QueueServiceProperties); err != nil { - return QueueServicesSetServicePropertiesResponse{}, err + return QueueServicesSetServicePropertiesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_response_types.go b/sdk/resourcemanager/storage/armstorage/zz_generated_response_types.go index 7560086f32d5..d2daf0b4b12e 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_response_types.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armstorage import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // BlobContainersClearLegalHoldResponse contains the response from method BlobContainers.ClearLegalHold. @@ -162,6 +161,8 @@ type BlobContainersObjectLevelWormPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l BlobContainersObjectLevelWormPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (BlobContainersObjectLevelWormResponse, error) { respType := BlobContainersObjectLevelWormResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -730,6 +731,8 @@ type StorageAccountsAbortHierarchicalNamespaceMigrationPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StorageAccountsAbortHierarchicalNamespaceMigrationPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StorageAccountsAbortHierarchicalNamespaceMigrationResponse, error) { respType := StorageAccountsAbortHierarchicalNamespaceMigrationResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -786,6 +789,8 @@ type StorageAccountsCreatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StorageAccountsCreatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StorageAccountsCreateResponse, error) { respType := StorageAccountsCreateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.StorageAccount) @@ -842,6 +847,8 @@ type StorageAccountsFailoverPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StorageAccountsFailoverPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StorageAccountsFailoverResponse, error) { respType := StorageAccountsFailoverResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -898,6 +905,8 @@ type StorageAccountsHierarchicalNamespaceMigrationPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StorageAccountsHierarchicalNamespaceMigrationPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StorageAccountsHierarchicalNamespaceMigrationResponse, error) { respType := StorageAccountsHierarchicalNamespaceMigrationResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -1014,6 +1023,8 @@ type StorageAccountsRestoreBlobRangesPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StorageAccountsRestoreBlobRangesPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StorageAccountsRestoreBlobRangesResponse, error) { respType := StorageAccountsRestoreBlobRangesResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.BlobRestoreStatus) diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_skus_client.go b/sdk/resourcemanager/storage/armstorage/zz_generated_skus_client.go index 712f2043dfba..79e68411b181 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_skus_client.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_skus_client.go @@ -11,13 +11,14 @@ package armstorage import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SKUsClient contains the methods for the SKUs group. @@ -29,8 +30,15 @@ type SKUsClient struct { } // NewSKUsClient creates a new instance of SKUsClient with the specified values. -func NewSKUsClient(con *arm.Connection, subscriptionID string) *SKUsClient { - return &SKUsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSKUsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SKUsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SKUsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists the available SKUs supported by Microsoft.Storage for given subscription. @@ -72,7 +80,7 @@ func (client *SKUsClient) listCreateRequest(ctx context.Context, options *SKUsLi func (client *SKUsClient) listHandleResponse(resp *http.Response) (SKUsListResponse, error) { result := SKUsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StorageSKUListResult); err != nil { - return SKUsListResponse{}, err + return SKUsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_storageaccounts_client.go b/sdk/resourcemanager/storage/armstorage/zz_generated_storageaccounts_client.go index 503daf3a9fc0..0a33cb690bce 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_storageaccounts_client.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_storageaccounts_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // StorageAccountsClient contains the methods for the StorageAccounts group. @@ -31,8 +31,15 @@ type StorageAccountsClient struct { } // NewStorageAccountsClient creates a new instance of StorageAccountsClient with the specified values. -func NewStorageAccountsClient(con *arm.Connection, subscriptionID string) *StorageAccountsClient { - return &StorageAccountsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewStorageAccountsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *StorageAccountsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &StorageAccountsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginAbortHierarchicalNamespaceMigration - Abort live Migration of storage account to enable Hns @@ -150,7 +157,7 @@ func (client *StorageAccountsClient) checkNameAvailabilityCreateRequest(ctx cont func (client *StorageAccountsClient) checkNameAvailabilityHandleResponse(resp *http.Response) (StorageAccountsCheckNameAvailabilityResponse, error) { result := StorageAccountsCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CheckNameAvailabilityResult); err != nil { - return StorageAccountsCheckNameAvailabilityResponse{}, err + return StorageAccountsCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -431,7 +438,7 @@ func (client *StorageAccountsClient) getPropertiesCreateRequest(ctx context.Cont func (client *StorageAccountsClient) getPropertiesHandleResponse(resp *http.Response) (StorageAccountsGetPropertiesResponse, error) { result := StorageAccountsGetPropertiesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StorageAccount); err != nil { - return StorageAccountsGetPropertiesResponse{}, err + return StorageAccountsGetPropertiesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -561,7 +568,7 @@ func (client *StorageAccountsClient) listCreateRequest(ctx context.Context, opti func (client *StorageAccountsClient) listHandleResponse(resp *http.Response) (StorageAccountsListResponse, error) { result := StorageAccountsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StorageAccountListResult); err != nil { - return StorageAccountsListResponse{}, err + return StorageAccountsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -625,7 +632,7 @@ func (client *StorageAccountsClient) listAccountSASCreateRequest(ctx context.Con func (client *StorageAccountsClient) listAccountSASHandleResponse(resp *http.Response) (StorageAccountsListAccountSASResponse, error) { result := StorageAccountsListAccountSASResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListAccountSasResponse); err != nil { - return StorageAccountsListAccountSASResponse{}, err + return StorageAccountsListAccountSASResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -683,7 +690,7 @@ func (client *StorageAccountsClient) listByResourceGroupCreateRequest(ctx contex func (client *StorageAccountsClient) listByResourceGroupHandleResponse(resp *http.Response) (StorageAccountsListByResourceGroupResponse, error) { result := StorageAccountsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StorageAccountListResult); err != nil { - return StorageAccountsListByResourceGroupResponse{}, err + return StorageAccountsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -750,7 +757,7 @@ func (client *StorageAccountsClient) listKeysCreateRequest(ctx context.Context, func (client *StorageAccountsClient) listKeysHandleResponse(resp *http.Response) (StorageAccountsListKeysResponse, error) { result := StorageAccountsListKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StorageAccountListKeysResult); err != nil { - return StorageAccountsListKeysResponse{}, err + return StorageAccountsListKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -814,7 +821,7 @@ func (client *StorageAccountsClient) listServiceSASCreateRequest(ctx context.Con func (client *StorageAccountsClient) listServiceSASHandleResponse(resp *http.Response) (StorageAccountsListServiceSASResponse, error) { result := StorageAccountsListServiceSASResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListServiceSasResponse); err != nil { - return StorageAccountsListServiceSASResponse{}, err + return StorageAccountsListServiceSASResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -878,7 +885,7 @@ func (client *StorageAccountsClient) regenerateKeyCreateRequest(ctx context.Cont func (client *StorageAccountsClient) regenerateKeyHandleResponse(resp *http.Response) (StorageAccountsRegenerateKeyResponse, error) { result := StorageAccountsRegenerateKeyResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StorageAccountListKeysResult); err != nil { - return StorageAccountsRegenerateKeyResponse{}, err + return StorageAccountsRegenerateKeyResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1077,7 +1084,7 @@ func (client *StorageAccountsClient) updateCreateRequest(ctx context.Context, re func (client *StorageAccountsClient) updateHandleResponse(resp *http.Response) (StorageAccountsUpdateResponse, error) { result := StorageAccountsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StorageAccount); err != nil { - return StorageAccountsUpdateResponse{}, err + return StorageAccountsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_table_client.go b/sdk/resourcemanager/storage/armstorage/zz_generated_table_client.go index 18286b13b247..154ef386385a 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_table_client.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_table_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TableClient contains the methods for the Table group. @@ -30,8 +31,15 @@ type TableClient struct { } // NewTableClient creates a new instance of TableClient with the specified values. -func NewTableClient(con *arm.Connection, subscriptionID string) *TableClient { - return &TableClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTableClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TableClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TableClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Create - Creates a new table with the specified table name, under the specified account. @@ -85,7 +93,7 @@ func (client *TableClient) createCreateRequest(ctx context.Context, resourceGrou func (client *TableClient) createHandleResponse(resp *http.Response) (TableCreateResponse, error) { result := TableCreateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Table); err != nil { - return TableCreateResponse{}, err + return TableCreateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -214,7 +222,7 @@ func (client *TableClient) getCreateRequest(ctx context.Context, resourceGroupNa func (client *TableClient) getHandleResponse(resp *http.Response) (TableGetResponse, error) { result := TableGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Table); err != nil { - return TableGetResponse{}, err + return TableGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -276,7 +284,7 @@ func (client *TableClient) listCreateRequest(ctx context.Context, resourceGroupN func (client *TableClient) listHandleResponse(resp *http.Response) (TableListResponse, error) { result := TableListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListTableResource); err != nil { - return TableListResponse{}, err + return TableListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -345,7 +353,7 @@ func (client *TableClient) updateCreateRequest(ctx context.Context, resourceGrou func (client *TableClient) updateHandleResponse(resp *http.Response) (TableUpdateResponse, error) { result := TableUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Table); err != nil { - return TableUpdateResponse{}, err + return TableUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_tableservices_client.go b/sdk/resourcemanager/storage/armstorage/zz_generated_tableservices_client.go index 2b3247d54d72..ea8ae3f74657 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_tableservices_client.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_tableservices_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TableServicesClient contains the methods for the TableServices group. @@ -30,8 +31,15 @@ type TableServicesClient struct { } // NewTableServicesClient creates a new instance of TableServicesClient with the specified values. -func NewTableServicesClient(con *arm.Connection, subscriptionID string) *TableServicesClient { - return &TableServicesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTableServicesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TableServicesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TableServicesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetServiceProperties - Gets the properties of a storage account’s Table service, including properties for Storage Analytics and CORS (Cross-Origin Resource @@ -83,7 +91,7 @@ func (client *TableServicesClient) getServicePropertiesCreateRequest(ctx context func (client *TableServicesClient) getServicePropertiesHandleResponse(resp *http.Response) (TableServicesGetServicePropertiesResponse, error) { result := TableServicesGetServicePropertiesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TableServiceProperties); err != nil { - return TableServicesGetServicePropertiesResponse{}, err + return TableServicesGetServicePropertiesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -148,7 +156,7 @@ func (client *TableServicesClient) listCreateRequest(ctx context.Context, resour func (client *TableServicesClient) listHandleResponse(resp *http.Response) (TableServicesListResponse, error) { result := TableServicesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ListTableServices); err != nil { - return TableServicesListResponse{}, err + return TableServicesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -215,7 +223,7 @@ func (client *TableServicesClient) setServicePropertiesCreateRequest(ctx context func (client *TableServicesClient) setServicePropertiesHandleResponse(resp *http.Response) (TableServicesSetServicePropertiesResponse, error) { result := TableServicesSetServicePropertiesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TableServiceProperties); err != nil { - return TableServicesSetServicePropertiesResponse{}, err + return TableServicesSetServicePropertiesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_time_rfc3339.go b/sdk/resourcemanager/storage/armstorage/zz_generated_time_rfc3339.go index ef5d29475a8a..19d8416b1f8f 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armstorage import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/storage/armstorage/zz_generated_usages_client.go b/sdk/resourcemanager/storage/armstorage/zz_generated_usages_client.go index 902ec38c8470..6941ba386744 100644 --- a/sdk/resourcemanager/storage/armstorage/zz_generated_usages_client.go +++ b/sdk/resourcemanager/storage/armstorage/zz_generated_usages_client.go @@ -11,13 +11,14 @@ package armstorage import ( "context" "errors" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // UsagesClient contains the methods for the Usages group. @@ -29,8 +30,15 @@ type UsagesClient struct { } // NewUsagesClient creates a new instance of UsagesClient with the specified values. -func NewUsagesClient(con *arm.Connection, subscriptionID string) *UsagesClient { - return &UsagesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewUsagesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *UsagesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &UsagesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListByLocation - Gets the current usage count and the limit for the resources of the location under the subscription. @@ -76,7 +84,7 @@ func (client *UsagesClient) listByLocationCreateRequest(ctx context.Context, loc func (client *UsagesClient) listByLocationHandleResponse(resp *http.Response) (UsagesListByLocationResponse, error) { result := UsagesListByLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UsageListResult); err != nil { - return UsagesListByLocationResponse{}, err + return UsagesListByLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/CHANGELOG.md b/sdk/resourcemanager/streamanalytics/armstreamanalytics/CHANGELOG.md index e4f3d9f035c1..6ee9f3587c1a 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/CHANGELOG.md +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/CHANGELOG.md @@ -1,14 +1,11 @@ # Release History -## 0.1.1 (Unreleased) - -### Features Added +## 0.2.0 (2021-10-29) ### Breaking Changes -### Bugs Fixed - -### Other Changes +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` ## 0.1.0 (2021-10-26) diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/README.md b/sdk/resourcemanager/streamanalytics/armstreamanalytics/README.md index 617f623bd192..861da7e0dae4 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/README.md +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Stream Analytics +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Stream Analytics modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armstreamanalytics.NewInputsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Stream Analytics modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armstreamanalytics.NewInputsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armstreamanalytics.NewInputsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/autorest.md b/sdk/resourcemanager/streamanalytics/armstreamanalytics/autorest.md index b318cda0e9d2..f34adc96958b 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/autorest.md +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/3c16aae50c7110e1aad241ac93995621d4093d46/specification/streamanalytics/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/3c16aae50c7110e1aad241ac93995621d4093d46/specification/streamanalytics/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/streamanalytics/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/streamanalytics/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/go.mod b/sdk/resourcemanager/streamanalytics/armstreamanalytics/go.mod index 1ddfef90c162..32f58b1a6d53 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/go.mod +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/streamanalytics/arm go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.2.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/go.sum b/sdk/resourcemanager/streamanalytics/armstreamanalytics/go.sum index c8ff7a2143ad..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/go.sum +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible h1:iCb2tuoEm3N7ZpUDOvu1Yxl1B3iOVDmaD6weaRuIPzs= -github.com/Azure/azure-sdk-for-go v58.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_clusters_client.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_clusters_client.go index a4f06cd922d1..f9e644f23539 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_clusters_client.go +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_clusters_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ClustersClient contains the methods for the Clusters group. @@ -31,8 +31,15 @@ type ClustersClient struct { } // NewClustersClient creates a new instance of ClustersClient with the specified values. -func NewClustersClient(con *arm.Connection, subscriptionID string) *ClustersClient { - return &ClustersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewClustersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ClustersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ClustersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Creates a Stream Analytics Cluster or replaces an already existing cluster. @@ -240,7 +247,7 @@ func (client *ClustersClient) getCreateRequest(ctx context.Context, resourceGrou func (client *ClustersClient) getHandleResponse(resp *http.Response) (ClustersGetResponse, error) { result := ClustersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Cluster); err != nil { - return ClustersGetResponse{}, err + return ClustersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -298,7 +305,7 @@ func (client *ClustersClient) listByResourceGroupCreateRequest(ctx context.Conte func (client *ClustersClient) listByResourceGroupHandleResponse(resp *http.Response) (ClustersListByResourceGroupResponse, error) { result := ClustersListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ClusterListResult); err != nil { - return ClustersListByResourceGroupResponse{}, err + return ClustersListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -352,7 +359,7 @@ func (client *ClustersClient) listBySubscriptionCreateRequest(ctx context.Contex func (client *ClustersClient) listBySubscriptionHandleResponse(resp *http.Response) (ClustersListBySubscriptionResponse, error) { result := ClustersListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ClusterListResult); err != nil { - return ClustersListBySubscriptionResponse{}, err + return ClustersListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -414,7 +421,7 @@ func (client *ClustersClient) listStreamingJobsCreateRequest(ctx context.Context func (client *ClustersClient) listStreamingJobsHandleResponse(resp *http.Response) (ClustersListStreamingJobsResponse, error) { result := ClustersListStreamingJobsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ClusterJobListResult); err != nil { - return ClustersListStreamingJobsResponse{}, err + return ClustersListStreamingJobsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_constants.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_constants.go index 22c3a89ace18..57557f02a2de 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_constants.go +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_constants.go @@ -10,7 +10,7 @@ package armstreamanalytics const ( module = "armstreamanalytics" - version = "v0.1.1" + version = "v0.2.0" ) // AuthenticationMode - Authentication Mode. Valid modes are ConnectionString, Msi and 'UserToken'. diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_functions_client.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_functions_client.go index c19cd4198f42..c71eaab29250 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_functions_client.go +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_functions_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // FunctionsClient contains the methods for the Functions group. @@ -31,8 +31,15 @@ type FunctionsClient struct { } // NewFunctionsClient creates a new instance of FunctionsClient with the specified values. -func NewFunctionsClient(con *arm.Connection, subscriptionID string) *FunctionsClient { - return &FunctionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewFunctionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *FunctionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &FunctionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrReplace - Creates a function or replaces an already existing function under an existing streaming job. @@ -95,7 +102,7 @@ func (client *FunctionsClient) createOrReplaceHandleResponse(resp *http.Response result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.Function); err != nil { - return FunctionsCreateOrReplaceResponse{}, err + return FunctionsCreateOrReplaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -227,7 +234,7 @@ func (client *FunctionsClient) getHandleResponse(resp *http.Response) (Functions result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.Function); err != nil { - return FunctionsGetResponse{}, err + return FunctionsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -292,7 +299,7 @@ func (client *FunctionsClient) listByStreamingJobCreateRequest(ctx context.Conte func (client *FunctionsClient) listByStreamingJobHandleResponse(resp *http.Response) (FunctionsListByStreamingJobResponse, error) { result := FunctionsListByStreamingJobResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FunctionListResult); err != nil { - return FunctionsListByStreamingJobResponse{}, err + return FunctionsListByStreamingJobResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -364,7 +371,7 @@ func (client *FunctionsClient) retrieveDefaultDefinitionCreateRequest(ctx contex func (client *FunctionsClient) retrieveDefaultDefinitionHandleResponse(resp *http.Response) (FunctionsRetrieveDefaultDefinitionResponse, error) { result := FunctionsRetrieveDefaultDefinitionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Function); err != nil { - return FunctionsRetrieveDefaultDefinitionResponse{}, err + return FunctionsRetrieveDefaultDefinitionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -528,7 +535,7 @@ func (client *FunctionsClient) updateHandleResponse(resp *http.Response) (Functi result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.Function); err != nil { - return FunctionsUpdateResponse{}, err + return FunctionsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_inputs_client.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_inputs_client.go index 782928f31013..5848dbb9b5e8 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_inputs_client.go +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_inputs_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // InputsClient contains the methods for the Inputs group. @@ -31,8 +31,15 @@ type InputsClient struct { } // NewInputsClient creates a new instance of InputsClient with the specified values. -func NewInputsClient(con *arm.Connection, subscriptionID string) *InputsClient { - return &InputsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewInputsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *InputsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &InputsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrReplace - Creates an input or replaces an already existing input under an existing streaming job. @@ -95,7 +102,7 @@ func (client *InputsClient) createOrReplaceHandleResponse(resp *http.Response) ( result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.Input); err != nil { - return InputsCreateOrReplaceResponse{}, err + return InputsCreateOrReplaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -227,7 +234,7 @@ func (client *InputsClient) getHandleResponse(resp *http.Response) (InputsGetRes result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.Input); err != nil { - return InputsGetResponse{}, err + return InputsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -292,7 +299,7 @@ func (client *InputsClient) listByStreamingJobCreateRequest(ctx context.Context, func (client *InputsClient) listByStreamingJobHandleResponse(resp *http.Response) (InputsListByStreamingJobResponse, error) { result := InputsListByStreamingJobResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.InputListResult); err != nil { - return InputsListByStreamingJobResponse{}, err + return InputsListByStreamingJobResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -451,7 +458,7 @@ func (client *InputsClient) updateHandleResponse(resp *http.Response) (InputsUpd result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.Input); err != nil { - return InputsUpdateResponse{}, err + return InputsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_models.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_models.go index d71222ea8ba2..2655d7df65a7 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_models.go +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_models.go @@ -10,10 +10,9 @@ package armstreamanalytics import ( "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "reflect" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore" ) // AggregateFunctionProperties - The properties that are associated with an aggregate function. @@ -1218,7 +1217,7 @@ func (c ClusterProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "capacityAllocated", c.CapacityAllocated) populate(objectMap, "capacityAssigned", c.CapacityAssigned) populate(objectMap, "clusterId", c.ClusterID) - populate(objectMap, "createdDate", (*timeRFC3339)(c.CreatedDate)) + populateTimeRFC3339(objectMap, "createdDate", c.CreatedDate) populate(objectMap, "provisioningState", c.ProvisioningState) return json.Marshal(objectMap) } @@ -1242,9 +1241,7 @@ func (c *ClusterProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.ClusterID) delete(rawMsg, key) case "createdDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.CreatedDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.CreatedDate) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, &c.ProvisioningState) @@ -3586,7 +3583,7 @@ type StartStreamingJobParameters struct { func (s StartStreamingJobParameters) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "outputStartMode", s.OutputStartMode) - populate(objectMap, "outputStartTime", (*timeRFC3339)(s.OutputStartTime)) + populateTimeRFC3339(objectMap, "outputStartTime", s.OutputStartTime) return json.Marshal(objectMap) } @@ -3603,9 +3600,7 @@ func (s *StartStreamingJobParameters) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.OutputStartMode) delete(rawMsg, key) case "outputStartTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.OutputStartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.OutputStartTime) delete(rawMsg, key) } if err != nil { @@ -3850,7 +3845,7 @@ func (s StreamingJobProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "cluster", s.Cluster) populate(objectMap, "compatibilityLevel", s.CompatibilityLevel) populate(objectMap, "contentStoragePolicy", s.ContentStoragePolicy) - populate(objectMap, "createdDate", (*timeRFC3339)(s.CreatedDate)) + populateTimeRFC3339(objectMap, "createdDate", s.CreatedDate) populate(objectMap, "dataLocale", s.DataLocale) populate(objectMap, "etag", s.Etag) populate(objectMap, "eventsLateArrivalMaxDelayInSeconds", s.EventsLateArrivalMaxDelayInSeconds) @@ -3863,10 +3858,10 @@ func (s StreamingJobProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "jobState", s.JobState) populate(objectMap, "jobStorageAccount", s.JobStorageAccount) populate(objectMap, "jobType", s.JobType) - populate(objectMap, "lastOutputEventTime", (*timeRFC3339)(s.LastOutputEventTime)) + populateTimeRFC3339(objectMap, "lastOutputEventTime", s.LastOutputEventTime) populate(objectMap, "outputErrorPolicy", s.OutputErrorPolicy) populate(objectMap, "outputStartMode", s.OutputStartMode) - populate(objectMap, "outputStartTime", (*timeRFC3339)(s.OutputStartTime)) + populateTimeRFC3339(objectMap, "outputStartTime", s.OutputStartTime) populate(objectMap, "outputs", s.Outputs) populate(objectMap, "provisioningState", s.ProvisioningState) populate(objectMap, "sku", s.SKU) @@ -3893,9 +3888,7 @@ func (s *StreamingJobProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.ContentStoragePolicy) delete(rawMsg, key) case "createdDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedDate) delete(rawMsg, key) case "dataLocale": err = unpopulate(val, &s.DataLocale) @@ -3934,9 +3927,7 @@ func (s *StreamingJobProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.JobType) delete(rawMsg, key) case "lastOutputEventTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastOutputEventTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastOutputEventTime) delete(rawMsg, key) case "outputErrorPolicy": err = unpopulate(val, &s.OutputErrorPolicy) @@ -3945,9 +3936,7 @@ func (s *StreamingJobProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.OutputStartMode) delete(rawMsg, key) case "outputStartTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.OutputStartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.OutputStartTime) delete(rawMsg, key) case "outputs": err = unpopulate(val, &s.Outputs) diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_operations_client.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_operations_client.go index e419e3ecc6ed..580452654a46 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_operations_client.go +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_operations_client.go @@ -11,11 +11,12 @@ package armstreamanalytics import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // OperationsClient contains the methods for the Operations group. @@ -26,8 +27,15 @@ type OperationsClient struct { } // NewOperationsClient creates a new instance of OperationsClient with the specified values. -func NewOperationsClient(con *arm.Connection) *OperationsClient { - return &OperationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewOperationsClient(credential azcore.TokenCredential, options *arm.ClientOptions) *OperationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OperationsClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // List - Lists all of the available Stream Analytics related operations. @@ -62,7 +70,7 @@ func (client *OperationsClient) listCreateRequest(ctx context.Context, options * func (client *OperationsClient) listHandleResponse(resp *http.Response) (OperationsListResponse, error) { result := OperationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationListResult); err != nil { - return OperationsListResponse{}, err + return OperationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_outputs_client.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_outputs_client.go index 61cc9e5d5b9c..5948ab55d0fd 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_outputs_client.go +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_outputs_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // OutputsClient contains the methods for the Outputs group. @@ -31,8 +31,15 @@ type OutputsClient struct { } // NewOutputsClient creates a new instance of OutputsClient with the specified values. -func NewOutputsClient(con *arm.Connection, subscriptionID string) *OutputsClient { - return &OutputsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewOutputsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *OutputsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &OutputsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrReplace - Creates an output or replaces an already existing output under an existing streaming job. @@ -95,7 +102,7 @@ func (client *OutputsClient) createOrReplaceHandleResponse(resp *http.Response) result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.Output); err != nil { - return OutputsCreateOrReplaceResponse{}, err + return OutputsCreateOrReplaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -227,7 +234,7 @@ func (client *OutputsClient) getHandleResponse(resp *http.Response) (OutputsGetR result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.Output); err != nil { - return OutputsGetResponse{}, err + return OutputsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -292,7 +299,7 @@ func (client *OutputsClient) listByStreamingJobCreateRequest(ctx context.Context func (client *OutputsClient) listByStreamingJobHandleResponse(resp *http.Response) (OutputsListByStreamingJobResponse, error) { result := OutputsListByStreamingJobResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OutputListResult); err != nil { - return OutputsListByStreamingJobResponse{}, err + return OutputsListByStreamingJobResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -451,7 +458,7 @@ func (client *OutputsClient) updateHandleResponse(resp *http.Response) (OutputsU result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.Output); err != nil { - return OutputsUpdateResponse{}, err + return OutputsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_pagers.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_pagers.go index 6e68ffdd1798..e3c33bc839e3 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_pagers.go +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armstreamanalytics import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // ClustersListByResourceGroupPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_pollers.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_pollers.go index 30c123173af9..641a30cbe770 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_pollers.go +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armstreamanalytics import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // ClustersCreateOrUpdatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_polymorphic_helpers.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_polymorphic_helpers.go index 639ea4cce8dc..8a6f42b57f4e 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_polymorphic_helpers.go +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_polymorphic_helpers.go @@ -53,6 +53,25 @@ func unmarshalFunctionBindingClassificationArray(rawMsg json.RawMessage) ([]Func return fArray, nil } +func unmarshalFunctionBindingClassificationMap(rawMsg json.RawMessage) (map[string]FunctionBindingClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]FunctionBindingClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalFunctionBindingClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalFunctionPropertiesClassification(rawMsg json.RawMessage) (FunctionPropertiesClassification, error) { if rawMsg == nil { return nil, nil @@ -92,6 +111,25 @@ func unmarshalFunctionPropertiesClassificationArray(rawMsg json.RawMessage) ([]F return fArray, nil } +func unmarshalFunctionPropertiesClassificationMap(rawMsg json.RawMessage) (map[string]FunctionPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]FunctionPropertiesClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalFunctionPropertiesClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalFunctionRetrieveDefaultDefinitionParametersClassification(rawMsg json.RawMessage) (FunctionRetrieveDefaultDefinitionParametersClassification, error) { if rawMsg == nil { return nil, nil @@ -135,6 +173,25 @@ func unmarshalFunctionRetrieveDefaultDefinitionParametersClassificationArray(raw return fArray, nil } +func unmarshalFunctionRetrieveDefaultDefinitionParametersClassificationMap(rawMsg json.RawMessage) (map[string]FunctionRetrieveDefaultDefinitionParametersClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]FunctionRetrieveDefaultDefinitionParametersClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalFunctionRetrieveDefaultDefinitionParametersClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalInputPropertiesClassification(rawMsg json.RawMessage) (InputPropertiesClassification, error) { if rawMsg == nil { return nil, nil @@ -174,6 +231,25 @@ func unmarshalInputPropertiesClassificationArray(rawMsg json.RawMessage) ([]Inpu return fArray, nil } +func unmarshalInputPropertiesClassificationMap(rawMsg json.RawMessage) (map[string]InputPropertiesClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]InputPropertiesClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalInputPropertiesClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalOutputDataSourceClassification(rawMsg json.RawMessage) (OutputDataSourceClassification, error) { if rawMsg == nil { return nil, nil @@ -235,6 +311,25 @@ func unmarshalOutputDataSourceClassificationArray(rawMsg json.RawMessage) ([]Out return fArray, nil } +func unmarshalOutputDataSourceClassificationMap(rawMsg json.RawMessage) (map[string]OutputDataSourceClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]OutputDataSourceClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalOutputDataSourceClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalReferenceInputDataSourceClassification(rawMsg json.RawMessage) (ReferenceInputDataSourceClassification, error) { if rawMsg == nil { return nil, nil @@ -276,6 +371,25 @@ func unmarshalReferenceInputDataSourceClassificationArray(rawMsg json.RawMessage return fArray, nil } +func unmarshalReferenceInputDataSourceClassificationMap(rawMsg json.RawMessage) (map[string]ReferenceInputDataSourceClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]ReferenceInputDataSourceClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalReferenceInputDataSourceClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalSerializationClassification(rawMsg json.RawMessage) (SerializationClassification, error) { if rawMsg == nil { return nil, nil @@ -321,6 +435,25 @@ func unmarshalSerializationClassificationArray(rawMsg json.RawMessage) ([]Serial return fArray, nil } +func unmarshalSerializationClassificationMap(rawMsg json.RawMessage) (map[string]SerializationClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]SerializationClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalSerializationClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} + func unmarshalStreamInputDataSourceClassification(rawMsg json.RawMessage) (StreamInputDataSourceClassification, error) { if rawMsg == nil { return nil, nil @@ -365,3 +498,22 @@ func unmarshalStreamInputDataSourceClassificationArray(rawMsg json.RawMessage) ( } return fArray, nil } + +func unmarshalStreamInputDataSourceClassificationMap(rawMsg json.RawMessage) (map[string]StreamInputDataSourceClassification, error) { + if rawMsg == nil { + return nil, nil + } + var rawMessages map[string]json.RawMessage + if err := json.Unmarshal(rawMsg, &rawMessages); err != nil { + return nil, err + } + fMap := make(map[string]StreamInputDataSourceClassification, len(rawMessages)) + for key, rawMessage := range rawMessages { + f, err := unmarshalStreamInputDataSourceClassification(rawMessage) + if err != nil { + return nil, err + } + fMap[key] = f + } + return fMap, nil +} diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_privateendpoints_client.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_privateendpoints_client.go index f2d7e0004111..82058c5dd74c 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_privateendpoints_client.go +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_privateendpoints_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // PrivateEndpointsClient contains the methods for the PrivateEndpoints group. @@ -31,8 +31,15 @@ type PrivateEndpointsClient struct { } // NewPrivateEndpointsClient creates a new instance of PrivateEndpointsClient with the specified values. -func NewPrivateEndpointsClient(con *arm.Connection, subscriptionID string) *PrivateEndpointsClient { - return &PrivateEndpointsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewPrivateEndpointsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *PrivateEndpointsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &PrivateEndpointsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Creates a Stream Analytics Private Endpoint or replaces an already existing Private Endpoint. @@ -92,7 +99,7 @@ func (client *PrivateEndpointsClient) createOrUpdateCreateRequest(ctx context.Co func (client *PrivateEndpointsClient) createOrUpdateHandleResponse(resp *http.Response) (PrivateEndpointsCreateOrUpdateResponse, error) { result := PrivateEndpointsCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpoint); err != nil { - return PrivateEndpointsCreateOrUpdateResponse{}, err + return PrivateEndpointsCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -241,7 +248,7 @@ func (client *PrivateEndpointsClient) getCreateRequest(ctx context.Context, reso func (client *PrivateEndpointsClient) getHandleResponse(resp *http.Response) (PrivateEndpointsGetResponse, error) { result := PrivateEndpointsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpoint); err != nil { - return PrivateEndpointsGetResponse{}, err + return PrivateEndpointsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -303,7 +310,7 @@ func (client *PrivateEndpointsClient) listByClusterCreateRequest(ctx context.Con func (client *PrivateEndpointsClient) listByClusterHandleResponse(resp *http.Response) (PrivateEndpointsListByClusterResponse, error) { result := PrivateEndpointsListByClusterResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointListResult); err != nil { - return PrivateEndpointsListByClusterResponse{}, err + return PrivateEndpointsListByClusterResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_response_types.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_response_types.go index e2f8d5b61598..190b638835a8 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_response_types.go +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armstreamanalytics import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // ClustersCreateOrUpdatePollerResponse contains the response from method Clusters.CreateOrUpdate. @@ -26,6 +25,8 @@ type ClustersCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ClustersCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClustersCreateOrUpdateResponse, error) { respType := ClustersCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Cluster) @@ -76,6 +77,8 @@ type ClustersDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ClustersDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClustersDeleteResponse, error) { respType := ClustersDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -168,6 +171,8 @@ type ClustersUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l ClustersUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (ClustersUpdateResponse, error) { respType := ClustersUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Cluster) @@ -276,6 +281,8 @@ type FunctionsTestPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l FunctionsTestPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (FunctionsTestResponse, error) { respType := FunctionsTestResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ResourceTestStatus) @@ -386,6 +393,8 @@ type InputsTestPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l InputsTestPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (InputsTestResponse, error) { respType := InputsTestResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ResourceTestStatus) @@ -508,6 +517,8 @@ type OutputsTestPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l OutputsTestPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (OutputsTestResponse, error) { respType := OutputsTestResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.ResourceTestStatus) @@ -584,6 +595,8 @@ type PrivateEndpointsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l PrivateEndpointsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (PrivateEndpointsDeleteResponse, error) { respType := PrivateEndpointsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -652,6 +665,8 @@ type StreamingJobsCreateOrReplacePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StreamingJobsCreateOrReplacePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingJobsCreateOrReplaceResponse, error) { respType := StreamingJobsCreateOrReplaceResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.StreamingJob) @@ -702,6 +717,8 @@ type StreamingJobsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StreamingJobsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingJobsDeleteResponse, error) { respType := StreamingJobsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -784,6 +801,8 @@ type StreamingJobsStartPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StreamingJobsStartPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingJobsStartResponse, error) { respType := StreamingJobsStartResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -828,6 +847,8 @@ type StreamingJobsStopPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StreamingJobsStopPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StreamingJobsStopResponse, error) { respType := StreamingJobsStopResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -910,6 +931,8 @@ type SubscriptionsSampleInputPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SubscriptionsSampleInputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SubscriptionsSampleInputResponse, error) { respType := SubscriptionsSampleInputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SampleInputResult) @@ -960,6 +983,8 @@ type SubscriptionsTestInputPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SubscriptionsTestInputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SubscriptionsTestInputResponse, error) { respType := SubscriptionsTestInputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.TestDatasourceResult) @@ -1010,6 +1035,8 @@ type SubscriptionsTestOutputPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SubscriptionsTestOutputPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SubscriptionsTestOutputResponse, error) { respType := SubscriptionsTestOutputResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.TestDatasourceResult) @@ -1060,6 +1087,8 @@ type SubscriptionsTestQueryPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l SubscriptionsTestQueryPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (SubscriptionsTestQueryResponse, error) { respType := SubscriptionsTestQueryResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.QueryTestingResult) diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_streamingjobs_client.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_streamingjobs_client.go index 9866dd196cc0..2b62d9c5ebc0 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_streamingjobs_client.go +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_streamingjobs_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // StreamingJobsClient contains the methods for the StreamingJobs group. @@ -31,8 +31,15 @@ type StreamingJobsClient struct { } // NewStreamingJobsClient creates a new instance of StreamingJobsClient with the specified values. -func NewStreamingJobsClient(con *arm.Connection, subscriptionID string) *StreamingJobsClient { - return &StreamingJobsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewStreamingJobsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *StreamingJobsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &StreamingJobsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrReplace - Creates a streaming job or replaces an already existing streaming job. @@ -246,7 +253,7 @@ func (client *StreamingJobsClient) getHandleResponse(resp *http.Response) (Strea result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.StreamingJob); err != nil { - return StreamingJobsGetResponse{}, err + return StreamingJobsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -303,7 +310,7 @@ func (client *StreamingJobsClient) listCreateRequest(ctx context.Context, option func (client *StreamingJobsClient) listHandleResponse(resp *http.Response) (StreamingJobsListResponse, error) { result := StreamingJobsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StreamingJobListResult); err != nil { - return StreamingJobsListResponse{}, err + return StreamingJobsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -364,7 +371,7 @@ func (client *StreamingJobsClient) listByResourceGroupCreateRequest(ctx context. func (client *StreamingJobsClient) listByResourceGroupHandleResponse(resp *http.Response) (StreamingJobsListByResourceGroupResponse, error) { result := StreamingJobsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StreamingJobListResult); err != nil { - return StreamingJobsListByResourceGroupResponse{}, err + return StreamingJobsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -591,7 +598,7 @@ func (client *StreamingJobsClient) updateHandleResponse(resp *http.Response) (St result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.StreamingJob); err != nil { - return StreamingJobsUpdateResponse{}, err + return StreamingJobsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_subscriptions_client.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_subscriptions_client.go index d1355732818e..741efd6b7706 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_subscriptions_client.go +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_subscriptions_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // SubscriptionsClient contains the methods for the Subscriptions group. @@ -31,8 +31,15 @@ type SubscriptionsClient struct { } // NewSubscriptionsClient creates a new instance of SubscriptionsClient with the specified values. -func NewSubscriptionsClient(con *arm.Connection, subscriptionID string) *SubscriptionsClient { - return &SubscriptionsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewSubscriptionsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *SubscriptionsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &SubscriptionsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CompileQuery - Compile the Stream Analytics query. @@ -78,7 +85,7 @@ func (client *SubscriptionsClient) compileQueryCreateRequest(ctx context.Context func (client *SubscriptionsClient) compileQueryHandleResponse(resp *http.Response) (SubscriptionsCompileQueryResponse, error) { result := SubscriptionsCompileQueryResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.QueryCompilationResult); err != nil { - return SubscriptionsCompileQueryResponse{}, err + return SubscriptionsCompileQueryResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -139,7 +146,7 @@ func (client *SubscriptionsClient) listQuotasCreateRequest(ctx context.Context, func (client *SubscriptionsClient) listQuotasHandleResponse(resp *http.Response) (SubscriptionsListQuotasResponse, error) { result := SubscriptionsListQuotasResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SubscriptionQuotasListResult); err != nil { - return SubscriptionsListQuotasResponse{}, err + return SubscriptionsListQuotasResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_time_rfc3339.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_time_rfc3339.go index b740116f1050..b34fbfe79225 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armstreamanalytics import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_transformations_client.go b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_transformations_client.go index 76337fd06b0d..c656ad6ce46a 100644 --- a/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_transformations_client.go +++ b/sdk/resourcemanager/streamanalytics/armstreamanalytics/zz_generated_transformations_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TransformationsClient contains the methods for the Transformations group. @@ -30,8 +31,15 @@ type TransformationsClient struct { } // NewTransformationsClient creates a new instance of TransformationsClient with the specified values. -func NewTransformationsClient(con *arm.Connection, subscriptionID string) *TransformationsClient { - return &TransformationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTransformationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TransformationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TransformationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrReplace - Creates a transformation or replaces an already existing transformation under an existing streaming job. @@ -94,7 +102,7 @@ func (client *TransformationsClient) createOrReplaceHandleResponse(resp *http.Re result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.Transformation); err != nil { - return TransformationsCreateOrReplaceResponse{}, err + return TransformationsCreateOrReplaceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -166,7 +174,7 @@ func (client *TransformationsClient) getHandleResponse(resp *http.Response) (Tra result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.Transformation); err != nil { - return TransformationsGetResponse{}, err + return TransformationsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -243,7 +251,7 @@ func (client *TransformationsClient) updateHandleResponse(resp *http.Response) ( result.ETag = &val } if err := runtime.UnmarshalAsJSON(resp, &result.Transformation); err != nil { - return TransformationsUpdateResponse{}, err + return TransformationsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/web/armweb/CHANGELOG.md b/sdk/resourcemanager/web/armweb/CHANGELOG.md index 2f755e4c6a10..f4926dc12836 100644 --- a/sdk/resourcemanager/web/armweb/CHANGELOG.md +++ b/sdk/resourcemanager/web/armweb/CHANGELOG.md @@ -1,4 +1,11 @@ # Release History +## 0.2.0 (2021-10-29) + +### Breaking Changes + +- `arm.Connection` has been removed in `github.com/Azure/azure-sdk-for-go/sdk/azcore/v0.20.0` +- The parameters of `NewXXXClient` has been changed from `(con *arm.Connection, subscriptionID string)` to `(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions)` + ## 0.1.0 (2021-10-08) - To better align with the Azure SDK guidelines (https://azure.github.io/azure-sdk/general_introduction.html), we have decided to change the module path to "github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/web/armweb". Therefore, we are deprecating the old module path (which is "github.com/Azure/azure-sdk-for-go/sdk/web/armweb") to avoid confusion. \ No newline at end of file diff --git a/sdk/resourcemanager/web/armweb/README.md b/sdk/resourcemanager/web/armweb/README.md index 6f2b344ee513..fb6642690b16 100644 --- a/sdk/resourcemanager/web/armweb/README.md +++ b/sdk/resourcemanager/web/armweb/README.md @@ -33,22 +33,21 @@ cred, err := azidentity.NewDefaultAzureCredential(nil) For more information on authentication, please see the documentation for `azidentity` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azidentity). -## Connecting to Azure Web +## Clients -Once you have a credential, create a connection to the desired ARM endpoint. The `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` package provides facilities for connecting with ARM endpoints including public and sovereign clouds as well as Azure Stack. +Azure Web modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your credential. ```go -con := arm.NewDefaultConnection(cred, nil) +client := armweb.NewWebAppsClient(, cred, nil) ``` -For more information on ARM connections, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). - -## Clients - -Azure Web modules consist of one or more clients. A client groups a set of related APIs, providing access to its functionality within the specified subscription. Create one or more clients to access the APIs you require using your `arm.Connection`. +You can use `ClientOptions` in package `github.com/Azure/azure-sdk-for-go/sdk/azcore/arm` to set endpoint to connect with public and sovereign clouds as well as Azure Stack. For more information, please see the documentation for `azcore` at [pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore](https://pkg.go.dev/github.com/Azure/azure-sdk-for-go/sdk/azcore). ```go -client := armweb.NewWebAppsClient(con, "") +options = arm.ClientOptions{ + Host: arm.AzureChina, +} +client := armweb.NewWebAppsClient(, cred, &options) ``` ## Provide Feedback diff --git a/sdk/resourcemanager/web/armweb/autorest.md b/sdk/resourcemanager/web/armweb/autorest.md index 6cf08fde7640..169c34a986b4 100644 --- a/sdk/resourcemanager/web/armweb/autorest.md +++ b/sdk/resourcemanager/web/armweb/autorest.md @@ -5,8 +5,8 @@ ``` yaml azure-arm: true require: -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/web/resource-manager/readme.md -- https://github.com/Azure/azure-rest-api-specs/blob/23b8c3e5ecc0a90bc89f93517d7f45ca0b6881d5/specification/web/resource-manager/readme.go.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/web/resource-manager/readme.md +- https://github.com/Azure/azure-rest-api-specs/blob/69eacf00a36d565d3220d5dd6f4a5293664f1ae9/specification/web/resource-manager/readme.go.md license-header: MICROSOFT_MIT_NO_VERSION -module-version: 0.1.0 +module-version: 0.2.0 ``` \ No newline at end of file diff --git a/sdk/resourcemanager/web/armweb/go.mod b/sdk/resourcemanager/web/armweb/go.mod index 26f433447c91..8dae284c254b 100644 --- a/sdk/resourcemanager/web/armweb/go.mod +++ b/sdk/resourcemanager/web/armweb/go.mod @@ -3,6 +3,6 @@ module github.com/Azure/azure-sdk-for-go/sdk/resourcemanager/web/armweb go 1.16 require ( - github.com/Azure/azure-sdk-for-go v58.0.0+incompatible - github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 + github.com/Azure/azure-sdk-for-go v59.0.0+incompatible + github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 ) diff --git a/sdk/resourcemanager/web/armweb/go.sum b/sdk/resourcemanager/web/armweb/go.sum index 4f0fb709cf31..aa0f0c68fa01 100644 --- a/sdk/resourcemanager/web/armweb/go.sum +++ b/sdk/resourcemanager/web/armweb/go.sum @@ -1,30 +1,37 @@ -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible h1:Cw16jiP4dI+CK761aq44ol4RV5dUiIIXky1+EKpoiVM= -github.com/Azure/azure-sdk-for-go v58.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0 h1:lhSJz9RMbJcTgxifR1hUNJnn6CNYtbgEDtQV22/9RBA= -github.com/Azure/azure-sdk-for-go/sdk/azcore v0.19.0/go.mod h1:h6H6c8enJmmocHUbLiiGY6sx7f9i+X3m1CHdd5c6Rdw= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0 h1:v9p9TfTbf7AwNb5NYQt7hI41IfPoLFiFkLtb+bmGjT0= -github.com/Azure/azure-sdk-for-go/sdk/internal v0.7.0/go.mod h1:yqy467j36fJxcRV2TzfVZ1pCb5vxm4BtZPUdYWe/Xo8= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible h1:I1ULJqny1qQhUBFy11yDXHhW3pLvbhwV0PTn7mjp9V0= +github.com/Azure/azure-sdk-for-go v59.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0 h1:KQgdWmEOmaJKxaUUZwHAYh12t+b+ZJf8q3friycK1kA= +github.com/Azure/azure-sdk-for-go/sdk/azcore v0.20.0/go.mod h1:ZPW/Z0kLCTdDZaDbYTetxc9Cxl/2lNqxYHYNOF2bti0= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1 h1:BUYIbDf/mMZ8945v3QkG3OuqGVyS4Iek0AOLwdRAYoc= +github.com/Azure/azure-sdk-for-go/sdk/internal v0.8.1/go.mod h1:KLF4gFr6DcKFZwSuH8w8yEK6DpFl3LP5rhdvAb7Yz5I= +github.com/davecgh/go-spew v1.1.0 h1:ZDRjVQ15GmhC3fiQ8ni8+OwkZQO4DARzQgrnXU1Liz8= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= -github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/dnaeon/go-vcr v1.2.0/go.mod h1:R4UdLID7HZT3taECzJs4YgbbH6PIGXB6W/sc5OLb6RQ= +github.com/dnaeon/go-vcr v1.1.0/go.mod h1:M7tiix8f0r6mKKJ3Yq/kqU1OYf3MnfmBWVbPx/yU9ko= github.com/modocache/gover v0.0.0-20171022184752-b58185e213c5/go.mod h1:caMODM3PzxT8aQXRPkAt8xlV/e7d7w8GM5g0fa5F0D8= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20201010224723-4f7140c49acb/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b h1:k+E048sYJHyVnsr1GDrRZWQ32D2C7lWs9JRc0bel53A= golang.org/x/net v0.0.0-20210610132358-84b48f89b13b/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6 h1:aRYxNxv6iGQlyVaZmk6ZgYEDa+Jg18DxebPSrd6bg1M= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= -gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo= -gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/sdk/resourcemanager/web/armweb/zz_generated_appservicecertificateorders_client.go b/sdk/resourcemanager/web/armweb/zz_generated_appservicecertificateorders_client.go index 229e7451a4c0..087d38436144 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_appservicecertificateorders_client.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_appservicecertificateorders_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // AppServiceCertificateOrdersClient contains the methods for the AppServiceCertificateOrders group. @@ -31,8 +31,15 @@ type AppServiceCertificateOrdersClient struct { } // NewAppServiceCertificateOrdersClient creates a new instance of AppServiceCertificateOrdersClient with the specified values. -func NewAppServiceCertificateOrdersClient(con *arm.Connection, subscriptionID string) *AppServiceCertificateOrdersClient { - return &AppServiceCertificateOrdersClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAppServiceCertificateOrdersClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AppServiceCertificateOrdersClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AppServiceCertificateOrdersClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Description for Create or update a certificate purchase order. @@ -354,7 +361,7 @@ func (client *AppServiceCertificateOrdersClient) getCreateRequest(ctx context.Co func (client *AppServiceCertificateOrdersClient) getHandleResponse(resp *http.Response) (AppServiceCertificateOrdersGetResponse, error) { result := AppServiceCertificateOrdersGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AppServiceCertificateOrder); err != nil { - return AppServiceCertificateOrdersGetResponse{}, err + return AppServiceCertificateOrdersGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -423,7 +430,7 @@ func (client *AppServiceCertificateOrdersClient) getCertificateCreateRequest(ctx func (client *AppServiceCertificateOrdersClient) getCertificateHandleResponse(resp *http.Response) (AppServiceCertificateOrdersGetCertificateResponse, error) { result := AppServiceCertificateOrdersGetCertificateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AppServiceCertificateResource); err != nil { - return AppServiceCertificateOrdersGetCertificateResponse{}, err + return AppServiceCertificateOrdersGetCertificateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -477,7 +484,7 @@ func (client *AppServiceCertificateOrdersClient) listCreateRequest(ctx context.C func (client *AppServiceCertificateOrdersClient) listHandleResponse(resp *http.Response) (AppServiceCertificateOrdersListResponse, error) { result := AppServiceCertificateOrdersListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AppServiceCertificateOrderCollection); err != nil { - return AppServiceCertificateOrdersListResponse{}, err + return AppServiceCertificateOrdersListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -535,7 +542,7 @@ func (client *AppServiceCertificateOrdersClient) listByResourceGroupCreateReques func (client *AppServiceCertificateOrdersClient) listByResourceGroupHandleResponse(resp *http.Response) (AppServiceCertificateOrdersListByResourceGroupResponse, error) { result := AppServiceCertificateOrdersListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AppServiceCertificateOrderCollection); err != nil { - return AppServiceCertificateOrdersListByResourceGroupResponse{}, err + return AppServiceCertificateOrdersListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -597,7 +604,7 @@ func (client *AppServiceCertificateOrdersClient) listCertificatesCreateRequest(c func (client *AppServiceCertificateOrdersClient) listCertificatesHandleResponse(resp *http.Response) (AppServiceCertificateOrdersListCertificatesResponse, error) { result := AppServiceCertificateOrdersListCertificatesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AppServiceCertificateCollection); err != nil { - return AppServiceCertificateOrdersListCertificatesResponse{}, err + return AppServiceCertificateOrdersListCertificatesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -886,7 +893,7 @@ func (client *AppServiceCertificateOrdersClient) retrieveCertificateActionsCreat func (client *AppServiceCertificateOrdersClient) retrieveCertificateActionsHandleResponse(resp *http.Response) (AppServiceCertificateOrdersRetrieveCertificateActionsResponse, error) { result := AppServiceCertificateOrdersRetrieveCertificateActionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CertificateOrderActionArray); err != nil { - return AppServiceCertificateOrdersRetrieveCertificateActionsResponse{}, err + return AppServiceCertificateOrdersRetrieveCertificateActionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -951,7 +958,7 @@ func (client *AppServiceCertificateOrdersClient) retrieveCertificateEmailHistory func (client *AppServiceCertificateOrdersClient) retrieveCertificateEmailHistoryHandleResponse(resp *http.Response) (AppServiceCertificateOrdersRetrieveCertificateEmailHistoryResponse, error) { result := AppServiceCertificateOrdersRetrieveCertificateEmailHistoryResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CertificateEmailArray); err != nil { - return AppServiceCertificateOrdersRetrieveCertificateEmailHistoryResponse{}, err + return AppServiceCertificateOrdersRetrieveCertificateEmailHistoryResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1022,7 +1029,7 @@ func (client *AppServiceCertificateOrdersClient) retrieveSiteSealCreateRequest(c func (client *AppServiceCertificateOrdersClient) retrieveSiteSealHandleResponse(resp *http.Response) (AppServiceCertificateOrdersRetrieveSiteSealResponse, error) { result := AppServiceCertificateOrdersRetrieveSiteSealResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteSeal); err != nil { - return AppServiceCertificateOrdersRetrieveSiteSealResponse{}, err + return AppServiceCertificateOrdersRetrieveSiteSealResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1087,7 +1094,7 @@ func (client *AppServiceCertificateOrdersClient) updateCreateRequest(ctx context func (client *AppServiceCertificateOrdersClient) updateHandleResponse(resp *http.Response) (AppServiceCertificateOrdersUpdateResponse, error) { result := AppServiceCertificateOrdersUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AppServiceCertificateOrder); err != nil { - return AppServiceCertificateOrdersUpdateResponse{}, err + return AppServiceCertificateOrdersUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1156,7 +1163,7 @@ func (client *AppServiceCertificateOrdersClient) updateCertificateCreateRequest( func (client *AppServiceCertificateOrdersClient) updateCertificateHandleResponse(resp *http.Response) (AppServiceCertificateOrdersUpdateCertificateResponse, error) { result := AppServiceCertificateOrdersUpdateCertificateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AppServiceCertificateResource); err != nil { - return AppServiceCertificateOrdersUpdateCertificateResponse{}, err + return AppServiceCertificateOrdersUpdateCertificateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/web/armweb/zz_generated_appserviceenvironments_client.go b/sdk/resourcemanager/web/armweb/zz_generated_appserviceenvironments_client.go index 0a321f0dae73..e535e1f7e78f 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_appserviceenvironments_client.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_appserviceenvironments_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // AppServiceEnvironmentsClient contains the methods for the AppServiceEnvironments group. @@ -32,8 +32,15 @@ type AppServiceEnvironmentsClient struct { } // NewAppServiceEnvironmentsClient creates a new instance of AppServiceEnvironmentsClient with the specified values. -func NewAppServiceEnvironmentsClient(con *arm.Connection, subscriptionID string) *AppServiceEnvironmentsClient { - return &AppServiceEnvironmentsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAppServiceEnvironmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AppServiceEnvironmentsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AppServiceEnvironmentsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginApproveOrRejectPrivateEndpointConnection - Description for Approves or rejects a private endpoint connection @@ -184,7 +191,7 @@ func (client *AppServiceEnvironmentsClient) changeVnetCreateRequest(ctx context. func (client *AppServiceEnvironmentsClient) changeVnetHandleResponse(resp *http.Response) (AppServiceEnvironmentsChangeVnetResponse, error) { result := AppServiceEnvironmentsChangeVnetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebAppCollection); err != nil { - return AppServiceEnvironmentsChangeVnetResponse{}, err + return AppServiceEnvironmentsChangeVnetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -640,7 +647,7 @@ func (client *AppServiceEnvironmentsClient) getCreateRequest(ctx context.Context func (client *AppServiceEnvironmentsClient) getHandleResponse(resp *http.Response) (AppServiceEnvironmentsGetResponse, error) { result := AppServiceEnvironmentsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AppServiceEnvironmentResource); err != nil { - return AppServiceEnvironmentsGetResponse{}, err + return AppServiceEnvironmentsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -705,7 +712,7 @@ func (client *AppServiceEnvironmentsClient) getAseV3NetworkingConfigurationCreat func (client *AppServiceEnvironmentsClient) getAseV3NetworkingConfigurationHandleResponse(resp *http.Response) (AppServiceEnvironmentsGetAseV3NetworkingConfigurationResponse, error) { result := AppServiceEnvironmentsGetAseV3NetworkingConfigurationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AseV3NetworkingConfiguration); err != nil { - return AppServiceEnvironmentsGetAseV3NetworkingConfigurationResponse{}, err + return AppServiceEnvironmentsGetAseV3NetworkingConfigurationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -774,7 +781,7 @@ func (client *AppServiceEnvironmentsClient) getDiagnosticsItemCreateRequest(ctx func (client *AppServiceEnvironmentsClient) getDiagnosticsItemHandleResponse(resp *http.Response) (AppServiceEnvironmentsGetDiagnosticsItemResponse, error) { result := AppServiceEnvironmentsGetDiagnosticsItemResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HostingEnvironmentDiagnostics); err != nil { - return AppServiceEnvironmentsGetDiagnosticsItemResponse{}, err + return AppServiceEnvironmentsGetDiagnosticsItemResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -836,7 +843,7 @@ func (client *AppServiceEnvironmentsClient) getInboundNetworkDependenciesEndpoin func (client *AppServiceEnvironmentsClient) getInboundNetworkDependenciesEndpointsHandleResponse(resp *http.Response) (AppServiceEnvironmentsGetInboundNetworkDependenciesEndpointsResponse, error) { result := AppServiceEnvironmentsGetInboundNetworkDependenciesEndpointsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.InboundEnvironmentEndpointCollection); err != nil { - return AppServiceEnvironmentsGetInboundNetworkDependenciesEndpointsResponse{}, err + return AppServiceEnvironmentsGetInboundNetworkDependenciesEndpointsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -901,7 +908,7 @@ func (client *AppServiceEnvironmentsClient) getMultiRolePoolCreateRequest(ctx co func (client *AppServiceEnvironmentsClient) getMultiRolePoolHandleResponse(resp *http.Response) (AppServiceEnvironmentsGetMultiRolePoolResponse, error) { result := AppServiceEnvironmentsGetMultiRolePoolResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkerPoolResource); err != nil { - return AppServiceEnvironmentsGetMultiRolePoolResponse{}, err + return AppServiceEnvironmentsGetMultiRolePoolResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -963,7 +970,7 @@ func (client *AppServiceEnvironmentsClient) getOutboundNetworkDependenciesEndpoi func (client *AppServiceEnvironmentsClient) getOutboundNetworkDependenciesEndpointsHandleResponse(resp *http.Response) (AppServiceEnvironmentsGetOutboundNetworkDependenciesEndpointsResponse, error) { result := AppServiceEnvironmentsGetOutboundNetworkDependenciesEndpointsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OutboundEnvironmentEndpointCollection); err != nil { - return AppServiceEnvironmentsGetOutboundNetworkDependenciesEndpointsResponse{}, err + return AppServiceEnvironmentsGetOutboundNetworkDependenciesEndpointsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1032,7 +1039,7 @@ func (client *AppServiceEnvironmentsClient) getPrivateEndpointConnectionCreateRe func (client *AppServiceEnvironmentsClient) getPrivateEndpointConnectionHandleResponse(resp *http.Response) (AppServiceEnvironmentsGetPrivateEndpointConnectionResponse, error) { result := AppServiceEnvironmentsGetPrivateEndpointConnectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RemotePrivateEndpointConnectionARMResource); err != nil { - return AppServiceEnvironmentsGetPrivateEndpointConnectionResponse{}, err + return AppServiceEnvironmentsGetPrivateEndpointConnectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1094,7 +1101,7 @@ func (client *AppServiceEnvironmentsClient) getPrivateEndpointConnectionListCrea func (client *AppServiceEnvironmentsClient) getPrivateEndpointConnectionListHandleResponse(resp *http.Response) (AppServiceEnvironmentsGetPrivateEndpointConnectionListResponse, error) { result := AppServiceEnvironmentsGetPrivateEndpointConnectionListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionCollection); err != nil { - return AppServiceEnvironmentsGetPrivateEndpointConnectionListResponse{}, err + return AppServiceEnvironmentsGetPrivateEndpointConnectionListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1159,7 +1166,7 @@ func (client *AppServiceEnvironmentsClient) getPrivateLinkResourcesCreateRequest func (client *AppServiceEnvironmentsClient) getPrivateLinkResourcesHandleResponse(resp *http.Response) (AppServiceEnvironmentsGetPrivateLinkResourcesResponse, error) { result := AppServiceEnvironmentsGetPrivateLinkResourcesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourcesWrapper); err != nil { - return AppServiceEnvironmentsGetPrivateLinkResourcesResponse{}, err + return AppServiceEnvironmentsGetPrivateLinkResourcesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1224,7 +1231,7 @@ func (client *AppServiceEnvironmentsClient) getVipInfoCreateRequest(ctx context. func (client *AppServiceEnvironmentsClient) getVipInfoHandleResponse(resp *http.Response) (AppServiceEnvironmentsGetVipInfoResponse, error) { result := AppServiceEnvironmentsGetVipInfoResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AddressResponse); err != nil { - return AppServiceEnvironmentsGetVipInfoResponse{}, err + return AppServiceEnvironmentsGetVipInfoResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1293,7 +1300,7 @@ func (client *AppServiceEnvironmentsClient) getWorkerPoolCreateRequest(ctx conte func (client *AppServiceEnvironmentsClient) getWorkerPoolHandleResponse(resp *http.Response) (AppServiceEnvironmentsGetWorkerPoolResponse, error) { result := AppServiceEnvironmentsGetWorkerPoolResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkerPoolResource); err != nil { - return AppServiceEnvironmentsGetWorkerPoolResponse{}, err + return AppServiceEnvironmentsGetWorkerPoolResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1347,7 +1354,7 @@ func (client *AppServiceEnvironmentsClient) listCreateRequest(ctx context.Contex func (client *AppServiceEnvironmentsClient) listHandleResponse(resp *http.Response) (AppServiceEnvironmentsListResponse, error) { result := AppServiceEnvironmentsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AppServiceEnvironmentCollection); err != nil { - return AppServiceEnvironmentsListResponse{}, err + return AppServiceEnvironmentsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1409,7 +1416,7 @@ func (client *AppServiceEnvironmentsClient) listAppServicePlansCreateRequest(ctx func (client *AppServiceEnvironmentsClient) listAppServicePlansHandleResponse(resp *http.Response) (AppServiceEnvironmentsListAppServicePlansResponse, error) { result := AppServiceEnvironmentsListAppServicePlansResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AppServicePlanCollection); err != nil { - return AppServiceEnvironmentsListAppServicePlansResponse{}, err + return AppServiceEnvironmentsListAppServicePlansResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1467,7 +1474,7 @@ func (client *AppServiceEnvironmentsClient) listByResourceGroupCreateRequest(ctx func (client *AppServiceEnvironmentsClient) listByResourceGroupHandleResponse(resp *http.Response) (AppServiceEnvironmentsListByResourceGroupResponse, error) { result := AppServiceEnvironmentsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AppServiceEnvironmentCollection); err != nil { - return AppServiceEnvironmentsListByResourceGroupResponse{}, err + return AppServiceEnvironmentsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1529,7 +1536,7 @@ func (client *AppServiceEnvironmentsClient) listCapacitiesCreateRequest(ctx cont func (client *AppServiceEnvironmentsClient) listCapacitiesHandleResponse(resp *http.Response) (AppServiceEnvironmentsListCapacitiesResponse, error) { result := AppServiceEnvironmentsListCapacitiesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StampCapacityCollection); err != nil { - return AppServiceEnvironmentsListCapacitiesResponse{}, err + return AppServiceEnvironmentsListCapacitiesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1594,7 +1601,7 @@ func (client *AppServiceEnvironmentsClient) listDiagnosticsCreateRequest(ctx con func (client *AppServiceEnvironmentsClient) listDiagnosticsHandleResponse(resp *http.Response) (AppServiceEnvironmentsListDiagnosticsResponse, error) { result := AppServiceEnvironmentsListDiagnosticsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HostingEnvironmentDiagnosticsArray); err != nil { - return AppServiceEnvironmentsListDiagnosticsResponse{}, err + return AppServiceEnvironmentsListDiagnosticsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1656,7 +1663,7 @@ func (client *AppServiceEnvironmentsClient) listMultiRoleMetricDefinitionsCreate func (client *AppServiceEnvironmentsClient) listMultiRoleMetricDefinitionsHandleResponse(resp *http.Response) (AppServiceEnvironmentsListMultiRoleMetricDefinitionsResponse, error) { result := AppServiceEnvironmentsListMultiRoleMetricDefinitionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceMetricDefinitionCollection); err != nil { - return AppServiceEnvironmentsListMultiRoleMetricDefinitionsResponse{}, err + return AppServiceEnvironmentsListMultiRoleMetricDefinitionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1722,7 +1729,7 @@ func (client *AppServiceEnvironmentsClient) listMultiRolePoolInstanceMetricDefin func (client *AppServiceEnvironmentsClient) listMultiRolePoolInstanceMetricDefinitionsHandleResponse(resp *http.Response) (AppServiceEnvironmentsListMultiRolePoolInstanceMetricDefinitionsResponse, error) { result := AppServiceEnvironmentsListMultiRolePoolInstanceMetricDefinitionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceMetricDefinitionCollection); err != nil { - return AppServiceEnvironmentsListMultiRolePoolInstanceMetricDefinitionsResponse{}, err + return AppServiceEnvironmentsListMultiRolePoolInstanceMetricDefinitionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1784,7 +1791,7 @@ func (client *AppServiceEnvironmentsClient) listMultiRolePoolSKUsCreateRequest(c func (client *AppServiceEnvironmentsClient) listMultiRolePoolSKUsHandleResponse(resp *http.Response) (AppServiceEnvironmentsListMultiRolePoolSKUsResponse, error) { result := AppServiceEnvironmentsListMultiRolePoolSKUsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SKUInfoCollection); err != nil { - return AppServiceEnvironmentsListMultiRolePoolSKUsResponse{}, err + return AppServiceEnvironmentsListMultiRolePoolSKUsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1846,7 +1853,7 @@ func (client *AppServiceEnvironmentsClient) listMultiRolePoolsCreateRequest(ctx func (client *AppServiceEnvironmentsClient) listMultiRolePoolsHandleResponse(resp *http.Response) (AppServiceEnvironmentsListMultiRolePoolsResponse, error) { result := AppServiceEnvironmentsListMultiRolePoolsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkerPoolCollection); err != nil { - return AppServiceEnvironmentsListMultiRolePoolsResponse{}, err + return AppServiceEnvironmentsListMultiRolePoolsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1908,7 +1915,7 @@ func (client *AppServiceEnvironmentsClient) listMultiRoleUsagesCreateRequest(ctx func (client *AppServiceEnvironmentsClient) listMultiRoleUsagesHandleResponse(resp *http.Response) (AppServiceEnvironmentsListMultiRoleUsagesResponse, error) { result := AppServiceEnvironmentsListMultiRoleUsagesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UsageCollection); err != nil { - return AppServiceEnvironmentsListMultiRoleUsagesResponse{}, err + return AppServiceEnvironmentsListMultiRoleUsagesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1973,7 +1980,7 @@ func (client *AppServiceEnvironmentsClient) listOperationsCreateRequest(ctx cont func (client *AppServiceEnvironmentsClient) listOperationsHandleResponse(resp *http.Response) (AppServiceEnvironmentsListOperationsResponse, error) { result := AppServiceEnvironmentsListOperationsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.OperationArray); err != nil { - return AppServiceEnvironmentsListOperationsResponse{}, err + return AppServiceEnvironmentsListOperationsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2040,7 +2047,7 @@ func (client *AppServiceEnvironmentsClient) listUsagesCreateRequest(ctx context. func (client *AppServiceEnvironmentsClient) listUsagesHandleResponse(resp *http.Response) (AppServiceEnvironmentsListUsagesResponse, error) { result := AppServiceEnvironmentsListUsagesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CsmUsageQuotaCollection); err != nil { - return AppServiceEnvironmentsListUsagesResponse{}, err + return AppServiceEnvironmentsListUsagesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2105,7 +2112,7 @@ func (client *AppServiceEnvironmentsClient) listWebAppsCreateRequest(ctx context func (client *AppServiceEnvironmentsClient) listWebAppsHandleResponse(resp *http.Response) (AppServiceEnvironmentsListWebAppsResponse, error) { result := AppServiceEnvironmentsListWebAppsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebAppCollection); err != nil { - return AppServiceEnvironmentsListWebAppsResponse{}, err + return AppServiceEnvironmentsListWebAppsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2171,7 +2178,7 @@ func (client *AppServiceEnvironmentsClient) listWebWorkerMetricDefinitionsCreate func (client *AppServiceEnvironmentsClient) listWebWorkerMetricDefinitionsHandleResponse(resp *http.Response) (AppServiceEnvironmentsListWebWorkerMetricDefinitionsResponse, error) { result := AppServiceEnvironmentsListWebWorkerMetricDefinitionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceMetricDefinitionCollection); err != nil { - return AppServiceEnvironmentsListWebWorkerMetricDefinitionsResponse{}, err + return AppServiceEnvironmentsListWebWorkerMetricDefinitionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2237,7 +2244,7 @@ func (client *AppServiceEnvironmentsClient) listWebWorkerUsagesCreateRequest(ctx func (client *AppServiceEnvironmentsClient) listWebWorkerUsagesHandleResponse(resp *http.Response) (AppServiceEnvironmentsListWebWorkerUsagesResponse, error) { result := AppServiceEnvironmentsListWebWorkerUsagesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.UsageCollection); err != nil { - return AppServiceEnvironmentsListWebWorkerUsagesResponse{}, err + return AppServiceEnvironmentsListWebWorkerUsagesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2307,7 +2314,7 @@ func (client *AppServiceEnvironmentsClient) listWorkerPoolInstanceMetricDefiniti func (client *AppServiceEnvironmentsClient) listWorkerPoolInstanceMetricDefinitionsHandleResponse(resp *http.Response) (AppServiceEnvironmentsListWorkerPoolInstanceMetricDefinitionsResponse, error) { result := AppServiceEnvironmentsListWorkerPoolInstanceMetricDefinitionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceMetricDefinitionCollection); err != nil { - return AppServiceEnvironmentsListWorkerPoolInstanceMetricDefinitionsResponse{}, err + return AppServiceEnvironmentsListWorkerPoolInstanceMetricDefinitionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2373,7 +2380,7 @@ func (client *AppServiceEnvironmentsClient) listWorkerPoolSKUsCreateRequest(ctx func (client *AppServiceEnvironmentsClient) listWorkerPoolSKUsHandleResponse(resp *http.Response) (AppServiceEnvironmentsListWorkerPoolSKUsResponse, error) { result := AppServiceEnvironmentsListWorkerPoolSKUsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SKUInfoCollection); err != nil { - return AppServiceEnvironmentsListWorkerPoolSKUsResponse{}, err + return AppServiceEnvironmentsListWorkerPoolSKUsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2435,7 +2442,7 @@ func (client *AppServiceEnvironmentsClient) listWorkerPoolsCreateRequest(ctx con func (client *AppServiceEnvironmentsClient) listWorkerPoolsHandleResponse(resp *http.Response) (AppServiceEnvironmentsListWorkerPoolsResponse, error) { result := AppServiceEnvironmentsListWorkerPoolsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkerPoolCollection); err != nil { - return AppServiceEnvironmentsListWorkerPoolsResponse{}, err + return AppServiceEnvironmentsListWorkerPoolsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2577,7 +2584,7 @@ func (client *AppServiceEnvironmentsClient) resumeCreateRequest(ctx context.Cont func (client *AppServiceEnvironmentsClient) resumeHandleResponse(resp *http.Response) (AppServiceEnvironmentsResumeResponse, error) { result := AppServiceEnvironmentsResumeResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebAppCollection); err != nil { - return AppServiceEnvironmentsResumeResponse{}, err + return AppServiceEnvironmentsResumeResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2663,7 +2670,7 @@ func (client *AppServiceEnvironmentsClient) suspendCreateRequest(ctx context.Con func (client *AppServiceEnvironmentsClient) suspendHandleResponse(resp *http.Response) (AppServiceEnvironmentsSuspendResponse, error) { result := AppServiceEnvironmentsSuspendResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebAppCollection); err != nil { - return AppServiceEnvironmentsSuspendResponse{}, err + return AppServiceEnvironmentsSuspendResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2728,7 +2735,7 @@ func (client *AppServiceEnvironmentsClient) updateCreateRequest(ctx context.Cont func (client *AppServiceEnvironmentsClient) updateHandleResponse(resp *http.Response) (AppServiceEnvironmentsUpdateResponse, error) { result := AppServiceEnvironmentsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AppServiceEnvironmentResource); err != nil { - return AppServiceEnvironmentsUpdateResponse{}, err + return AppServiceEnvironmentsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2793,7 +2800,7 @@ func (client *AppServiceEnvironmentsClient) updateAseNetworkingConfigurationCrea func (client *AppServiceEnvironmentsClient) updateAseNetworkingConfigurationHandleResponse(resp *http.Response) (AppServiceEnvironmentsUpdateAseNetworkingConfigurationResponse, error) { result := AppServiceEnvironmentsUpdateAseNetworkingConfigurationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AseV3NetworkingConfiguration); err != nil { - return AppServiceEnvironmentsUpdateAseNetworkingConfigurationResponse{}, err + return AppServiceEnvironmentsUpdateAseNetworkingConfigurationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2858,7 +2865,7 @@ func (client *AppServiceEnvironmentsClient) updateMultiRolePoolCreateRequest(ctx func (client *AppServiceEnvironmentsClient) updateMultiRolePoolHandleResponse(resp *http.Response) (AppServiceEnvironmentsUpdateMultiRolePoolResponse, error) { result := AppServiceEnvironmentsUpdateMultiRolePoolResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkerPoolResource); err != nil { - return AppServiceEnvironmentsUpdateMultiRolePoolResponse{}, err + return AppServiceEnvironmentsUpdateMultiRolePoolResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2927,7 +2934,7 @@ func (client *AppServiceEnvironmentsClient) updateWorkerPoolCreateRequest(ctx co func (client *AppServiceEnvironmentsClient) updateWorkerPoolHandleResponse(resp *http.Response) (AppServiceEnvironmentsUpdateWorkerPoolResponse, error) { result := AppServiceEnvironmentsUpdateWorkerPoolResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WorkerPoolResource); err != nil { - return AppServiceEnvironmentsUpdateWorkerPoolResponse{}, err + return AppServiceEnvironmentsUpdateWorkerPoolResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/web/armweb/zz_generated_appserviceplans_client.go b/sdk/resourcemanager/web/armweb/zz_generated_appserviceplans_client.go index 0e6ca1717ff7..7951812643ed 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_appserviceplans_client.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_appserviceplans_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // AppServicePlansClient contains the methods for the AppServicePlans group. @@ -32,8 +32,15 @@ type AppServicePlansClient struct { } // NewAppServicePlansClient creates a new instance of AppServicePlansClient with the specified values. -func NewAppServicePlansClient(con *arm.Connection, subscriptionID string) *AppServicePlansClient { - return &AppServicePlansClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewAppServicePlansClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *AppServicePlansClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &AppServicePlansClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Description for Creates or updates an App Service Plan. @@ -167,7 +174,7 @@ func (client *AppServicePlansClient) createOrUpdateVnetRouteCreateRequest(ctx co func (client *AppServicePlansClient) createOrUpdateVnetRouteHandleResponse(resp *http.Response) (AppServicePlansCreateOrUpdateVnetRouteResponse, error) { result := AppServicePlansCreateOrUpdateVnetRouteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetRoute); err != nil { - return AppServicePlansCreateOrUpdateVnetRouteResponse{}, err + return AppServicePlansCreateOrUpdateVnetRouteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -432,7 +439,7 @@ func (client *AppServicePlansClient) getCreateRequest(ctx context.Context, resou func (client *AppServicePlansClient) getHandleResponse(resp *http.Response) (AppServicePlansGetResponse, error) { result := AppServicePlansGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AppServicePlan); err != nil { - return AppServicePlansGetResponse{}, err + return AppServicePlansGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -513,7 +520,7 @@ func (client *AppServicePlansClient) getHybridConnectionCreateRequest(ctx contex func (client *AppServicePlansClient) getHybridConnectionHandleResponse(resp *http.Response) (AppServicePlansGetHybridConnectionResponse, error) { result := AppServicePlansGetHybridConnectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridConnection); err != nil { - return AppServicePlansGetHybridConnectionResponse{}, err + return AppServicePlansGetHybridConnectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -578,7 +585,7 @@ func (client *AppServicePlansClient) getHybridConnectionPlanLimitCreateRequest(c func (client *AppServicePlansClient) getHybridConnectionPlanLimitHandleResponse(resp *http.Response) (AppServicePlansGetHybridConnectionPlanLimitResponse, error) { result := AppServicePlansGetHybridConnectionPlanLimitResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridConnectionLimits); err != nil { - return AppServicePlansGetHybridConnectionPlanLimitResponse{}, err + return AppServicePlansGetHybridConnectionPlanLimitResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -651,7 +658,7 @@ func (client *AppServicePlansClient) getRouteForVnetCreateRequest(ctx context.Co func (client *AppServicePlansClient) getRouteForVnetHandleResponse(resp *http.Response) (AppServicePlansGetRouteForVnetResponse, error) { result := AppServicePlansGetRouteForVnetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetRouteArray); err != nil { - return AppServicePlansGetRouteForVnetResponse{}, err + return AppServicePlansGetRouteForVnetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -724,7 +731,7 @@ func (client *AppServicePlansClient) getServerFarmSKUsCreateRequest(ctx context. func (client *AppServicePlansClient) getServerFarmSKUsHandleResponse(resp *http.Response) (AppServicePlansGetServerFarmSKUsResponse, error) { result := AppServicePlansGetServerFarmSKUsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Object); err != nil { - return AppServicePlansGetServerFarmSKUsResponse{}, err + return AppServicePlansGetServerFarmSKUsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -793,7 +800,7 @@ func (client *AppServicePlansClient) getVnetFromServerFarmCreateRequest(ctx cont func (client *AppServicePlansClient) getVnetFromServerFarmHandleResponse(resp *http.Response) (AppServicePlansGetVnetFromServerFarmResponse, error) { result := AppServicePlansGetVnetFromServerFarmResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetInfoResource); err != nil { - return AppServicePlansGetVnetFromServerFarmResponse{}, err + return AppServicePlansGetVnetFromServerFarmResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -874,7 +881,7 @@ func (client *AppServicePlansClient) getVnetGatewayCreateRequest(ctx context.Con func (client *AppServicePlansClient) getVnetGatewayHandleResponse(resp *http.Response) (AppServicePlansGetVnetGatewayResponse, error) { result := AppServicePlansGetVnetGatewayResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetGateway); err != nil { - return AppServicePlansGetVnetGatewayResponse{}, err + return AppServicePlansGetVnetGatewayResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -931,7 +938,7 @@ func (client *AppServicePlansClient) listCreateRequest(ctx context.Context, opti func (client *AppServicePlansClient) listHandleResponse(resp *http.Response) (AppServicePlansListResponse, error) { result := AppServicePlansListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AppServicePlanCollection); err != nil { - return AppServicePlansListResponse{}, err + return AppServicePlansListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -989,7 +996,7 @@ func (client *AppServicePlansClient) listByResourceGroupCreateRequest(ctx contex func (client *AppServicePlansClient) listByResourceGroupHandleResponse(resp *http.Response) (AppServicePlansListByResourceGroupResponse, error) { result := AppServicePlansListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AppServicePlanCollection); err != nil { - return AppServicePlansListByResourceGroupResponse{}, err + return AppServicePlansListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1054,7 +1061,7 @@ func (client *AppServicePlansClient) listCapabilitiesCreateRequest(ctx context.C func (client *AppServicePlansClient) listCapabilitiesHandleResponse(resp *http.Response) (AppServicePlansListCapabilitiesResponse, error) { result := AppServicePlansListCapabilitiesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CapabilityArray); err != nil { - return AppServicePlansListCapabilitiesResponse{}, err + return AppServicePlansListCapabilitiesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1127,7 +1134,7 @@ func (client *AppServicePlansClient) listHybridConnectionKeysCreateRequest(ctx c func (client *AppServicePlansClient) listHybridConnectionKeysHandleResponse(resp *http.Response) (AppServicePlansListHybridConnectionKeysResponse, error) { result := AppServicePlansListHybridConnectionKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridConnectionKey); err != nil { - return AppServicePlansListHybridConnectionKeysResponse{}, err + return AppServicePlansListHybridConnectionKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1189,7 +1196,7 @@ func (client *AppServicePlansClient) listHybridConnectionsCreateRequest(ctx cont func (client *AppServicePlansClient) listHybridConnectionsHandleResponse(resp *http.Response) (AppServicePlansListHybridConnectionsResponse, error) { result := AppServicePlansListHybridConnectionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridConnectionCollection); err != nil { - return AppServicePlansListHybridConnectionsResponse{}, err + return AppServicePlansListHybridConnectionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1258,7 +1265,7 @@ func (client *AppServicePlansClient) listRoutesForVnetCreateRequest(ctx context. func (client *AppServicePlansClient) listRoutesForVnetHandleResponse(resp *http.Response) (AppServicePlansListRoutesForVnetResponse, error) { result := AppServicePlansListRoutesForVnetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetRouteArray); err != nil { - return AppServicePlansListRoutesForVnetResponse{}, err + return AppServicePlansListRoutesForVnetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1325,7 +1332,7 @@ func (client *AppServicePlansClient) listUsagesCreateRequest(ctx context.Context func (client *AppServicePlansClient) listUsagesHandleResponse(resp *http.Response) (AppServicePlansListUsagesResponse, error) { result := AppServicePlansListUsagesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CsmUsageQuotaCollection); err != nil { - return AppServicePlansListUsagesResponse{}, err + return AppServicePlansListUsagesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1390,7 +1397,7 @@ func (client *AppServicePlansClient) listVnetsCreateRequest(ctx context.Context, func (client *AppServicePlansClient) listVnetsHandleResponse(resp *http.Response) (AppServicePlansListVnetsResponse, error) { result := AppServicePlansListVnetsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetInfoResourceArray); err != nil { - return AppServicePlansListVnetsResponse{}, err + return AppServicePlansListVnetsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1463,7 +1470,7 @@ func (client *AppServicePlansClient) listWebAppsCreateRequest(ctx context.Contex func (client *AppServicePlansClient) listWebAppsHandleResponse(resp *http.Response) (AppServicePlansListWebAppsResponse, error) { result := AppServicePlansListWebAppsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebAppCollection); err != nil { - return AppServicePlansListWebAppsResponse{}, err + return AppServicePlansListWebAppsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1533,7 +1540,7 @@ func (client *AppServicePlansClient) listWebAppsByHybridConnectionCreateRequest( func (client *AppServicePlansClient) listWebAppsByHybridConnectionHandleResponse(resp *http.Response) (AppServicePlansListWebAppsByHybridConnectionResponse, error) { result := AppServicePlansListWebAppsByHybridConnectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceCollection); err != nil { - return AppServicePlansListWebAppsByHybridConnectionResponse{}, err + return AppServicePlansListWebAppsByHybridConnectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1717,7 +1724,7 @@ func (client *AppServicePlansClient) updateCreateRequest(ctx context.Context, re func (client *AppServicePlansClient) updateHandleResponse(resp *http.Response) (AppServicePlansUpdateResponse, error) { result := AppServicePlansUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AppServicePlan); err != nil { - return AppServicePlansUpdateResponse{}, err + return AppServicePlansUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1790,7 +1797,7 @@ func (client *AppServicePlansClient) updateVnetGatewayCreateRequest(ctx context. func (client *AppServicePlansClient) updateVnetGatewayHandleResponse(resp *http.Response) (AppServicePlansUpdateVnetGatewayResponse, error) { result := AppServicePlansUpdateVnetGatewayResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetGateway); err != nil { - return AppServicePlansUpdateVnetGatewayResponse{}, err + return AppServicePlansUpdateVnetGatewayResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1863,7 +1870,7 @@ func (client *AppServicePlansClient) updateVnetRouteCreateRequest(ctx context.Co func (client *AppServicePlansClient) updateVnetRouteHandleResponse(resp *http.Response) (AppServicePlansUpdateVnetRouteResponse, error) { result := AppServicePlansUpdateVnetRouteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetRoute); err != nil { - return AppServicePlansUpdateVnetRouteResponse{}, err + return AppServicePlansUpdateVnetRouteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/web/armweb/zz_generated_certificateordersdiagnostics_client.go b/sdk/resourcemanager/web/armweb/zz_generated_certificateordersdiagnostics_client.go index 7a7c0867317f..677125da0636 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_certificateordersdiagnostics_client.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_certificateordersdiagnostics_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strings" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // CertificateOrdersDiagnosticsClient contains the methods for the CertificateOrdersDiagnostics group. @@ -31,8 +32,15 @@ type CertificateOrdersDiagnosticsClient struct { } // NewCertificateOrdersDiagnosticsClient creates a new instance of CertificateOrdersDiagnosticsClient with the specified values. -func NewCertificateOrdersDiagnosticsClient(con *arm.Connection, subscriptionID string) *CertificateOrdersDiagnosticsClient { - return &CertificateOrdersDiagnosticsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCertificateOrdersDiagnosticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CertificateOrdersDiagnosticsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CertificateOrdersDiagnosticsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetAppServiceCertificateOrderDetectorResponse - Description for Microsoft.CertificateRegistration call to get a detector response from App Lens. @@ -95,7 +103,7 @@ func (client *CertificateOrdersDiagnosticsClient) getAppServiceCertificateOrderD func (client *CertificateOrdersDiagnosticsClient) getAppServiceCertificateOrderDetectorResponseHandleResponse(resp *http.Response) (CertificateOrdersDiagnosticsGetAppServiceCertificateOrderDetectorResponseResponse, error) { result := CertificateOrdersDiagnosticsGetAppServiceCertificateOrderDetectorResponseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DetectorResponse); err != nil { - return CertificateOrdersDiagnosticsGetAppServiceCertificateOrderDetectorResponseResponse{}, err + return CertificateOrdersDiagnosticsGetAppServiceCertificateOrderDetectorResponseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -157,7 +165,7 @@ func (client *CertificateOrdersDiagnosticsClient) listAppServiceCertificateOrder func (client *CertificateOrdersDiagnosticsClient) listAppServiceCertificateOrderDetectorResponseHandleResponse(resp *http.Response) (CertificateOrdersDiagnosticsListAppServiceCertificateOrderDetectorResponseResponse, error) { result := CertificateOrdersDiagnosticsListAppServiceCertificateOrderDetectorResponseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DetectorResponseCollection); err != nil { - return CertificateOrdersDiagnosticsListAppServiceCertificateOrderDetectorResponseResponse{}, err + return CertificateOrdersDiagnosticsListAppServiceCertificateOrderDetectorResponseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/web/armweb/zz_generated_certificateregistrationprovider_client.go b/sdk/resourcemanager/web/armweb/zz_generated_certificateregistrationprovider_client.go index 3eaa6e7b22d2..eab65caa8c73 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_certificateregistrationprovider_client.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_certificateregistrationprovider_client.go @@ -11,11 +11,12 @@ package armweb import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // CertificateRegistrationProviderClient contains the methods for the CertificateRegistrationProvider group. @@ -26,8 +27,15 @@ type CertificateRegistrationProviderClient struct { } // NewCertificateRegistrationProviderClient creates a new instance of CertificateRegistrationProviderClient with the specified values. -func NewCertificateRegistrationProviderClient(con *arm.Connection) *CertificateRegistrationProviderClient { - return &CertificateRegistrationProviderClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewCertificateRegistrationProviderClient(credential azcore.TokenCredential, options *arm.ClientOptions) *CertificateRegistrationProviderClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CertificateRegistrationProviderClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListOperations - Description for Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider @@ -62,7 +70,7 @@ func (client *CertificateRegistrationProviderClient) listOperationsCreateRequest func (client *CertificateRegistrationProviderClient) listOperationsHandleResponse(resp *http.Response) (CertificateRegistrationProviderListOperationsResponse, error) { result := CertificateRegistrationProviderListOperationsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CsmOperationCollection); err != nil { - return CertificateRegistrationProviderListOperationsResponse{}, err + return CertificateRegistrationProviderListOperationsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/web/armweb/zz_generated_certificates_client.go b/sdk/resourcemanager/web/armweb/zz_generated_certificates_client.go index 82e5fcb75df9..a98d4f1b2812 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_certificates_client.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_certificates_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // CertificatesClient contains the methods for the Certificates group. @@ -30,8 +31,15 @@ type CertificatesClient struct { } // NewCertificatesClient creates a new instance of CertificatesClient with the specified values. -func NewCertificatesClient(con *arm.Connection, subscriptionID string) *CertificatesClient { - return &CertificatesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewCertificatesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *CertificatesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &CertificatesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CreateOrUpdate - Description for Create or update a certificate. @@ -81,7 +89,7 @@ func (client *CertificatesClient) createOrUpdateCreateRequest(ctx context.Contex func (client *CertificatesClient) createOrUpdateHandleResponse(resp *http.Response) (CertificatesCreateOrUpdateResponse, error) { result := CertificatesCreateOrUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Certificate); err != nil { - return CertificatesCreateOrUpdateResponse{}, err + return CertificatesCreateOrUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -202,7 +210,7 @@ func (client *CertificatesClient) getCreateRequest(ctx context.Context, resource func (client *CertificatesClient) getHandleResponse(resp *http.Response) (CertificatesGetResponse, error) { result := CertificatesGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Certificate); err != nil { - return CertificatesGetResponse{}, err + return CertificatesGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -261,7 +269,7 @@ func (client *CertificatesClient) listCreateRequest(ctx context.Context, options func (client *CertificatesClient) listHandleResponse(resp *http.Response) (CertificatesListResponse, error) { result := CertificatesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CertificateCollection); err != nil { - return CertificatesListResponse{}, err + return CertificatesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -319,7 +327,7 @@ func (client *CertificatesClient) listByResourceGroupCreateRequest(ctx context.C func (client *CertificatesClient) listByResourceGroupHandleResponse(resp *http.Response) (CertificatesListByResourceGroupResponse, error) { result := CertificatesListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CertificateCollection); err != nil { - return CertificatesListByResourceGroupResponse{}, err + return CertificatesListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -384,7 +392,7 @@ func (client *CertificatesClient) updateCreateRequest(ctx context.Context, resou func (client *CertificatesClient) updateHandleResponse(resp *http.Response) (CertificatesUpdateResponse, error) { result := CertificatesUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Certificate); err != nil { - return CertificatesUpdateResponse{}, err + return CertificatesUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/web/armweb/zz_generated_constants.go b/sdk/resourcemanager/web/armweb/zz_generated_constants.go index 03bda5ce0f7a..8b4b92bc5576 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_constants.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_constants.go @@ -10,7 +10,7 @@ package armweb const ( module = "armweb" - version = "v0.1.0" + version = "v0.2.0" ) type AppServiceCertificateOrderPatchResourcePropertiesAppServiceCertificateNotRenewableReasonsItem string diff --git a/sdk/resourcemanager/web/armweb/zz_generated_deletedwebapps_client.go b/sdk/resourcemanager/web/armweb/zz_generated_deletedwebapps_client.go index 43b6832e54db..1067b8c18b33 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_deletedwebapps_client.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_deletedwebapps_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // DeletedWebAppsClient contains the methods for the DeletedWebApps group. @@ -30,8 +31,15 @@ type DeletedWebAppsClient struct { } // NewDeletedWebAppsClient creates a new instance of DeletedWebAppsClient with the specified values. -func NewDeletedWebAppsClient(con *arm.Connection, subscriptionID string) *DeletedWebAppsClient { - return &DeletedWebAppsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDeletedWebAppsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DeletedWebAppsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DeletedWebAppsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetDeletedWebAppByLocation - Description for Get deleted app for a subscription at location. @@ -81,7 +89,7 @@ func (client *DeletedWebAppsClient) getDeletedWebAppByLocationCreateRequest(ctx func (client *DeletedWebAppsClient) getDeletedWebAppByLocationHandleResponse(resp *http.Response) (DeletedWebAppsGetDeletedWebAppByLocationResponse, error) { result := DeletedWebAppsGetDeletedWebAppByLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeletedSite); err != nil { - return DeletedWebAppsGetDeletedWebAppByLocationResponse{}, err + return DeletedWebAppsGetDeletedWebAppByLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -135,7 +143,7 @@ func (client *DeletedWebAppsClient) listCreateRequest(ctx context.Context, optio func (client *DeletedWebAppsClient) listHandleResponse(resp *http.Response) (DeletedWebAppsListResponse, error) { result := DeletedWebAppsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeletedWebAppCollection); err != nil { - return DeletedWebAppsListResponse{}, err + return DeletedWebAppsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -193,7 +201,7 @@ func (client *DeletedWebAppsClient) listByLocationCreateRequest(ctx context.Cont func (client *DeletedWebAppsClient) listByLocationHandleResponse(resp *http.Response) (DeletedWebAppsListByLocationResponse, error) { result := DeletedWebAppsListByLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeletedWebAppCollection); err != nil { - return DeletedWebAppsListByLocationResponse{}, err + return DeletedWebAppsListByLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/web/armweb/zz_generated_diagnostics_client.go b/sdk/resourcemanager/web/armweb/zz_generated_diagnostics_client.go index 767c45ca269c..d4a2696e8a41 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_diagnostics_client.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_diagnostics_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strings" "time" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // DiagnosticsClient contains the methods for the Diagnostics group. @@ -31,8 +32,15 @@ type DiagnosticsClient struct { } // NewDiagnosticsClient creates a new instance of DiagnosticsClient with the specified values. -func NewDiagnosticsClient(con *arm.Connection, subscriptionID string) *DiagnosticsClient { - return &DiagnosticsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDiagnosticsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DiagnosticsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DiagnosticsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ExecuteSiteAnalysis - Description for Execute Analysis @@ -99,7 +107,7 @@ func (client *DiagnosticsClient) executeSiteAnalysisCreateRequest(ctx context.Co func (client *DiagnosticsClient) executeSiteAnalysisHandleResponse(resp *http.Response) (DiagnosticsExecuteSiteAnalysisResponse, error) { result := DiagnosticsExecuteSiteAnalysisResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticAnalysis); err != nil { - return DiagnosticsExecuteSiteAnalysisResponse{}, err + return DiagnosticsExecuteSiteAnalysisResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -185,7 +193,7 @@ func (client *DiagnosticsClient) executeSiteAnalysisSlotCreateRequest(ctx contex func (client *DiagnosticsClient) executeSiteAnalysisSlotHandleResponse(resp *http.Response) (DiagnosticsExecuteSiteAnalysisSlotResponse, error) { result := DiagnosticsExecuteSiteAnalysisSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticAnalysis); err != nil { - return DiagnosticsExecuteSiteAnalysisSlotResponse{}, err + return DiagnosticsExecuteSiteAnalysisSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -267,7 +275,7 @@ func (client *DiagnosticsClient) executeSiteDetectorCreateRequest(ctx context.Co func (client *DiagnosticsClient) executeSiteDetectorHandleResponse(resp *http.Response) (DiagnosticsExecuteSiteDetectorResponse, error) { result := DiagnosticsExecuteSiteDetectorResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticDetectorResponse); err != nil { - return DiagnosticsExecuteSiteDetectorResponse{}, err + return DiagnosticsExecuteSiteDetectorResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -353,7 +361,7 @@ func (client *DiagnosticsClient) executeSiteDetectorSlotCreateRequest(ctx contex func (client *DiagnosticsClient) executeSiteDetectorSlotHandleResponse(resp *http.Response) (DiagnosticsExecuteSiteDetectorSlotResponse, error) { result := DiagnosticsExecuteSiteDetectorSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticDetectorResponse); err != nil { - return DiagnosticsExecuteSiteDetectorSlotResponse{}, err + return DiagnosticsExecuteSiteDetectorSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -431,7 +439,7 @@ func (client *DiagnosticsClient) getHostingEnvironmentDetectorResponseCreateRequ func (client *DiagnosticsClient) getHostingEnvironmentDetectorResponseHandleResponse(resp *http.Response) (DiagnosticsGetHostingEnvironmentDetectorResponseResponse, error) { result := DiagnosticsGetHostingEnvironmentDetectorResponseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DetectorResponse); err != nil { - return DiagnosticsGetHostingEnvironmentDetectorResponseResponse{}, err + return DiagnosticsGetHostingEnvironmentDetectorResponseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -504,7 +512,7 @@ func (client *DiagnosticsClient) getSiteAnalysisCreateRequest(ctx context.Contex func (client *DiagnosticsClient) getSiteAnalysisHandleResponse(resp *http.Response) (DiagnosticsGetSiteAnalysisResponse, error) { result := DiagnosticsGetSiteAnalysisResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AnalysisDefinition); err != nil { - return DiagnosticsGetSiteAnalysisResponse{}, err + return DiagnosticsGetSiteAnalysisResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -581,7 +589,7 @@ func (client *DiagnosticsClient) getSiteAnalysisSlotCreateRequest(ctx context.Co func (client *DiagnosticsClient) getSiteAnalysisSlotHandleResponse(resp *http.Response) (DiagnosticsGetSiteAnalysisSlotResponse, error) { result := DiagnosticsGetSiteAnalysisSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AnalysisDefinition); err != nil { - return DiagnosticsGetSiteAnalysisSlotResponse{}, err + return DiagnosticsGetSiteAnalysisSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -654,7 +662,7 @@ func (client *DiagnosticsClient) getSiteDetectorCreateRequest(ctx context.Contex func (client *DiagnosticsClient) getSiteDetectorHandleResponse(resp *http.Response) (DiagnosticsGetSiteDetectorResponse, error) { result := DiagnosticsGetSiteDetectorResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DetectorDefinitionResource); err != nil { - return DiagnosticsGetSiteDetectorResponse{}, err + return DiagnosticsGetSiteDetectorResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -732,7 +740,7 @@ func (client *DiagnosticsClient) getSiteDetectorResponseCreateRequest(ctx contex func (client *DiagnosticsClient) getSiteDetectorResponseHandleResponse(resp *http.Response) (DiagnosticsGetSiteDetectorResponseResponse, error) { result := DiagnosticsGetSiteDetectorResponseResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DetectorResponse); err != nil { - return DiagnosticsGetSiteDetectorResponseResponse{}, err + return DiagnosticsGetSiteDetectorResponseResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -814,7 +822,7 @@ func (client *DiagnosticsClient) getSiteDetectorResponseSlotCreateRequest(ctx co func (client *DiagnosticsClient) getSiteDetectorResponseSlotHandleResponse(resp *http.Response) (DiagnosticsGetSiteDetectorResponseSlotResponse, error) { result := DiagnosticsGetSiteDetectorResponseSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DetectorResponse); err != nil { - return DiagnosticsGetSiteDetectorResponseSlotResponse{}, err + return DiagnosticsGetSiteDetectorResponseSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -891,7 +899,7 @@ func (client *DiagnosticsClient) getSiteDetectorSlotCreateRequest(ctx context.Co func (client *DiagnosticsClient) getSiteDetectorSlotHandleResponse(resp *http.Response) (DiagnosticsGetSiteDetectorSlotResponse, error) { result := DiagnosticsGetSiteDetectorSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DetectorDefinitionResource); err != nil { - return DiagnosticsGetSiteDetectorSlotResponse{}, err + return DiagnosticsGetSiteDetectorSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -960,7 +968,7 @@ func (client *DiagnosticsClient) getSiteDiagnosticCategoryCreateRequest(ctx cont func (client *DiagnosticsClient) getSiteDiagnosticCategoryHandleResponse(resp *http.Response) (DiagnosticsGetSiteDiagnosticCategoryResponse, error) { result := DiagnosticsGetSiteDiagnosticCategoryResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticCategory); err != nil { - return DiagnosticsGetSiteDiagnosticCategoryResponse{}, err + return DiagnosticsGetSiteDiagnosticCategoryResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1033,7 +1041,7 @@ func (client *DiagnosticsClient) getSiteDiagnosticCategorySlotCreateRequest(ctx func (client *DiagnosticsClient) getSiteDiagnosticCategorySlotHandleResponse(resp *http.Response) (DiagnosticsGetSiteDiagnosticCategorySlotResponse, error) { result := DiagnosticsGetSiteDiagnosticCategorySlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticCategory); err != nil { - return DiagnosticsGetSiteDiagnosticCategorySlotResponse{}, err + return DiagnosticsGetSiteDiagnosticCategorySlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1095,7 +1103,7 @@ func (client *DiagnosticsClient) listHostingEnvironmentDetectorResponsesCreateRe func (client *DiagnosticsClient) listHostingEnvironmentDetectorResponsesHandleResponse(resp *http.Response) (DiagnosticsListHostingEnvironmentDetectorResponsesResponse, error) { result := DiagnosticsListHostingEnvironmentDetectorResponsesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DetectorResponseCollection); err != nil { - return DiagnosticsListHostingEnvironmentDetectorResponsesResponse{}, err + return DiagnosticsListHostingEnvironmentDetectorResponsesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1161,7 +1169,7 @@ func (client *DiagnosticsClient) listSiteAnalysesCreateRequest(ctx context.Conte func (client *DiagnosticsClient) listSiteAnalysesHandleResponse(resp *http.Response) (DiagnosticsListSiteAnalysesResponse, error) { result := DiagnosticsListSiteAnalysesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticAnalysisCollection); err != nil { - return DiagnosticsListSiteAnalysesResponse{}, err + return DiagnosticsListSiteAnalysesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1231,7 +1239,7 @@ func (client *DiagnosticsClient) listSiteAnalysesSlotCreateRequest(ctx context.C func (client *DiagnosticsClient) listSiteAnalysesSlotHandleResponse(resp *http.Response) (DiagnosticsListSiteAnalysesSlotResponse, error) { result := DiagnosticsListSiteAnalysesSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticAnalysisCollection); err != nil { - return DiagnosticsListSiteAnalysesSlotResponse{}, err + return DiagnosticsListSiteAnalysesSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1293,7 +1301,7 @@ func (client *DiagnosticsClient) listSiteDetectorResponsesCreateRequest(ctx cont func (client *DiagnosticsClient) listSiteDetectorResponsesHandleResponse(resp *http.Response) (DiagnosticsListSiteDetectorResponsesResponse, error) { result := DiagnosticsListSiteDetectorResponsesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DetectorResponseCollection); err != nil { - return DiagnosticsListSiteDetectorResponsesResponse{}, err + return DiagnosticsListSiteDetectorResponsesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1359,7 +1367,7 @@ func (client *DiagnosticsClient) listSiteDetectorResponsesSlotCreateRequest(ctx func (client *DiagnosticsClient) listSiteDetectorResponsesSlotHandleResponse(resp *http.Response) (DiagnosticsListSiteDetectorResponsesSlotResponse, error) { result := DiagnosticsListSiteDetectorResponsesSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DetectorResponseCollection); err != nil { - return DiagnosticsListSiteDetectorResponsesSlotResponse{}, err + return DiagnosticsListSiteDetectorResponsesSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1425,7 +1433,7 @@ func (client *DiagnosticsClient) listSiteDetectorsCreateRequest(ctx context.Cont func (client *DiagnosticsClient) listSiteDetectorsHandleResponse(resp *http.Response) (DiagnosticsListSiteDetectorsResponse, error) { result := DiagnosticsListSiteDetectorsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticDetectorCollection); err != nil { - return DiagnosticsListSiteDetectorsResponse{}, err + return DiagnosticsListSiteDetectorsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1495,7 +1503,7 @@ func (client *DiagnosticsClient) listSiteDetectorsSlotCreateRequest(ctx context. func (client *DiagnosticsClient) listSiteDetectorsSlotHandleResponse(resp *http.Response) (DiagnosticsListSiteDetectorsSlotResponse, error) { result := DiagnosticsListSiteDetectorsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticDetectorCollection); err != nil { - return DiagnosticsListSiteDetectorsSlotResponse{}, err + return DiagnosticsListSiteDetectorsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1557,7 +1565,7 @@ func (client *DiagnosticsClient) listSiteDiagnosticCategoriesCreateRequest(ctx c func (client *DiagnosticsClient) listSiteDiagnosticCategoriesHandleResponse(resp *http.Response) (DiagnosticsListSiteDiagnosticCategoriesResponse, error) { result := DiagnosticsListSiteDiagnosticCategoriesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticCategoryCollection); err != nil { - return DiagnosticsListSiteDiagnosticCategoriesResponse{}, err + return DiagnosticsListSiteDiagnosticCategoriesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1623,7 +1631,7 @@ func (client *DiagnosticsClient) listSiteDiagnosticCategoriesSlotCreateRequest(c func (client *DiagnosticsClient) listSiteDiagnosticCategoriesSlotHandleResponse(resp *http.Response) (DiagnosticsListSiteDiagnosticCategoriesSlotResponse, error) { result := DiagnosticsListSiteDiagnosticCategoriesSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DiagnosticCategoryCollection); err != nil { - return DiagnosticsListSiteDiagnosticCategoriesSlotResponse{}, err + return DiagnosticsListSiteDiagnosticCategoriesSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/web/armweb/zz_generated_domainregistrationprovider_client.go b/sdk/resourcemanager/web/armweb/zz_generated_domainregistrationprovider_client.go index 1c710964b36b..9bf0cd3a5b6f 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_domainregistrationprovider_client.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_domainregistrationprovider_client.go @@ -11,11 +11,12 @@ package armweb import ( "context" "fmt" - "net/http" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" ) // DomainRegistrationProviderClient contains the methods for the DomainRegistrationProvider group. @@ -26,8 +27,15 @@ type DomainRegistrationProviderClient struct { } // NewDomainRegistrationProviderClient creates a new instance of DomainRegistrationProviderClient with the specified values. -func NewDomainRegistrationProviderClient(con *arm.Connection) *DomainRegistrationProviderClient { - return &DomainRegistrationProviderClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version)} +func NewDomainRegistrationProviderClient(credential azcore.TokenCredential, options *arm.ClientOptions) *DomainRegistrationProviderClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DomainRegistrationProviderClient{ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // ListOperations - Description for Implements Csm operations Api to exposes the list of available Csm Apis under the resource provider @@ -62,7 +70,7 @@ func (client *DomainRegistrationProviderClient) listOperationsCreateRequest(ctx func (client *DomainRegistrationProviderClient) listOperationsHandleResponse(resp *http.Response) (DomainRegistrationProviderListOperationsResponse, error) { result := DomainRegistrationProviderListOperationsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CsmOperationCollection); err != nil { - return DomainRegistrationProviderListOperationsResponse{}, err + return DomainRegistrationProviderListOperationsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/web/armweb/zz_generated_domains_client.go b/sdk/resourcemanager/web/armweb/zz_generated_domains_client.go index 4be1b66d1d8b..ef4b94411464 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_domains_client.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_domains_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // DomainsClient contains the methods for the Domains group. @@ -32,8 +32,15 @@ type DomainsClient struct { } // NewDomainsClient creates a new instance of DomainsClient with the specified values. -func NewDomainsClient(con *arm.Connection, subscriptionID string) *DomainsClient { - return &DomainsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewDomainsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *DomainsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &DomainsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckAvailability - Description for Check if a domain is available for registration. @@ -75,7 +82,7 @@ func (client *DomainsClient) checkAvailabilityCreateRequest(ctx context.Context, func (client *DomainsClient) checkAvailabilityHandleResponse(resp *http.Response) (DomainsCheckAvailabilityResponse, error) { result := DomainsCheckAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DomainAvailabilityCheckResult); err != nil { - return DomainsCheckAvailabilityResponse{}, err + return DomainsCheckAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -220,7 +227,7 @@ func (client *DomainsClient) createOrUpdateOwnershipIdentifierCreateRequest(ctx func (client *DomainsClient) createOrUpdateOwnershipIdentifierHandleResponse(resp *http.Response) (DomainsCreateOrUpdateOwnershipIdentifierResponse, error) { result := DomainsCreateOrUpdateOwnershipIdentifierResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DomainOwnershipIdentifier); err != nil { - return DomainsCreateOrUpdateOwnershipIdentifierResponse{}, err + return DomainsCreateOrUpdateOwnershipIdentifierResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -404,7 +411,7 @@ func (client *DomainsClient) getCreateRequest(ctx context.Context, resourceGroup func (client *DomainsClient) getHandleResponse(resp *http.Response) (DomainsGetResponse, error) { result := DomainsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Domain); err != nil { - return DomainsGetResponse{}, err + return DomainsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -461,7 +468,7 @@ func (client *DomainsClient) getControlCenterSsoRequestCreateRequest(ctx context func (client *DomainsClient) getControlCenterSsoRequestHandleResponse(resp *http.Response) (DomainsGetControlCenterSsoRequestResponse, error) { result := DomainsGetControlCenterSsoRequestResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DomainControlCenterSsoRequest); err != nil { - return DomainsGetControlCenterSsoRequestResponse{}, err + return DomainsGetControlCenterSsoRequestResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -530,7 +537,7 @@ func (client *DomainsClient) getOwnershipIdentifierCreateRequest(ctx context.Con func (client *DomainsClient) getOwnershipIdentifierHandleResponse(resp *http.Response) (DomainsGetOwnershipIdentifierResponse, error) { result := DomainsGetOwnershipIdentifierResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DomainOwnershipIdentifier); err != nil { - return DomainsGetOwnershipIdentifierResponse{}, err + return DomainsGetOwnershipIdentifierResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -584,7 +591,7 @@ func (client *DomainsClient) listCreateRequest(ctx context.Context, options *Dom func (client *DomainsClient) listHandleResponse(resp *http.Response) (DomainsListResponse, error) { result := DomainsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DomainCollection); err != nil { - return DomainsListResponse{}, err + return DomainsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -642,7 +649,7 @@ func (client *DomainsClient) listByResourceGroupCreateRequest(ctx context.Contex func (client *DomainsClient) listByResourceGroupHandleResponse(resp *http.Response) (DomainsListByResourceGroupResponse, error) { result := DomainsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DomainCollection); err != nil { - return DomainsListByResourceGroupResponse{}, err + return DomainsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -704,7 +711,7 @@ func (client *DomainsClient) listOwnershipIdentifiersCreateRequest(ctx context.C func (client *DomainsClient) listOwnershipIdentifiersHandleResponse(resp *http.Response) (DomainsListOwnershipIdentifiersResponse, error) { result := DomainsListOwnershipIdentifiersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DomainOwnershipIdentifierCollection); err != nil { - return DomainsListOwnershipIdentifiersResponse{}, err + return DomainsListOwnershipIdentifiersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -758,7 +765,7 @@ func (client *DomainsClient) listRecommendationsCreateRequest(ctx context.Contex func (client *DomainsClient) listRecommendationsHandleResponse(resp *http.Response) (DomainsListRecommendationsResponse, error) { result := DomainsListRecommendationsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NameIdentifierCollection); err != nil { - return DomainsListRecommendationsResponse{}, err + return DomainsListRecommendationsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -879,7 +886,7 @@ func (client *DomainsClient) updateCreateRequest(ctx context.Context, resourceGr func (client *DomainsClient) updateHandleResponse(resp *http.Response) (DomainsUpdateResponse, error) { result := DomainsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Domain); err != nil { - return DomainsUpdateResponse{}, err + return DomainsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -948,7 +955,7 @@ func (client *DomainsClient) updateOwnershipIdentifierCreateRequest(ctx context. func (client *DomainsClient) updateOwnershipIdentifierHandleResponse(resp *http.Response) (DomainsUpdateOwnershipIdentifierResponse, error) { result := DomainsUpdateOwnershipIdentifierResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DomainOwnershipIdentifier); err != nil { - return DomainsUpdateOwnershipIdentifierResponse{}, err + return DomainsUpdateOwnershipIdentifierResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/web/armweb/zz_generated_global_client.go b/sdk/resourcemanager/web/armweb/zz_generated_global_client.go index 2fc07a7c8b81..05d0bd3f0dc8 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_global_client.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_global_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // GlobalClient contains the methods for the Global group. @@ -30,8 +31,15 @@ type GlobalClient struct { } // NewGlobalClient creates a new instance of GlobalClient with the specified values. -func NewGlobalClient(con *arm.Connection, subscriptionID string) *GlobalClient { - return &GlobalClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewGlobalClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *GlobalClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &GlobalClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetDeletedWebApp - Description for Get deleted app for a subscription. @@ -77,7 +85,7 @@ func (client *GlobalClient) getDeletedWebAppCreateRequest(ctx context.Context, d func (client *GlobalClient) getDeletedWebAppHandleResponse(resp *http.Response) (GlobalGetDeletedWebAppResponse, error) { result := GlobalGetDeletedWebAppResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeletedSite); err != nil { - return GlobalGetDeletedWebAppResponse{}, err + return GlobalGetDeletedWebAppResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -138,7 +146,7 @@ func (client *GlobalClient) getDeletedWebAppSnapshotsCreateRequest(ctx context.C func (client *GlobalClient) getDeletedWebAppSnapshotsHandleResponse(resp *http.Response) (GlobalGetDeletedWebAppSnapshotsResponse, error) { result := GlobalGetDeletedWebAppSnapshotsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotArray); err != nil { - return GlobalGetDeletedWebAppSnapshotsResponse{}, err + return GlobalGetDeletedWebAppSnapshotsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/web/armweb/zz_generated_kubeenvironments_client.go b/sdk/resourcemanager/web/armweb/zz_generated_kubeenvironments_client.go index 322555617dca..e8030e2ef61f 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_kubeenvironments_client.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_kubeenvironments_client.go @@ -12,14 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // KubeEnvironmentsClient contains the methods for the KubeEnvironments group. @@ -31,8 +31,15 @@ type KubeEnvironmentsClient struct { } // NewKubeEnvironmentsClient creates a new instance of KubeEnvironmentsClient with the specified values. -func NewKubeEnvironmentsClient(con *arm.Connection, subscriptionID string) *KubeEnvironmentsClient { - return &KubeEnvironmentsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewKubeEnvironmentsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *KubeEnvironmentsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &KubeEnvironmentsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginCreateOrUpdate - Description for Creates or updates a Kubernetes Environment. @@ -234,7 +241,7 @@ func (client *KubeEnvironmentsClient) getCreateRequest(ctx context.Context, reso func (client *KubeEnvironmentsClient) getHandleResponse(resp *http.Response) (KubeEnvironmentsGetResponse, error) { result := KubeEnvironmentsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.KubeEnvironment); err != nil { - return KubeEnvironmentsGetResponse{}, err + return KubeEnvironmentsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -292,7 +299,7 @@ func (client *KubeEnvironmentsClient) listByResourceGroupCreateRequest(ctx conte func (client *KubeEnvironmentsClient) listByResourceGroupHandleResponse(resp *http.Response) (KubeEnvironmentsListByResourceGroupResponse, error) { result := KubeEnvironmentsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.KubeEnvironmentCollection); err != nil { - return KubeEnvironmentsListByResourceGroupResponse{}, err + return KubeEnvironmentsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -346,7 +353,7 @@ func (client *KubeEnvironmentsClient) listBySubscriptionCreateRequest(ctx contex func (client *KubeEnvironmentsClient) listBySubscriptionHandleResponse(resp *http.Response) (KubeEnvironmentsListBySubscriptionResponse, error) { result := KubeEnvironmentsListBySubscriptionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.KubeEnvironmentCollection); err != nil { - return KubeEnvironmentsListBySubscriptionResponse{}, err + return KubeEnvironmentsListBySubscriptionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -411,7 +418,7 @@ func (client *KubeEnvironmentsClient) updateCreateRequest(ctx context.Context, r func (client *KubeEnvironmentsClient) updateHandleResponse(resp *http.Response) (KubeEnvironmentsUpdateResponse, error) { result := KubeEnvironmentsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.KubeEnvironment); err != nil { - return KubeEnvironmentsUpdateResponse{}, err + return KubeEnvironmentsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/web/armweb/zz_generated_models.go b/sdk/resourcemanager/web/armweb/zz_generated_models.go index a27287ea20f2..a051f9e5f88d 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_models.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_models.go @@ -10,11 +10,10 @@ package armweb import ( "encoding/json" - "reflect" - "time" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "reflect" + "time" ) // APIDefinitionInfo - Information about the formal API definition for the app. @@ -93,10 +92,10 @@ type AbnormalTimePeriod struct { // MarshalJSON implements the json.Marshaller interface for type AbnormalTimePeriod. func (a AbnormalTimePeriod) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "endTime", (*timeRFC3339)(a.EndTime)) + populateTimeRFC3339(objectMap, "endTime", a.EndTime) populate(objectMap, "events", a.Events) populate(objectMap, "solutions", a.Solutions) - populate(objectMap, "startTime", (*timeRFC3339)(a.StartTime)) + populateTimeRFC3339(objectMap, "startTime", a.StartTime) return json.Marshal(objectMap) } @@ -110,9 +109,7 @@ func (a *AbnormalTimePeriod) UnmarshalJSON(data []byte) error { var err error switch key { case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.EndTime) delete(rawMsg, key) case "events": err = unpopulate(val, &a.Events) @@ -121,9 +118,7 @@ func (a *AbnormalTimePeriod) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.Solutions) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.StartTime) delete(rawMsg, key) } if err != nil { @@ -446,12 +441,12 @@ func (a AppServiceCertificateOrderPatchResourceProperties) MarshalJSON() ([]byte populate(objectMap, "csr", a.Csr) populate(objectMap, "distinguishedName", a.DistinguishedName) populate(objectMap, "domainVerificationToken", a.DomainVerificationToken) - populate(objectMap, "expirationTime", (*timeRFC3339)(a.ExpirationTime)) + populateTimeRFC3339(objectMap, "expirationTime", a.ExpirationTime) populate(objectMap, "intermediate", a.Intermediate) populate(objectMap, "isPrivateKeyExternal", a.IsPrivateKeyExternal) populate(objectMap, "keySize", a.KeySize) - populate(objectMap, "lastCertificateIssuanceTime", (*timeRFC3339)(a.LastCertificateIssuanceTime)) - populate(objectMap, "nextAutoRenewalTimeStamp", (*timeRFC3339)(a.NextAutoRenewalTimeStamp)) + populateTimeRFC3339(objectMap, "lastCertificateIssuanceTime", a.LastCertificateIssuanceTime) + populateTimeRFC3339(objectMap, "nextAutoRenewalTimeStamp", a.NextAutoRenewalTimeStamp) populate(objectMap, "productType", a.ProductType) populate(objectMap, "provisioningState", a.ProvisioningState) populate(objectMap, "root", a.Root) @@ -493,9 +488,7 @@ func (a *AppServiceCertificateOrderPatchResourceProperties) UnmarshalJSON(data [ err = unpopulate(val, &a.DomainVerificationToken) delete(rawMsg, key) case "expirationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.ExpirationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.ExpirationTime) delete(rawMsg, key) case "intermediate": err = unpopulate(val, &a.Intermediate) @@ -507,14 +500,10 @@ func (a *AppServiceCertificateOrderPatchResourceProperties) UnmarshalJSON(data [ err = unpopulate(val, &a.KeySize) delete(rawMsg, key) case "lastCertificateIssuanceTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.LastCertificateIssuanceTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.LastCertificateIssuanceTime) delete(rawMsg, key) case "nextAutoRenewalTimeStamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.NextAutoRenewalTimeStamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.NextAutoRenewalTimeStamp) delete(rawMsg, key) case "productType": err = unpopulate(val, &a.ProductType) @@ -618,12 +607,12 @@ func (a AppServiceCertificateOrderProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "csr", a.Csr) populate(objectMap, "distinguishedName", a.DistinguishedName) populate(objectMap, "domainVerificationToken", a.DomainVerificationToken) - populate(objectMap, "expirationTime", (*timeRFC3339)(a.ExpirationTime)) + populateTimeRFC3339(objectMap, "expirationTime", a.ExpirationTime) populate(objectMap, "intermediate", a.Intermediate) populate(objectMap, "isPrivateKeyExternal", a.IsPrivateKeyExternal) populate(objectMap, "keySize", a.KeySize) - populate(objectMap, "lastCertificateIssuanceTime", (*timeRFC3339)(a.LastCertificateIssuanceTime)) - populate(objectMap, "nextAutoRenewalTimeStamp", (*timeRFC3339)(a.NextAutoRenewalTimeStamp)) + populateTimeRFC3339(objectMap, "lastCertificateIssuanceTime", a.LastCertificateIssuanceTime) + populateTimeRFC3339(objectMap, "nextAutoRenewalTimeStamp", a.NextAutoRenewalTimeStamp) populate(objectMap, "productType", a.ProductType) populate(objectMap, "provisioningState", a.ProvisioningState) populate(objectMap, "root", a.Root) @@ -665,9 +654,7 @@ func (a *AppServiceCertificateOrderProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, &a.DomainVerificationToken) delete(rawMsg, key) case "expirationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.ExpirationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.ExpirationTime) delete(rawMsg, key) case "intermediate": err = unpopulate(val, &a.Intermediate) @@ -679,14 +666,10 @@ func (a *AppServiceCertificateOrderProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, &a.KeySize) delete(rawMsg, key) case "lastCertificateIssuanceTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.LastCertificateIssuanceTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.LastCertificateIssuanceTime) delete(rawMsg, key) case "nextAutoRenewalTimeStamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.NextAutoRenewalTimeStamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.NextAutoRenewalTimeStamp) delete(rawMsg, key) case "productType": err = unpopulate(val, &a.ProductType) @@ -1335,7 +1318,7 @@ type AppServicePlanPatchResourceProperties struct { func (a AppServicePlanPatchResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "elasticScaleEnabled", a.ElasticScaleEnabled) - populate(objectMap, "freeOfferExpirationTime", (*timeRFC3339)(a.FreeOfferExpirationTime)) + populateTimeRFC3339(objectMap, "freeOfferExpirationTime", a.FreeOfferExpirationTime) populate(objectMap, "geoRegion", a.GeoRegion) populate(objectMap, "hostingEnvironmentProfile", a.HostingEnvironmentProfile) populate(objectMap, "hyperV", a.HyperV) @@ -1349,7 +1332,7 @@ func (a AppServicePlanPatchResourceProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "provisioningState", a.ProvisioningState) populate(objectMap, "reserved", a.Reserved) populate(objectMap, "resourceGroup", a.ResourceGroup) - populate(objectMap, "spotExpirationTime", (*timeRFC3339)(a.SpotExpirationTime)) + populateTimeRFC3339(objectMap, "spotExpirationTime", a.SpotExpirationTime) populate(objectMap, "status", a.Status) populate(objectMap, "subscription", a.Subscription) populate(objectMap, "targetWorkerCount", a.TargetWorkerCount) @@ -1372,9 +1355,7 @@ func (a *AppServicePlanPatchResourceProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, &a.ElasticScaleEnabled) delete(rawMsg, key) case "freeOfferExpirationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.FreeOfferExpirationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.FreeOfferExpirationTime) delete(rawMsg, key) case "geoRegion": err = unpopulate(val, &a.GeoRegion) @@ -1416,9 +1397,7 @@ func (a *AppServicePlanPatchResourceProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, &a.ResourceGroup) delete(rawMsg, key) case "spotExpirationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.SpotExpirationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.SpotExpirationTime) delete(rawMsg, key) case "status": err = unpopulate(val, &a.Status) @@ -1520,7 +1499,7 @@ type AppServicePlanProperties struct { func (a AppServicePlanProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "elasticScaleEnabled", a.ElasticScaleEnabled) - populate(objectMap, "freeOfferExpirationTime", (*timeRFC3339)(a.FreeOfferExpirationTime)) + populateTimeRFC3339(objectMap, "freeOfferExpirationTime", a.FreeOfferExpirationTime) populate(objectMap, "geoRegion", a.GeoRegion) populate(objectMap, "hostingEnvironmentProfile", a.HostingEnvironmentProfile) populate(objectMap, "hyperV", a.HyperV) @@ -1534,7 +1513,7 @@ func (a AppServicePlanProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "provisioningState", a.ProvisioningState) populate(objectMap, "reserved", a.Reserved) populate(objectMap, "resourceGroup", a.ResourceGroup) - populate(objectMap, "spotExpirationTime", (*timeRFC3339)(a.SpotExpirationTime)) + populateTimeRFC3339(objectMap, "spotExpirationTime", a.SpotExpirationTime) populate(objectMap, "status", a.Status) populate(objectMap, "subscription", a.Subscription) populate(objectMap, "targetWorkerCount", a.TargetWorkerCount) @@ -1557,9 +1536,7 @@ func (a *AppServicePlanProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.ElasticScaleEnabled) delete(rawMsg, key) case "freeOfferExpirationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.FreeOfferExpirationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.FreeOfferExpirationTime) delete(rawMsg, key) case "geoRegion": err = unpopulate(val, &a.GeoRegion) @@ -1601,9 +1578,7 @@ func (a *AppServicePlanProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &a.ResourceGroup) delete(rawMsg, key) case "spotExpirationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - a.SpotExpirationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &a.SpotExpirationTime) delete(rawMsg, key) case "status": err = unpopulate(val, &a.Status) @@ -2314,10 +2289,10 @@ func (b BackupItemProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "id", b.BackupID) populate(objectMap, "blobName", b.BlobName) populate(objectMap, "correlationId", b.CorrelationID) - populate(objectMap, "created", (*timeRFC3339)(b.Created)) + populateTimeRFC3339(objectMap, "created", b.Created) populate(objectMap, "databases", b.Databases) - populate(objectMap, "finishedTimeStamp", (*timeRFC3339)(b.FinishedTimeStamp)) - populate(objectMap, "lastRestoreTimeStamp", (*timeRFC3339)(b.LastRestoreTimeStamp)) + populateTimeRFC3339(objectMap, "finishedTimeStamp", b.FinishedTimeStamp) + populateTimeRFC3339(objectMap, "lastRestoreTimeStamp", b.LastRestoreTimeStamp) populate(objectMap, "log", b.Log) populate(objectMap, "name", b.Name) populate(objectMap, "scheduled", b.Scheduled) @@ -2347,22 +2322,16 @@ func (b *BackupItemProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &b.CorrelationID) delete(rawMsg, key) case "created": - var aux timeRFC3339 - err = unpopulate(val, &aux) - b.Created = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &b.Created) delete(rawMsg, key) case "databases": err = unpopulate(val, &b.Databases) delete(rawMsg, key) case "finishedTimeStamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - b.FinishedTimeStamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &b.FinishedTimeStamp) delete(rawMsg, key) case "lastRestoreTimeStamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - b.LastRestoreTimeStamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &b.LastRestoreTimeStamp) delete(rawMsg, key) case "log": err = unpopulate(val, &b.Log) @@ -2465,9 +2434,9 @@ func (b BackupSchedule) MarshalJSON() ([]byte, error) { populate(objectMap, "frequencyInterval", b.FrequencyInterval) populate(objectMap, "frequencyUnit", b.FrequencyUnit) populate(objectMap, "keepAtLeastOneBackup", b.KeepAtLeastOneBackup) - populate(objectMap, "lastExecutionTime", (*timeRFC3339)(b.LastExecutionTime)) + populateTimeRFC3339(objectMap, "lastExecutionTime", b.LastExecutionTime) populate(objectMap, "retentionPeriodInDays", b.RetentionPeriodInDays) - populate(objectMap, "startTime", (*timeRFC3339)(b.StartTime)) + populateTimeRFC3339(objectMap, "startTime", b.StartTime) return json.Marshal(objectMap) } @@ -2490,17 +2459,13 @@ func (b *BackupSchedule) UnmarshalJSON(data []byte) error { err = unpopulate(val, &b.KeepAtLeastOneBackup) delete(rawMsg, key) case "lastExecutionTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - b.LastExecutionTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &b.LastExecutionTime) delete(rawMsg, key) case "retentionPeriodInDays": err = unpopulate(val, &b.RetentionPeriodInDays) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - b.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &b.StartTime) delete(rawMsg, key) } if err != nil { @@ -2650,8 +2615,8 @@ type CertificateDetails struct { func (c CertificateDetails) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "issuer", c.Issuer) - populate(objectMap, "notAfter", (*timeRFC3339)(c.NotAfter)) - populate(objectMap, "notBefore", (*timeRFC3339)(c.NotBefore)) + populateTimeRFC3339(objectMap, "notAfter", c.NotAfter) + populateTimeRFC3339(objectMap, "notBefore", c.NotBefore) populate(objectMap, "rawData", c.RawData) populate(objectMap, "serialNumber", c.SerialNumber) populate(objectMap, "signatureAlgorithm", c.SignatureAlgorithm) @@ -2674,14 +2639,10 @@ func (c *CertificateDetails) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.Issuer) delete(rawMsg, key) case "notAfter": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.NotAfter = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.NotAfter) delete(rawMsg, key) case "notBefore": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.NotBefore = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.NotBefore) delete(rawMsg, key) case "rawData": err = unpopulate(val, &c.RawData) @@ -2737,7 +2698,7 @@ type CertificateEmailProperties struct { func (c CertificateEmailProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "emailId", c.EmailID) - populate(objectMap, "timeStamp", (*timeRFC3339)(c.TimeStamp)) + populateTimeRFC3339(objectMap, "timeStamp", c.TimeStamp) return json.Marshal(objectMap) } @@ -2754,9 +2715,7 @@ func (c *CertificateEmailProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.EmailID) delete(rawMsg, key) case "timeStamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.TimeStamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.TimeStamp) delete(rawMsg, key) } if err != nil { @@ -2794,7 +2753,7 @@ type CertificateOrderActionProperties struct { func (c CertificateOrderActionProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "actionType", c.ActionType) - populate(objectMap, "createdAt", (*timeRFC3339)(c.CreatedAt)) + populateTimeRFC3339(objectMap, "createdAt", c.CreatedAt) return json.Marshal(objectMap) } @@ -2811,9 +2770,7 @@ func (c *CertificateOrderActionProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.ActionType) delete(rawMsg, key) case "createdAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.CreatedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.CreatedAt) delete(rawMsg, key) } if err != nil { @@ -2934,11 +2891,11 @@ func (c CertificatePatchResourceProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "canonicalName", c.CanonicalName) populateByteArray(objectMap, "cerBlob", c.CerBlob, runtime.Base64StdFormat) populate(objectMap, "domainValidationMethod", c.DomainValidationMethod) - populate(objectMap, "expirationDate", (*timeRFC3339)(c.ExpirationDate)) + populateTimeRFC3339(objectMap, "expirationDate", c.ExpirationDate) populate(objectMap, "friendlyName", c.FriendlyName) populate(objectMap, "hostNames", c.HostNames) populate(objectMap, "hostingEnvironmentProfile", c.HostingEnvironmentProfile) - populate(objectMap, "issueDate", (*timeRFC3339)(c.IssueDate)) + populateTimeRFC3339(objectMap, "issueDate", c.IssueDate) populate(objectMap, "issuer", c.Issuer) populate(objectMap, "keyVaultId", c.KeyVaultID) populate(objectMap, "keyVaultSecretName", c.KeyVaultSecretName) @@ -2974,9 +2931,7 @@ func (c *CertificatePatchResourceProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.DomainValidationMethod) delete(rawMsg, key) case "expirationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.ExpirationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.ExpirationDate) delete(rawMsg, key) case "friendlyName": err = unpopulate(val, &c.FriendlyName) @@ -2988,9 +2943,7 @@ func (c *CertificatePatchResourceProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.HostingEnvironmentProfile) delete(rawMsg, key) case "issueDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.IssueDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.IssueDate) delete(rawMsg, key) case "issuer": err = unpopulate(val, &c.Issuer) @@ -3111,11 +3064,11 @@ func (c CertificateProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "canonicalName", c.CanonicalName) populateByteArray(objectMap, "cerBlob", c.CerBlob, runtime.Base64StdFormat) populate(objectMap, "domainValidationMethod", c.DomainValidationMethod) - populate(objectMap, "expirationDate", (*timeRFC3339)(c.ExpirationDate)) + populateTimeRFC3339(objectMap, "expirationDate", c.ExpirationDate) populate(objectMap, "friendlyName", c.FriendlyName) populate(objectMap, "hostNames", c.HostNames) populate(objectMap, "hostingEnvironmentProfile", c.HostingEnvironmentProfile) - populate(objectMap, "issueDate", (*timeRFC3339)(c.IssueDate)) + populateTimeRFC3339(objectMap, "issueDate", c.IssueDate) populate(objectMap, "issuer", c.Issuer) populate(objectMap, "keyVaultId", c.KeyVaultID) populate(objectMap, "keyVaultSecretName", c.KeyVaultSecretName) @@ -3151,9 +3104,7 @@ func (c *CertificateProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.DomainValidationMethod) delete(rawMsg, key) case "expirationDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.ExpirationDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.ExpirationDate) delete(rawMsg, key) case "friendlyName": err = unpopulate(val, &c.FriendlyName) @@ -3165,9 +3116,7 @@ func (c *CertificateProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.HostingEnvironmentProfile) delete(rawMsg, key) case "issueDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.IssueDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.IssueDate) delete(rawMsg, key) case "issuer": err = unpopulate(val, &c.Issuer) @@ -3424,13 +3373,13 @@ type ContainerInfo struct { func (c ContainerInfo) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "currentCpuStats", c.CurrentCPUStats) - populate(objectMap, "currentTimeStamp", (*timeRFC3339)(c.CurrentTimeStamp)) + populateTimeRFC3339(objectMap, "currentTimeStamp", c.CurrentTimeStamp) populate(objectMap, "eth0", c.Eth0) populate(objectMap, "id", c.ID) populate(objectMap, "memoryStats", c.MemoryStats) populate(objectMap, "name", c.Name) populate(objectMap, "previousCpuStats", c.PreviousCPUStats) - populate(objectMap, "previousTimeStamp", (*timeRFC3339)(c.PreviousTimeStamp)) + populateTimeRFC3339(objectMap, "previousTimeStamp", c.PreviousTimeStamp) return json.Marshal(objectMap) } @@ -3447,9 +3396,7 @@ func (c *ContainerInfo) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.CurrentCPUStats) delete(rawMsg, key) case "currentTimeStamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.CurrentTimeStamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.CurrentTimeStamp) delete(rawMsg, key) case "eth0": err = unpopulate(val, &c.Eth0) @@ -3467,9 +3414,7 @@ func (c *ContainerInfo) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.PreviousCPUStats) delete(rawMsg, key) case "previousTimeStamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.PreviousTimeStamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.PreviousTimeStamp) delete(rawMsg, key) } if err != nil { @@ -3730,7 +3675,7 @@ func (c CsmUsageQuota) MarshalJSON() ([]byte, error) { populate(objectMap, "currentValue", c.CurrentValue) populate(objectMap, "limit", c.Limit) populate(objectMap, "name", c.Name) - populate(objectMap, "nextResetTime", (*timeRFC3339)(c.NextResetTime)) + populateTimeRFC3339(objectMap, "nextResetTime", c.NextResetTime) populate(objectMap, "unit", c.Unit) return json.Marshal(objectMap) } @@ -3754,9 +3699,7 @@ func (c *CsmUsageQuota) UnmarshalJSON(data []byte) error { err = unpopulate(val, &c.Name) delete(rawMsg, key) case "nextResetTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - c.NextResetTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &c.NextResetTime) delete(rawMsg, key) case "unit": err = unpopulate(val, &c.Unit) @@ -4212,9 +4155,9 @@ func (d DeploymentProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "author_email", d.AuthorEmail) populate(objectMap, "deployer", d.Deployer) populate(objectMap, "details", d.Details) - populate(objectMap, "end_time", (*timeRFC3339)(d.EndTime)) + populateTimeRFC3339(objectMap, "end_time", d.EndTime) populate(objectMap, "message", d.Message) - populate(objectMap, "start_time", (*timeRFC3339)(d.StartTime)) + populateTimeRFC3339(objectMap, "start_time", d.StartTime) populate(objectMap, "status", d.Status) return json.Marshal(objectMap) } @@ -4244,17 +4187,13 @@ func (d *DeploymentProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.Details) delete(rawMsg, key) case "end_time": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.EndTime) delete(rawMsg, key) case "message": err = unpopulate(val, &d.Message) delete(rawMsg, key) case "start_time": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &d.Status) @@ -4297,13 +4236,13 @@ type DetectorAbnormalTimePeriod struct { // MarshalJSON implements the json.Marshaller interface for type DetectorAbnormalTimePeriod. func (d DetectorAbnormalTimePeriod) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "endTime", (*timeRFC3339)(d.EndTime)) + populateTimeRFC3339(objectMap, "endTime", d.EndTime) populate(objectMap, "message", d.Message) populate(objectMap, "metaData", d.MetaData) populate(objectMap, "priority", d.Priority) populate(objectMap, "solutions", d.Solutions) populate(objectMap, "source", d.Source) - populate(objectMap, "startTime", (*timeRFC3339)(d.StartTime)) + populateTimeRFC3339(objectMap, "startTime", d.StartTime) populate(objectMap, "type", d.Type) return json.Marshal(objectMap) } @@ -4318,9 +4257,7 @@ func (d *DetectorAbnormalTimePeriod) UnmarshalJSON(data []byte) error { var err error switch key { case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.EndTime) delete(rawMsg, key) case "message": err = unpopulate(val, &d.Message) @@ -4338,9 +4275,7 @@ func (d *DetectorAbnormalTimePeriod) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.Source) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.StartTime) delete(rawMsg, key) case "type": err = unpopulate(val, &d.Type) @@ -4543,10 +4478,10 @@ type DiagnosticAnalysisProperties struct { func (d DiagnosticAnalysisProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "abnormalTimePeriods", d.AbnormalTimePeriods) - populate(objectMap, "endTime", (*timeRFC3339)(d.EndTime)) + populateTimeRFC3339(objectMap, "endTime", d.EndTime) populate(objectMap, "nonCorrelatedDetectors", d.NonCorrelatedDetectors) populate(objectMap, "payload", d.Payload) - populate(objectMap, "startTime", (*timeRFC3339)(d.StartTime)) + populateTimeRFC3339(objectMap, "startTime", d.StartTime) return json.Marshal(objectMap) } @@ -4563,9 +4498,7 @@ func (d *DiagnosticAnalysisProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.AbnormalTimePeriods) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.EndTime) delete(rawMsg, key) case "nonCorrelatedDetectors": err = unpopulate(val, &d.NonCorrelatedDetectors) @@ -4574,9 +4507,7 @@ func (d *DiagnosticAnalysisProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.Payload) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.StartTime) delete(rawMsg, key) } if err != nil { @@ -4698,11 +4629,11 @@ func (d DiagnosticDetectorResponseProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "abnormalTimePeriods", d.AbnormalTimePeriods) populate(objectMap, "data", d.Data) populate(objectMap, "detectorDefinition", d.DetectorDefinition) - populate(objectMap, "endTime", (*timeRFC3339)(d.EndTime)) + populateTimeRFC3339(objectMap, "endTime", d.EndTime) populate(objectMap, "issueDetected", d.IssueDetected) populate(objectMap, "metrics", d.Metrics) populate(objectMap, "responseMetaData", d.ResponseMetaData) - populate(objectMap, "startTime", (*timeRFC3339)(d.StartTime)) + populateTimeRFC3339(objectMap, "startTime", d.StartTime) return json.Marshal(objectMap) } @@ -4725,9 +4656,7 @@ func (d *DiagnosticDetectorResponseProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, &d.DetectorDefinition) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.EndTime) delete(rawMsg, key) case "issueDetected": err = unpopulate(val, &d.IssueDetected) @@ -4739,9 +4668,7 @@ func (d *DiagnosticDetectorResponseProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, &d.ResponseMetaData) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.StartTime) delete(rawMsg, key) } if err != nil { @@ -4781,7 +4708,7 @@ func (d DiagnosticMetricSample) MarshalJSON() ([]byte, error) { populate(objectMap, "maximum", d.Maximum) populate(objectMap, "minimum", d.Minimum) populate(objectMap, "roleInstance", d.RoleInstance) - populate(objectMap, "timestamp", (*timeRFC3339)(d.Timestamp)) + populateTimeRFC3339(objectMap, "timestamp", d.Timestamp) populate(objectMap, "total", d.Total) return json.Marshal(objectMap) } @@ -4808,9 +4735,7 @@ func (d *DiagnosticMetricSample) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.RoleInstance) delete(rawMsg, key) case "timestamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.Timestamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.Timestamp) delete(rawMsg, key) case "total": err = unpopulate(val, &d.Total) @@ -4847,9 +4772,9 @@ type DiagnosticMetricSet struct { // MarshalJSON implements the json.Marshaller interface for type DiagnosticMetricSet. func (d DiagnosticMetricSet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "endTime", (*timeRFC3339)(d.EndTime)) + populateTimeRFC3339(objectMap, "endTime", d.EndTime) populate(objectMap, "name", d.Name) - populate(objectMap, "startTime", (*timeRFC3339)(d.StartTime)) + populateTimeRFC3339(objectMap, "startTime", d.StartTime) populate(objectMap, "timeGrain", d.TimeGrain) populate(objectMap, "unit", d.Unit) populate(objectMap, "values", d.Values) @@ -4866,17 +4791,13 @@ func (d *DiagnosticMetricSet) UnmarshalJSON(data []byte) error { var err error switch key { case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.EndTime) delete(rawMsg, key) case "name": err = unpopulate(val, &d.Name) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.StartTime) delete(rawMsg, key) case "timeGrain": err = unpopulate(val, &d.TimeGrain) @@ -5232,12 +5153,12 @@ func (d DomainPatchResourceProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "contactBilling", d.ContactBilling) populate(objectMap, "contactRegistrant", d.ContactRegistrant) populate(objectMap, "contactTech", d.ContactTech) - populate(objectMap, "createdTime", (*timeRFC3339)(d.CreatedTime)) + populateTimeRFC3339(objectMap, "createdTime", d.CreatedTime) populate(objectMap, "dnsType", d.DNSType) populate(objectMap, "dnsZoneId", d.DNSZoneID) populate(objectMap, "domainNotRenewableReasons", d.DomainNotRenewableReasons) - populate(objectMap, "expirationTime", (*timeRFC3339)(d.ExpirationTime)) - populate(objectMap, "lastRenewedTime", (*timeRFC3339)(d.LastRenewedTime)) + populateTimeRFC3339(objectMap, "expirationTime", d.ExpirationTime) + populateTimeRFC3339(objectMap, "lastRenewedTime", d.LastRenewedTime) populate(objectMap, "managedHostNames", d.ManagedHostNames) populate(objectMap, "nameServers", d.NameServers) populate(objectMap, "privacy", d.Privacy) @@ -5279,9 +5200,7 @@ func (d *DomainPatchResourceProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.ContactTech) delete(rawMsg, key) case "createdTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.CreatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.CreatedTime) delete(rawMsg, key) case "dnsType": err = unpopulate(val, &d.DNSType) @@ -5293,14 +5212,10 @@ func (d *DomainPatchResourceProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.DomainNotRenewableReasons) delete(rawMsg, key) case "expirationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.ExpirationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.ExpirationTime) delete(rawMsg, key) case "lastRenewedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.LastRenewedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.LastRenewedTime) delete(rawMsg, key) case "managedHostNames": err = unpopulate(val, &d.ManagedHostNames) @@ -5404,12 +5319,12 @@ func (d DomainProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "contactBilling", d.ContactBilling) populate(objectMap, "contactRegistrant", d.ContactRegistrant) populate(objectMap, "contactTech", d.ContactTech) - populate(objectMap, "createdTime", (*timeRFC3339)(d.CreatedTime)) + populateTimeRFC3339(objectMap, "createdTime", d.CreatedTime) populate(objectMap, "dnsType", d.DNSType) populate(objectMap, "dnsZoneId", d.DNSZoneID) populate(objectMap, "domainNotRenewableReasons", d.DomainNotRenewableReasons) - populate(objectMap, "expirationTime", (*timeRFC3339)(d.ExpirationTime)) - populate(objectMap, "lastRenewedTime", (*timeRFC3339)(d.LastRenewedTime)) + populateTimeRFC3339(objectMap, "expirationTime", d.ExpirationTime) + populateTimeRFC3339(objectMap, "lastRenewedTime", d.LastRenewedTime) populate(objectMap, "managedHostNames", d.ManagedHostNames) populate(objectMap, "nameServers", d.NameServers) populate(objectMap, "privacy", d.Privacy) @@ -5451,9 +5366,7 @@ func (d *DomainProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.ContactTech) delete(rawMsg, key) case "createdTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.CreatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.CreatedTime) delete(rawMsg, key) case "dnsType": err = unpopulate(val, &d.DNSType) @@ -5465,14 +5378,10 @@ func (d *DomainProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &d.DomainNotRenewableReasons) delete(rawMsg, key) case "expirationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.ExpirationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.ExpirationTime) delete(rawMsg, key) case "lastRenewedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.LastRenewedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.LastRenewedTime) delete(rawMsg, key) case "managedHostNames": err = unpopulate(val, &d.ManagedHostNames) @@ -5518,7 +5427,7 @@ type DomainPurchaseConsent struct { // MarshalJSON implements the json.Marshaller interface for type DomainPurchaseConsent. func (d DomainPurchaseConsent) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "agreedAt", (*timeRFC3339)(d.AgreedAt)) + populateTimeRFC3339(objectMap, "agreedAt", d.AgreedAt) populate(objectMap, "agreedBy", d.AgreedBy) populate(objectMap, "agreementKeys", d.AgreementKeys) return json.Marshal(objectMap) @@ -5534,9 +5443,7 @@ func (d *DomainPurchaseConsent) UnmarshalJSON(data []byte) error { var err error switch key { case "agreedAt": - var aux timeRFC3339 - err = unpopulate(val, &aux) - d.AgreedAt = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &d.AgreedAt) delete(rawMsg, key) case "agreedBy": err = unpopulate(val, &d.AgreedBy) @@ -5882,7 +5789,7 @@ func (f FunctionAppRuntimeSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "appInsightsSettings", f.AppInsightsSettings) populate(objectMap, "appSettingsDictionary", f.AppSettingsDictionary) - populate(objectMap, "endOfLifeDate", (*timeRFC3339)(f.EndOfLifeDate)) + populateTimeRFC3339(objectMap, "endOfLifeDate", f.EndOfLifeDate) populate(objectMap, "gitHubActionSettings", f.GitHubActionSettings) populate(objectMap, "isAutoUpdate", f.IsAutoUpdate) populate(objectMap, "isDefault", f.IsDefault) @@ -5913,9 +5820,7 @@ func (f *FunctionAppRuntimeSettings) UnmarshalJSON(data []byte) error { err = unpopulate(val, &f.AppSettingsDictionary) delete(rawMsg, key) case "endOfLifeDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - f.EndOfLifeDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &f.EndOfLifeDate) delete(rawMsg, key) case "gitHubActionSettings": err = unpopulate(val, &f.GitHubActionSettings) @@ -7058,7 +6963,7 @@ type LinuxJavaContainerSettings struct { // MarshalJSON implements the json.Marshaller interface for type LinuxJavaContainerSettings. func (l LinuxJavaContainerSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "endOfLifeDate", (*timeRFC3339)(l.EndOfLifeDate)) + populateTimeRFC3339(objectMap, "endOfLifeDate", l.EndOfLifeDate) populate(objectMap, "isAutoUpdate", l.IsAutoUpdate) populate(objectMap, "isDeprecated", l.IsDeprecated) populate(objectMap, "isEarlyAccess", l.IsEarlyAccess) @@ -7079,9 +6984,7 @@ func (l *LinuxJavaContainerSettings) UnmarshalJSON(data []byte) error { var err error switch key { case "endOfLifeDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - l.EndOfLifeDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &l.EndOfLifeDate) delete(rawMsg, key) case "isAutoUpdate": err = unpopulate(val, &l.IsAutoUpdate) @@ -7273,7 +7176,7 @@ type MSDeployLogEntry struct { func (m MSDeployLogEntry) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "message", m.Message) - populate(objectMap, "time", (*timeRFC3339)(m.Time)) + populateTimeRFC3339(objectMap, "time", m.Time) populate(objectMap, "type", m.Type) return json.Marshal(objectMap) } @@ -7291,9 +7194,7 @@ func (m *MSDeployLogEntry) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.Message) delete(rawMsg, key) case "time": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.Time = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.Time) delete(rawMsg, key) case "type": err = unpopulate(val, &m.Type) @@ -7357,9 +7258,9 @@ func (m MSDeployStatusProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "complete", m.Complete) populate(objectMap, "deployer", m.Deployer) - populate(objectMap, "endTime", (*timeRFC3339)(m.EndTime)) + populateTimeRFC3339(objectMap, "endTime", m.EndTime) populate(objectMap, "provisioningState", m.ProvisioningState) - populate(objectMap, "startTime", (*timeRFC3339)(m.StartTime)) + populateTimeRFC3339(objectMap, "startTime", m.StartTime) return json.Marshal(objectMap) } @@ -7379,17 +7280,13 @@ func (m *MSDeployStatusProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &m.Deployer) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.EndTime) delete(rawMsg, key) case "provisioningState": err = unpopulate(val, &m.ProvisioningState) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - m.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &m.StartTime) delete(rawMsg, key) } if err != nil { @@ -7705,12 +7602,12 @@ type Operation struct { // MarshalJSON implements the json.Marshaller interface for type Operation. func (o Operation) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdTime", (*timeRFC3339)(o.CreatedTime)) + populateTimeRFC3339(objectMap, "createdTime", o.CreatedTime) populate(objectMap, "errors", o.Errors) - populate(objectMap, "expirationTime", (*timeRFC3339)(o.ExpirationTime)) + populateTimeRFC3339(objectMap, "expirationTime", o.ExpirationTime) populate(objectMap, "geoMasterOperationId", o.GeoMasterOperationID) populate(objectMap, "id", o.ID) - populate(objectMap, "modifiedTime", (*timeRFC3339)(o.ModifiedTime)) + populateTimeRFC3339(objectMap, "modifiedTime", o.ModifiedTime) populate(objectMap, "name", o.Name) populate(objectMap, "status", o.Status) return json.Marshal(objectMap) @@ -7726,17 +7623,13 @@ func (o *Operation) UnmarshalJSON(data []byte) error { var err error switch key { case "createdTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - o.CreatedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &o.CreatedTime) delete(rawMsg, key) case "errors": err = unpopulate(val, &o.Errors) delete(rawMsg, key) case "expirationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - o.ExpirationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &o.ExpirationTime) delete(rawMsg, key) case "geoMasterOperationId": err = unpopulate(val, &o.GeoMasterOperationID) @@ -7745,9 +7638,7 @@ func (o *Operation) UnmarshalJSON(data []byte) error { err = unpopulate(val, &o.ID) delete(rawMsg, key) case "modifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - o.ModifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &o.ModifiedTime) delete(rawMsg, key) case "name": err = unpopulate(val, &o.Name) @@ -7842,7 +7733,7 @@ type PerfMonSample struct { func (p PerfMonSample) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "instanceName", p.InstanceName) - populate(objectMap, "time", (*timeRFC3339)(p.Time)) + populateTimeRFC3339(objectMap, "time", p.Time) populate(objectMap, "value", p.Value) return json.Marshal(objectMap) } @@ -7860,9 +7751,7 @@ func (p *PerfMonSample) UnmarshalJSON(data []byte) error { err = unpopulate(val, &p.InstanceName) delete(rawMsg, key) case "time": - var aux timeRFC3339 - err = unpopulate(val, &aux) - p.Time = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &p.Time) delete(rawMsg, key) case "value": err = unpopulate(val, &p.Value) @@ -7896,9 +7785,9 @@ type PerfMonSet struct { // MarshalJSON implements the json.Marshaller interface for type PerfMonSet. func (p PerfMonSet) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "endTime", (*timeRFC3339)(p.EndTime)) + populateTimeRFC3339(objectMap, "endTime", p.EndTime) populate(objectMap, "name", p.Name) - populate(objectMap, "startTime", (*timeRFC3339)(p.StartTime)) + populateTimeRFC3339(objectMap, "startTime", p.StartTime) populate(objectMap, "timeGrain", p.TimeGrain) populate(objectMap, "values", p.Values) return json.Marshal(objectMap) @@ -7914,17 +7803,13 @@ func (p *PerfMonSet) UnmarshalJSON(data []byte) error { var err error switch key { case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - p.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &p.EndTime) delete(rawMsg, key) case "name": err = unpopulate(val, &p.Name) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - p.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &p.StartTime) delete(rawMsg, key) case "timeGrain": err = unpopulate(val, &p.TimeGrain) @@ -8409,10 +8294,10 @@ func (p ProcessInfoProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "peak_working_set", p.PeakWorkingSet) populate(objectMap, "private_memory", p.PrivateMemory) populate(objectMap, "privileged_cpu_time", p.PrivilegedCPUTime) - populate(objectMap, "start_time", (*timeRFC3339)(p.StartTime)) + populateTimeRFC3339(objectMap, "start_time", p.StartTime) populate(objectMap, "thread_count", p.ThreadCount) populate(objectMap, "threads", p.Threads) - populate(objectMap, "time_stamp", (*timeRFC3339)(p.TimeStamp)) + populateTimeRFC3339(objectMap, "time_stamp", p.TimeStamp) populate(objectMap, "total_cpu_time", p.TotalCPUTime) populate(objectMap, "user_cpu_time", p.UserCPUTime) populate(objectMap, "user_name", p.UserName) @@ -8512,9 +8397,7 @@ func (p *ProcessInfoProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &p.PrivilegedCPUTime) delete(rawMsg, key) case "start_time": - var aux timeRFC3339 - err = unpopulate(val, &aux) - p.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &p.StartTime) delete(rawMsg, key) case "thread_count": err = unpopulate(val, &p.ThreadCount) @@ -8523,9 +8406,7 @@ func (p *ProcessInfoProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &p.Threads) delete(rawMsg, key) case "time_stamp": - var aux timeRFC3339 - err = unpopulate(val, &aux) - p.TimeStamp = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &p.TimeStamp) delete(rawMsg, key) case "total_cpu_time": err = unpopulate(val, &p.TotalCPUTime) @@ -8699,7 +8580,7 @@ func (p ProcessThreadInfoProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "priority_level", p.PriorityLevel) populate(objectMap, "process", p.Process) populate(objectMap, "start_address", p.StartAddress) - populate(objectMap, "start_time", (*timeRFC3339)(p.StartTime)) + populateTimeRFC3339(objectMap, "start_time", p.StartTime) populate(objectMap, "state", p.State) populate(objectMap, "total_processor_time", p.TotalProcessorTime) populate(objectMap, "user_processor_time", p.UserProcessorTime) @@ -8738,9 +8619,7 @@ func (p *ProcessThreadInfoProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &p.StartAddress) delete(rawMsg, key) case "start_time": - var aux timeRFC3339 - err = unpopulate(val, &aux) - p.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &p.StartTime) delete(rawMsg, key) case "state": err = unpopulate(val, &p.State) @@ -9126,24 +9005,24 @@ func (r RecommendationProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "bladeName", r.BladeName) populate(objectMap, "categoryTags", r.CategoryTags) populate(objectMap, "channels", r.Channels) - populate(objectMap, "creationTime", (*timeRFC3339)(r.CreationTime)) + populateTimeRFC3339(objectMap, "creationTime", r.CreationTime) populate(objectMap, "displayName", r.DisplayName) populate(objectMap, "enabled", r.Enabled) - populate(objectMap, "endTime", (*timeRFC3339)(r.EndTime)) + populateTimeRFC3339(objectMap, "endTime", r.EndTime) populate(objectMap, "extensionName", r.ExtensionName) populate(objectMap, "forwardLink", r.ForwardLink) populate(objectMap, "isDynamic", r.IsDynamic) populate(objectMap, "level", r.Level) populate(objectMap, "message", r.Message) - populate(objectMap, "nextNotificationTime", (*timeRFC3339)(r.NextNotificationTime)) - populate(objectMap, "notificationExpirationTime", (*timeRFC3339)(r.NotificationExpirationTime)) - populate(objectMap, "notifiedTime", (*timeRFC3339)(r.NotifiedTime)) + populateTimeRFC3339(objectMap, "nextNotificationTime", r.NextNotificationTime) + populateTimeRFC3339(objectMap, "notificationExpirationTime", r.NotificationExpirationTime) + populateTimeRFC3339(objectMap, "notifiedTime", r.NotifiedTime) populate(objectMap, "recommendationId", r.RecommendationID) populate(objectMap, "resourceId", r.ResourceID) populate(objectMap, "resourceScope", r.ResourceScope) populate(objectMap, "ruleName", r.RuleName) populate(objectMap, "score", r.Score) - populate(objectMap, "startTime", (*timeRFC3339)(r.StartTime)) + populateTimeRFC3339(objectMap, "startTime", r.StartTime) populate(objectMap, "states", r.States) return json.Marshal(objectMap) } @@ -9170,9 +9049,7 @@ func (r *RecommendationProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.Channels) delete(rawMsg, key) case "creationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.CreationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.CreationTime) delete(rawMsg, key) case "displayName": err = unpopulate(val, &r.DisplayName) @@ -9181,9 +9058,7 @@ func (r *RecommendationProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.Enabled) delete(rawMsg, key) case "endTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.EndTime) delete(rawMsg, key) case "extensionName": err = unpopulate(val, &r.ExtensionName) @@ -9201,19 +9076,13 @@ func (r *RecommendationProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.Message) delete(rawMsg, key) case "nextNotificationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.NextNotificationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.NextNotificationTime) delete(rawMsg, key) case "notificationExpirationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.NotificationExpirationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.NotificationExpirationTime) delete(rawMsg, key) case "notifiedTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.NotifiedTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.NotifiedTime) delete(rawMsg, key) case "recommendationId": err = unpopulate(val, &r.RecommendationID) @@ -9231,9 +9100,7 @@ func (r *RecommendationProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &r.Score) delete(rawMsg, key) case "startTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - r.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &r.StartTime) delete(rawMsg, key) case "states": err = unpopulate(val, &r.States) @@ -10667,7 +10534,7 @@ func (s SiteConfig) MarshalJSON() ([]byte, error) { populate(objectMap, "remoteDebuggingEnabled", s.RemoteDebuggingEnabled) populate(objectMap, "remoteDebuggingVersion", s.RemoteDebuggingVersion) populate(objectMap, "requestTracingEnabled", s.RequestTracingEnabled) - populate(objectMap, "requestTracingExpirationTime", (*timeRFC3339)(s.RequestTracingExpirationTime)) + populateTimeRFC3339(objectMap, "requestTracingExpirationTime", s.RequestTracingExpirationTime) populate(objectMap, "scmIpSecurityRestrictions", s.ScmIPSecurityRestrictions) populate(objectMap, "scmIpSecurityRestrictionsUseMain", s.ScmIPSecurityRestrictionsUseMain) populate(objectMap, "scmMinTlsVersion", s.ScmMinTLSVersion) @@ -10851,9 +10718,7 @@ func (s *SiteConfig) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.RequestTracingEnabled) delete(rawMsg, key) case "requestTracingExpirationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.RequestTracingExpirationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.RequestTracingExpirationTime) delete(rawMsg, key) case "scmIpSecurityRestrictions": err = unpopulate(val, &s.ScmIPSecurityRestrictions) @@ -10997,7 +10862,7 @@ type SiteConfigurationSnapshotInfoProperties struct { func (s SiteConfigurationSnapshotInfoProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "snapshotId", s.SnapshotID) - populate(objectMap, "time", (*timeRFC3339)(s.Time)) + populateTimeRFC3339(objectMap, "time", s.Time) return json.Marshal(objectMap) } @@ -11014,9 +10879,7 @@ func (s *SiteConfigurationSnapshotInfoProperties) UnmarshalJSON(data []byte) err err = unpopulate(val, &s.SnapshotID) delete(rawMsg, key) case "time": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.Time = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.Time) delete(rawMsg, key) } if err != nil { @@ -11131,14 +10994,14 @@ func (s SiteExtensionInfoProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "extension_url", s.ExtensionURL) populate(objectMap, "feed_url", s.FeedURL) populate(objectMap, "icon_url", s.IconURL) - populate(objectMap, "installed_date_time", (*timeRFC3339)(s.InstalledDateTime)) + populateTimeRFC3339(objectMap, "installed_date_time", s.InstalledDateTime) populate(objectMap, "installer_command_line_params", s.InstallerCommandLineParams) populate(objectMap, "license_url", s.LicenseURL) populate(objectMap, "local_is_latest_version", s.LocalIsLatestVersion) populate(objectMap, "local_path", s.LocalPath) populate(objectMap, "project_url", s.ProjectURL) populate(objectMap, "provisioningState", s.ProvisioningState) - populate(objectMap, "published_date_time", (*timeRFC3339)(s.PublishedDateTime)) + populateTimeRFC3339(objectMap, "published_date_time", s.PublishedDateTime) populate(objectMap, "summary", s.Summary) populate(objectMap, "title", s.Title) populate(objectMap, "version", s.Version) @@ -11182,9 +11045,7 @@ func (s *SiteExtensionInfoProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.IconURL) delete(rawMsg, key) case "installed_date_time": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.InstalledDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.InstalledDateTime) delete(rawMsg, key) case "installer_command_line_params": err = unpopulate(val, &s.InstallerCommandLineParams) @@ -11205,9 +11066,7 @@ func (s *SiteExtensionInfoProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.ProvisioningState) delete(rawMsg, key) case "published_date_time": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.PublishedDateTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.PublishedDateTime) delete(rawMsg, key) case "summary": err = unpopulate(val, &s.Summary) @@ -11460,7 +11319,7 @@ func (s SitePatchResourceProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "isDefaultContainer", s.IsDefaultContainer) populate(objectMap, "isXenon", s.IsXenon) populate(objectMap, "keyVaultReferenceIdentity", s.KeyVaultReferenceIdentity) - populate(objectMap, "lastModifiedTimeUtc", (*timeRFC3339)(s.LastModifiedTimeUTC)) + populateTimeRFC3339(objectMap, "lastModifiedTimeUtc", s.LastModifiedTimeUTC) populate(objectMap, "maxNumberOfWorkers", s.MaxNumberOfWorkers) populate(objectMap, "outboundIpAddresses", s.OutboundIPAddresses) populate(objectMap, "possibleOutboundIpAddresses", s.PossibleOutboundIPAddresses) @@ -11474,7 +11333,7 @@ func (s SitePatchResourceProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "slotSwapStatus", s.SlotSwapStatus) populate(objectMap, "state", s.State) populate(objectMap, "storageAccountRequired", s.StorageAccountRequired) - populate(objectMap, "suspendedTill", (*timeRFC3339)(s.SuspendedTill)) + populateTimeRFC3339(objectMap, "suspendedTill", s.SuspendedTill) populate(objectMap, "targetSwapSlot", s.TargetSwapSlot) populate(objectMap, "trafficManagerHostNames", s.TrafficManagerHostNames) populate(objectMap, "usageState", s.UsageState) @@ -11558,9 +11417,7 @@ func (s *SitePatchResourceProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.KeyVaultReferenceIdentity) delete(rawMsg, key) case "lastModifiedTimeUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedTimeUTC) delete(rawMsg, key) case "maxNumberOfWorkers": err = unpopulate(val, &s.MaxNumberOfWorkers) @@ -11602,9 +11459,7 @@ func (s *SitePatchResourceProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.StorageAccountRequired) delete(rawMsg, key) case "suspendedTill": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.SuspendedTill = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.SuspendedTill) delete(rawMsg, key) case "targetSwapSlot": err = unpopulate(val, &s.TargetSwapSlot) @@ -11814,7 +11669,7 @@ func (s SiteProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "isDefaultContainer", s.IsDefaultContainer) populate(objectMap, "isXenon", s.IsXenon) populate(objectMap, "keyVaultReferenceIdentity", s.KeyVaultReferenceIdentity) - populate(objectMap, "lastModifiedTimeUtc", (*timeRFC3339)(s.LastModifiedTimeUTC)) + populateTimeRFC3339(objectMap, "lastModifiedTimeUtc", s.LastModifiedTimeUTC) populate(objectMap, "maxNumberOfWorkers", s.MaxNumberOfWorkers) populate(objectMap, "outboundIpAddresses", s.OutboundIPAddresses) populate(objectMap, "possibleOutboundIpAddresses", s.PossibleOutboundIPAddresses) @@ -11828,7 +11683,7 @@ func (s SiteProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "slotSwapStatus", s.SlotSwapStatus) populate(objectMap, "state", s.State) populate(objectMap, "storageAccountRequired", s.StorageAccountRequired) - populate(objectMap, "suspendedTill", (*timeRFC3339)(s.SuspendedTill)) + populateTimeRFC3339(objectMap, "suspendedTill", s.SuspendedTill) populate(objectMap, "targetSwapSlot", s.TargetSwapSlot) populate(objectMap, "trafficManagerHostNames", s.TrafficManagerHostNames) populate(objectMap, "usageState", s.UsageState) @@ -11912,9 +11767,7 @@ func (s *SiteProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.KeyVaultReferenceIdentity) delete(rawMsg, key) case "lastModifiedTimeUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastModifiedTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastModifiedTimeUTC) delete(rawMsg, key) case "maxNumberOfWorkers": err = unpopulate(val, &s.MaxNumberOfWorkers) @@ -11956,9 +11809,7 @@ func (s *SiteProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.StorageAccountRequired) delete(rawMsg, key) case "suspendedTill": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.SuspendedTill = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.SuspendedTill) delete(rawMsg, key) case "targetSwapSlot": err = unpopulate(val, &s.TargetSwapSlot) @@ -12145,7 +11996,7 @@ func (s SlotSwapStatus) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "destinationSlotName", s.DestinationSlotName) populate(objectMap, "sourceSlotName", s.SourceSlotName) - populate(objectMap, "timestampUtc", (*timeRFC3339)(s.TimestampUTC)) + populateTimeRFC3339(objectMap, "timestampUtc", s.TimestampUTC) return json.Marshal(objectMap) } @@ -12165,9 +12016,7 @@ func (s *SlotSwapStatus) UnmarshalJSON(data []byte) error { err = unpopulate(val, &s.SourceSlotName) delete(rawMsg, key) case "timestampUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.TimestampUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.TimestampUTC) delete(rawMsg, key) } if err != nil { @@ -12364,7 +12213,7 @@ type SourceControlProperties struct { // MarshalJSON implements the json.Marshaller interface for type SourceControlProperties. func (s SourceControlProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "expirationTime", (*timeRFC3339)(s.ExpirationTime)) + populateTimeRFC3339(objectMap, "expirationTime", s.ExpirationTime) populate(objectMap, "refreshToken", s.RefreshToken) populate(objectMap, "token", s.Token) populate(objectMap, "tokenSecret", s.TokenSecret) @@ -12381,9 +12230,7 @@ func (s *SourceControlProperties) UnmarshalJSON(data []byte) error { var err error switch key { case "expirationTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.ExpirationTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.ExpirationTime) delete(rawMsg, key) case "refreshToken": err = unpopulate(val, &s.RefreshToken) @@ -12653,9 +12500,9 @@ type StaticSiteBuildARMResourceProperties struct { func (s StaticSiteBuildARMResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "buildId", s.BuildID) - populate(objectMap, "createdTimeUtc", (*timeRFC3339)(s.CreatedTimeUTC)) + populateTimeRFC3339(objectMap, "createdTimeUtc", s.CreatedTimeUTC) populate(objectMap, "hostname", s.Hostname) - populate(objectMap, "lastUpdatedOn", (*timeRFC3339)(s.LastUpdatedOn)) + populateTimeRFC3339(objectMap, "lastUpdatedOn", s.LastUpdatedOn) populate(objectMap, "pullRequestTitle", s.PullRequestTitle) populate(objectMap, "sourceBranch", s.SourceBranch) populate(objectMap, "status", s.Status) @@ -12676,17 +12523,13 @@ func (s *StaticSiteBuildARMResourceProperties) UnmarshalJSON(data []byte) error err = unpopulate(val, &s.BuildID) delete(rawMsg, key) case "createdTimeUtc": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedTimeUTC = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedTimeUTC) delete(rawMsg, key) case "hostname": err = unpopulate(val, &s.Hostname) delete(rawMsg, key) case "lastUpdatedOn": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.LastUpdatedOn = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.LastUpdatedOn) delete(rawMsg, key) case "pullRequestTitle": err = unpopulate(val, &s.PullRequestTitle) @@ -12805,7 +12648,7 @@ type StaticSiteCustomDomainOverviewARMResourceProperties struct { // MarshalJSON implements the json.Marshaller interface for type StaticSiteCustomDomainOverviewARMResourceProperties. func (s StaticSiteCustomDomainOverviewARMResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdOn", (*timeRFC3339)(s.CreatedOn)) + populateTimeRFC3339(objectMap, "createdOn", s.CreatedOn) populate(objectMap, "domainName", s.DomainName) populate(objectMap, "errorMessage", s.ErrorMessage) populate(objectMap, "status", s.Status) @@ -12823,9 +12666,7 @@ func (s *StaticSiteCustomDomainOverviewARMResourceProperties) UnmarshalJSON(data var err error switch key { case "createdOn": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedOn = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedOn) delete(rawMsg, key) case "domainName": err = unpopulate(val, &s.DomainName) @@ -13090,7 +12931,7 @@ type StaticSiteUserInvitationResponseResourceProperties struct { // MarshalJSON implements the json.Marshaller interface for type StaticSiteUserInvitationResponseResourceProperties. func (s StaticSiteUserInvitationResponseResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "expiresOn", (*timeRFC3339)(s.ExpiresOn)) + populateTimeRFC3339(objectMap, "expiresOn", s.ExpiresOn) populate(objectMap, "invitationUrl", s.InvitationURL) return json.Marshal(objectMap) } @@ -13105,9 +12946,7 @@ func (s *StaticSiteUserInvitationResponseResourceProperties) UnmarshalJSON(data var err error switch key { case "expiresOn": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.ExpiresOn = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.ExpiresOn) delete(rawMsg, key) case "invitationUrl": err = unpopulate(val, &s.InvitationURL) @@ -13165,7 +13004,7 @@ type StaticSiteUserProvidedFunctionAppARMResourceProperties struct { // MarshalJSON implements the json.Marshaller interface for type StaticSiteUserProvidedFunctionAppARMResourceProperties. func (s StaticSiteUserProvidedFunctionAppARMResourceProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdOn", (*timeRFC3339)(s.CreatedOn)) + populateTimeRFC3339(objectMap, "createdOn", s.CreatedOn) populate(objectMap, "functionAppRegion", s.FunctionAppRegion) populate(objectMap, "functionAppResourceId", s.FunctionAppResourceID) return json.Marshal(objectMap) @@ -13181,9 +13020,7 @@ func (s *StaticSiteUserProvidedFunctionAppARMResourceProperties) UnmarshalJSON(d var err error switch key { case "createdOn": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedOn = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedOn) delete(rawMsg, key) case "functionAppRegion": err = unpopulate(val, &s.FunctionAppRegion) @@ -13214,7 +13051,7 @@ type StaticSiteUserProvidedFunctionAppProperties struct { // MarshalJSON implements the json.Marshaller interface for type StaticSiteUserProvidedFunctionAppProperties. func (s StaticSiteUserProvidedFunctionAppProperties) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "createdOn", (*timeRFC3339)(s.CreatedOn)) + populateTimeRFC3339(objectMap, "createdOn", s.CreatedOn) populate(objectMap, "functionAppRegion", s.FunctionAppRegion) populate(objectMap, "functionAppResourceId", s.FunctionAppResourceID) return json.Marshal(objectMap) @@ -13230,9 +13067,7 @@ func (s *StaticSiteUserProvidedFunctionAppProperties) UnmarshalJSON(data []byte) var err error switch key { case "createdOn": - var aux timeRFC3339 - err = unpopulate(val, &aux) - s.CreatedOn = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &s.CreatedOn) delete(rawMsg, key) case "functionAppRegion": err = unpopulate(val, &s.FunctionAppRegion) @@ -13961,11 +13796,11 @@ type TriggeredJobRun struct { func (t TriggeredJobRun) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "duration", t.Duration) - populate(objectMap, "end_time", (*timeRFC3339)(t.EndTime)) + populateTimeRFC3339(objectMap, "end_time", t.EndTime) populate(objectMap, "error_url", t.ErrorURL) populate(objectMap, "job_name", t.JobName) populate(objectMap, "output_url", t.OutputURL) - populate(objectMap, "start_time", (*timeRFC3339)(t.StartTime)) + populateTimeRFC3339(objectMap, "start_time", t.StartTime) populate(objectMap, "status", t.Status) populate(objectMap, "trigger", t.Trigger) populate(objectMap, "url", t.URL) @@ -13987,9 +13822,7 @@ func (t *TriggeredJobRun) UnmarshalJSON(data []byte) error { err = unpopulate(val, &t.Duration) delete(rawMsg, key) case "end_time": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.EndTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.EndTime) delete(rawMsg, key) case "error_url": err = unpopulate(val, &t.ErrorURL) @@ -14001,9 +13834,7 @@ func (t *TriggeredJobRun) UnmarshalJSON(data []byte) error { err = unpopulate(val, &t.OutputURL) delete(rawMsg, key) case "start_time": - var aux timeRFC3339 - err = unpopulate(val, &aux) - t.StartTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &t.StartTime) delete(rawMsg, key) case "status": err = unpopulate(val, &t.Status) @@ -14194,7 +14025,7 @@ func (u UsageProperties) MarshalJSON() ([]byte, error) { populate(objectMap, "currentValue", u.CurrentValue) populate(objectMap, "displayName", u.DisplayName) populate(objectMap, "limit", u.Limit) - populate(objectMap, "nextResetTime", (*timeRFC3339)(u.NextResetTime)) + populateTimeRFC3339(objectMap, "nextResetTime", u.NextResetTime) populate(objectMap, "resourceName", u.ResourceName) populate(objectMap, "siteMode", u.SiteMode) populate(objectMap, "unit", u.Unit) @@ -14223,9 +14054,7 @@ func (u *UsageProperties) UnmarshalJSON(data []byte) error { err = unpopulate(val, &u.Limit) delete(rawMsg, key) case "nextResetTime": - var aux timeRFC3339 - err = unpopulate(val, &aux) - u.NextResetTime = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &u.NextResetTime) delete(rawMsg, key) case "resourceName": err = unpopulate(val, &u.ResourceName) @@ -14735,7 +14564,7 @@ type WebAppRuntimeSettings struct { func (w WebAppRuntimeSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) populate(objectMap, "appInsightsSettings", w.AppInsightsSettings) - populate(objectMap, "endOfLifeDate", (*timeRFC3339)(w.EndOfLifeDate)) + populateTimeRFC3339(objectMap, "endOfLifeDate", w.EndOfLifeDate) populate(objectMap, "gitHubActionSettings", w.GitHubActionSettings) populate(objectMap, "isAutoUpdate", w.IsAutoUpdate) populate(objectMap, "isDeprecated", w.IsDeprecated) @@ -14760,9 +14589,7 @@ func (w *WebAppRuntimeSettings) UnmarshalJSON(data []byte) error { err = unpopulate(val, &w.AppInsightsSettings) delete(rawMsg, key) case "endOfLifeDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.EndOfLifeDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.EndOfLifeDate) delete(rawMsg, key) case "gitHubActionSettings": err = unpopulate(val, &w.GitHubActionSettings) @@ -17134,7 +16961,7 @@ type WindowsJavaContainerSettings struct { // MarshalJSON implements the json.Marshaller interface for type WindowsJavaContainerSettings. func (w WindowsJavaContainerSettings) MarshalJSON() ([]byte, error) { objectMap := make(map[string]interface{}) - populate(objectMap, "endOfLifeDate", (*timeRFC3339)(w.EndOfLifeDate)) + populateTimeRFC3339(objectMap, "endOfLifeDate", w.EndOfLifeDate) populate(objectMap, "isAutoUpdate", w.IsAutoUpdate) populate(objectMap, "isDeprecated", w.IsDeprecated) populate(objectMap, "isEarlyAccess", w.IsEarlyAccess) @@ -17155,9 +16982,7 @@ func (w *WindowsJavaContainerSettings) UnmarshalJSON(data []byte) error { var err error switch key { case "endOfLifeDate": - var aux timeRFC3339 - err = unpopulate(val, &aux) - w.EndOfLifeDate = (*time.Time)(&aux) + err = unpopulateTimeRFC3339(val, &w.EndOfLifeDate) delete(rawMsg, key) case "isAutoUpdate": err = unpopulate(val, &w.IsAutoUpdate) diff --git a/sdk/resourcemanager/web/armweb/zz_generated_pagers.go b/sdk/resourcemanager/web/armweb/zz_generated_pagers.go index bcf9f468fa59..afa3372cd182 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_pagers.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_pagers.go @@ -10,11 +10,10 @@ package armweb import ( "context" - "net/http" - "reflect" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "reflect" ) // AppServiceCertificateOrdersListByResourceGroupPager provides operations for iterating over paged responses. diff --git a/sdk/resourcemanager/web/armweb/zz_generated_pollers.go b/sdk/resourcemanager/web/armweb/zz_generated_pollers.go index 9bcbed9ccfc5..e721851ea030 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_pollers.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_pollers.go @@ -10,9 +10,8 @@ package armweb import ( "context" - "net/http" - "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "net/http" ) // AppServiceCertificateOrdersCreateOrUpdateCertificatePoller provides polling facilities until the operation reaches a terminal state. diff --git a/sdk/resourcemanager/web/armweb/zz_generated_provider_client.go b/sdk/resourcemanager/web/armweb/zz_generated_provider_client.go index 13b9dcd1f980..b237b3b4fded 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_provider_client.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_provider_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ProviderClient contains the methods for the Provider group. @@ -30,8 +31,15 @@ type ProviderClient struct { } // NewProviderClient creates a new instance of ProviderClient with the specified values. -func NewProviderClient(con *arm.Connection, subscriptionID string) *ProviderClient { - return &ProviderClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewProviderClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ProviderClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ProviderClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetAvailableStacks - Description for Get available application frameworks and their versions @@ -69,7 +77,7 @@ func (client *ProviderClient) getAvailableStacksCreateRequest(ctx context.Contex func (client *ProviderClient) getAvailableStacksHandleResponse(resp *http.Response) (ProviderGetAvailableStacksResponse, error) { result := ProviderGetAvailableStacksResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationStackCollection); err != nil { - return ProviderGetAvailableStacksResponse{}, err + return ProviderGetAvailableStacksResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -126,7 +134,7 @@ func (client *ProviderClient) getAvailableStacksOnPremCreateRequest(ctx context. func (client *ProviderClient) getAvailableStacksOnPremHandleResponse(resp *http.Response) (ProviderGetAvailableStacksOnPremResponse, error) { result := ProviderGetAvailableStacksOnPremResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ApplicationStackCollection); err != nil { - return ProviderGetAvailableStacksOnPremResponse{}, err + return ProviderGetAvailableStacksOnPremResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -179,7 +187,7 @@ func (client *ProviderClient) getFunctionAppStacksCreateRequest(ctx context.Cont func (client *ProviderClient) getFunctionAppStacksHandleResponse(resp *http.Response) (ProviderGetFunctionAppStacksResponse, error) { result := ProviderGetFunctionAppStacksResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FunctionAppStackCollection); err != nil { - return ProviderGetFunctionAppStacksResponse{}, err + return ProviderGetFunctionAppStacksResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -236,7 +244,7 @@ func (client *ProviderClient) getFunctionAppStacksForLocationCreateRequest(ctx c func (client *ProviderClient) getFunctionAppStacksForLocationHandleResponse(resp *http.Response) (ProviderGetFunctionAppStacksForLocationResponse, error) { result := ProviderGetFunctionAppStacksForLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FunctionAppStackCollection); err != nil { - return ProviderGetFunctionAppStacksForLocationResponse{}, err + return ProviderGetFunctionAppStacksForLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -289,7 +297,7 @@ func (client *ProviderClient) getWebAppStacksCreateRequest(ctx context.Context, func (client *ProviderClient) getWebAppStacksHandleResponse(resp *http.Response) (ProviderGetWebAppStacksResponse, error) { result := ProviderGetWebAppStacksResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebAppStackCollection); err != nil { - return ProviderGetWebAppStacksResponse{}, err + return ProviderGetWebAppStacksResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -346,7 +354,7 @@ func (client *ProviderClient) getWebAppStacksForLocationCreateRequest(ctx contex func (client *ProviderClient) getWebAppStacksForLocationHandleResponse(resp *http.Response) (ProviderGetWebAppStacksForLocationResponse, error) { result := ProviderGetWebAppStacksForLocationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebAppStackCollection); err != nil { - return ProviderGetWebAppStacksForLocationResponse{}, err + return ProviderGetWebAppStacksForLocationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -396,7 +404,7 @@ func (client *ProviderClient) listOperationsCreateRequest(ctx context.Context, o func (client *ProviderClient) listOperationsHandleResponse(resp *http.Response) (ProviderListOperationsResponse, error) { result := ProviderListOperationsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CsmOperationCollection); err != nil { - return ProviderListOperationsResponse{}, err + return ProviderListOperationsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/web/armweb/zz_generated_recommendations_client.go b/sdk/resourcemanager/web/armweb/zz_generated_recommendations_client.go index 5e3d432e3d52..20aed78ee929 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_recommendations_client.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_recommendations_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // RecommendationsClient contains the methods for the Recommendations group. @@ -31,8 +32,15 @@ type RecommendationsClient struct { } // NewRecommendationsClient creates a new instance of RecommendationsClient with the specified values. -func NewRecommendationsClient(con *arm.Connection, subscriptionID string) *RecommendationsClient { - return &RecommendationsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewRecommendationsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *RecommendationsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &RecommendationsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // DisableAllForHostingEnvironment - Description for Disable all recommendations for an app. @@ -378,7 +386,7 @@ func (client *RecommendationsClient) getRuleDetailsByHostingEnvironmentCreateReq func (client *RecommendationsClient) getRuleDetailsByHostingEnvironmentHandleResponse(resp *http.Response) (RecommendationsGetRuleDetailsByHostingEnvironmentResponse, error) { result := RecommendationsGetRuleDetailsByHostingEnvironmentResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecommendationRule); err != nil { - return RecommendationsGetRuleDetailsByHostingEnvironmentResponse{}, err + return RecommendationsGetRuleDetailsByHostingEnvironmentResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -453,7 +461,7 @@ func (client *RecommendationsClient) getRuleDetailsByWebAppCreateRequest(ctx con func (client *RecommendationsClient) getRuleDetailsByWebAppHandleResponse(resp *http.Response) (RecommendationsGetRuleDetailsByWebAppResponse, error) { result := RecommendationsGetRuleDetailsByWebAppResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecommendationRule); err != nil { - return RecommendationsGetRuleDetailsByWebAppResponse{}, err + return RecommendationsGetRuleDetailsByWebAppResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -515,7 +523,7 @@ func (client *RecommendationsClient) listCreateRequest(ctx context.Context, opti func (client *RecommendationsClient) listHandleResponse(resp *http.Response) (RecommendationsListResponse, error) { result := RecommendationsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecommendationCollection); err != nil { - return RecommendationsListResponse{}, err + return RecommendationsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -585,7 +593,7 @@ func (client *RecommendationsClient) listHistoryForHostingEnvironmentCreateReque func (client *RecommendationsClient) listHistoryForHostingEnvironmentHandleResponse(resp *http.Response) (RecommendationsListHistoryForHostingEnvironmentResponse, error) { result := RecommendationsListHistoryForHostingEnvironmentResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecommendationCollection); err != nil { - return RecommendationsListHistoryForHostingEnvironmentResponse{}, err + return RecommendationsListHistoryForHostingEnvironmentResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -655,7 +663,7 @@ func (client *RecommendationsClient) listHistoryForWebAppCreateRequest(ctx conte func (client *RecommendationsClient) listHistoryForWebAppHandleResponse(resp *http.Response) (RecommendationsListHistoryForWebAppResponse, error) { result := RecommendationsListHistoryForWebAppResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecommendationCollection); err != nil { - return RecommendationsListHistoryForWebAppResponse{}, err + return RecommendationsListHistoryForWebAppResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -725,7 +733,7 @@ func (client *RecommendationsClient) listRecommendedRulesForHostingEnvironmentCr func (client *RecommendationsClient) listRecommendedRulesForHostingEnvironmentHandleResponse(resp *http.Response) (RecommendationsListRecommendedRulesForHostingEnvironmentResponse, error) { result := RecommendationsListRecommendedRulesForHostingEnvironmentResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecommendationCollection); err != nil { - return RecommendationsListRecommendedRulesForHostingEnvironmentResponse{}, err + return RecommendationsListRecommendedRulesForHostingEnvironmentResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -795,7 +803,7 @@ func (client *RecommendationsClient) listRecommendedRulesForWebAppCreateRequest( func (client *RecommendationsClient) listRecommendedRulesForWebAppHandleResponse(resp *http.Response) (RecommendationsListRecommendedRulesForWebAppResponse, error) { result := RecommendationsListRecommendedRulesForWebAppResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RecommendationCollection); err != nil { - return RecommendationsListRecommendedRulesForWebAppResponse{}, err + return RecommendationsListRecommendedRulesForWebAppResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/web/armweb/zz_generated_resourcehealthmetadata_client.go b/sdk/resourcemanager/web/armweb/zz_generated_resourcehealthmetadata_client.go index 51969e488f36..190821c18167 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_resourcehealthmetadata_client.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_resourcehealthmetadata_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // ResourceHealthMetadataClient contains the methods for the ResourceHealthMetadata group. @@ -30,8 +31,15 @@ type ResourceHealthMetadataClient struct { } // NewResourceHealthMetadataClient creates a new instance of ResourceHealthMetadataClient with the specified values. -func NewResourceHealthMetadataClient(con *arm.Connection, subscriptionID string) *ResourceHealthMetadataClient { - return &ResourceHealthMetadataClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewResourceHealthMetadataClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *ResourceHealthMetadataClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &ResourceHealthMetadataClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // GetBySite - Description for Gets the category of ResourceHealthMetadata to use for the given site @@ -81,7 +89,7 @@ func (client *ResourceHealthMetadataClient) getBySiteCreateRequest(ctx context.C func (client *ResourceHealthMetadataClient) getBySiteHandleResponse(resp *http.Response) (ResourceHealthMetadataGetBySiteResponse, error) { result := ResourceHealthMetadataGetBySiteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceHealthMetadata); err != nil { - return ResourceHealthMetadataGetBySiteResponse{}, err + return ResourceHealthMetadataGetBySiteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -150,7 +158,7 @@ func (client *ResourceHealthMetadataClient) getBySiteSlotCreateRequest(ctx conte func (client *ResourceHealthMetadataClient) getBySiteSlotHandleResponse(resp *http.Response) (ResourceHealthMetadataGetBySiteSlotResponse, error) { result := ResourceHealthMetadataGetBySiteSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceHealthMetadata); err != nil { - return ResourceHealthMetadataGetBySiteSlotResponse{}, err + return ResourceHealthMetadataGetBySiteSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -204,7 +212,7 @@ func (client *ResourceHealthMetadataClient) listCreateRequest(ctx context.Contex func (client *ResourceHealthMetadataClient) listHandleResponse(resp *http.Response) (ResourceHealthMetadataListResponse, error) { result := ResourceHealthMetadataListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceHealthMetadataCollection); err != nil { - return ResourceHealthMetadataListResponse{}, err + return ResourceHealthMetadataListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -262,7 +270,7 @@ func (client *ResourceHealthMetadataClient) listByResourceGroupCreateRequest(ctx func (client *ResourceHealthMetadataClient) listByResourceGroupHandleResponse(resp *http.Response) (ResourceHealthMetadataListByResourceGroupResponse, error) { result := ResourceHealthMetadataListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceHealthMetadataCollection); err != nil { - return ResourceHealthMetadataListByResourceGroupResponse{}, err + return ResourceHealthMetadataListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -324,7 +332,7 @@ func (client *ResourceHealthMetadataClient) listBySiteCreateRequest(ctx context. func (client *ResourceHealthMetadataClient) listBySiteHandleResponse(resp *http.Response) (ResourceHealthMetadataListBySiteResponse, error) { result := ResourceHealthMetadataListBySiteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceHealthMetadataCollection); err != nil { - return ResourceHealthMetadataListBySiteResponse{}, err + return ResourceHealthMetadataListBySiteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -390,7 +398,7 @@ func (client *ResourceHealthMetadataClient) listBySiteSlotCreateRequest(ctx cont func (client *ResourceHealthMetadataClient) listBySiteSlotHandleResponse(resp *http.Response) (ResourceHealthMetadataListBySiteSlotResponse, error) { result := ResourceHealthMetadataListBySiteSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceHealthMetadataCollection); err != nil { - return ResourceHealthMetadataListBySiteSlotResponse{}, err + return ResourceHealthMetadataListBySiteSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/web/armweb/zz_generated_response_types.go b/sdk/resourcemanager/web/armweb/zz_generated_response_types.go index 4de0548daee9..1b14317bafe6 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_response_types.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_response_types.go @@ -10,10 +10,9 @@ package armweb import ( "context" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "net/http" "time" - - armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" ) // AppServiceCertificateOrdersCreateOrUpdateCertificatePollerResponse contains the response from method AppServiceCertificateOrders.CreateOrUpdateCertificate. @@ -26,6 +25,8 @@ type AppServiceCertificateOrdersCreateOrUpdateCertificatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AppServiceCertificateOrdersCreateOrUpdateCertificatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AppServiceCertificateOrdersCreateOrUpdateCertificateResponse, error) { respType := AppServiceCertificateOrdersCreateOrUpdateCertificateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AppServiceCertificateResource) @@ -76,6 +77,8 @@ type AppServiceCertificateOrdersCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AppServiceCertificateOrdersCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AppServiceCertificateOrdersCreateOrUpdateResponse, error) { respType := AppServiceCertificateOrdersCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AppServiceCertificateOrder) @@ -296,6 +299,8 @@ type AppServiceEnvironmentsApproveOrRejectPrivateEndpointConnectionPollerRespons } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AppServiceEnvironmentsApproveOrRejectPrivateEndpointConnectionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AppServiceEnvironmentsApproveOrRejectPrivateEndpointConnectionResponse, error) { respType := AppServiceEnvironmentsApproveOrRejectPrivateEndpointConnectionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RemotePrivateEndpointConnectionARMResource) @@ -346,6 +351,8 @@ type AppServiceEnvironmentsChangeVnetPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AppServiceEnvironmentsChangeVnetPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (*AppServiceEnvironmentsChangeVnetPager, error) { respType := &AppServiceEnvironmentsChangeVnetPager{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.current.WebAppCollection) @@ -398,6 +405,8 @@ type AppServiceEnvironmentsCreateOrUpdateMultiRolePoolPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AppServiceEnvironmentsCreateOrUpdateMultiRolePoolPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AppServiceEnvironmentsCreateOrUpdateMultiRolePoolResponse, error) { respType := AppServiceEnvironmentsCreateOrUpdateMultiRolePoolResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.WorkerPoolResource) @@ -448,6 +457,8 @@ type AppServiceEnvironmentsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AppServiceEnvironmentsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AppServiceEnvironmentsCreateOrUpdateResponse, error) { respType := AppServiceEnvironmentsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AppServiceEnvironmentResource) @@ -498,6 +509,8 @@ type AppServiceEnvironmentsCreateOrUpdateWorkerPoolPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AppServiceEnvironmentsCreateOrUpdateWorkerPoolPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AppServiceEnvironmentsCreateOrUpdateWorkerPoolResponse, error) { respType := AppServiceEnvironmentsCreateOrUpdateWorkerPoolResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.WorkerPoolResource) @@ -548,6 +561,8 @@ type AppServiceEnvironmentsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AppServiceEnvironmentsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AppServiceEnvironmentsDeleteResponse, error) { respType := AppServiceEnvironmentsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -586,6 +601,8 @@ type AppServiceEnvironmentsDeletePrivateEndpointConnectionPollerResponse struct } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AppServiceEnvironmentsDeletePrivateEndpointConnectionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AppServiceEnvironmentsDeletePrivateEndpointConnectionResponse, error) { respType := AppServiceEnvironmentsDeletePrivateEndpointConnectionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Object) @@ -999,6 +1016,8 @@ type AppServiceEnvironmentsResumePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AppServiceEnvironmentsResumePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (*AppServiceEnvironmentsResumePager, error) { respType := &AppServiceEnvironmentsResumePager{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.current.WebAppCollection) @@ -1051,6 +1070,8 @@ type AppServiceEnvironmentsSuspendPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AppServiceEnvironmentsSuspendPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (*AppServiceEnvironmentsSuspendPager, error) { respType := &AppServiceEnvironmentsSuspendPager{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.current.WebAppCollection) @@ -1151,6 +1172,8 @@ type AppServicePlansCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l AppServicePlansCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (AppServicePlansCreateOrUpdateResponse, error) { respType := AppServicePlansCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.AppServicePlan) @@ -1926,6 +1949,8 @@ type DomainsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l DomainsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (DomainsCreateOrUpdateResponse, error) { respType := DomainsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Domain) @@ -2133,6 +2158,8 @@ type KubeEnvironmentsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l KubeEnvironmentsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (KubeEnvironmentsCreateOrUpdateResponse, error) { respType := KubeEnvironmentsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.KubeEnvironment) @@ -2183,6 +2210,8 @@ type KubeEnvironmentsDeletePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l KubeEnvironmentsDeletePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (KubeEnvironmentsDeleteResponse, error) { respType := KubeEnvironmentsDeleteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2563,6 +2592,8 @@ type StaticSitesApproveOrRejectPrivateEndpointConnectionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StaticSitesApproveOrRejectPrivateEndpointConnectionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StaticSitesApproveOrRejectPrivateEndpointConnectionResponse, error) { respType := StaticSitesApproveOrRejectPrivateEndpointConnectionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RemotePrivateEndpointConnectionARMResource) @@ -2649,6 +2680,8 @@ type StaticSitesCreateOrUpdateStaticSiteCustomDomainPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StaticSitesCreateOrUpdateStaticSiteCustomDomainPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StaticSitesCreateOrUpdateStaticSiteCustomDomainResponse, error) { respType := StaticSitesCreateOrUpdateStaticSiteCustomDomainResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.StaticSiteCustomDomainOverviewARMResource) @@ -2711,6 +2744,8 @@ type StaticSitesCreateOrUpdateStaticSitePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StaticSitesCreateOrUpdateStaticSitePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StaticSitesCreateOrUpdateStaticSiteResponse, error) { respType := StaticSitesCreateOrUpdateStaticSiteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.StaticSiteARMResource) @@ -2773,6 +2808,8 @@ type StaticSitesCreateZipDeploymentForStaticSiteBuildPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StaticSitesCreateZipDeploymentForStaticSiteBuildPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StaticSitesCreateZipDeploymentForStaticSiteBuildResponse, error) { respType := StaticSitesCreateZipDeploymentForStaticSiteBuildResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2817,6 +2854,8 @@ type StaticSitesCreateZipDeploymentForStaticSitePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StaticSitesCreateZipDeploymentForStaticSitePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StaticSitesCreateZipDeploymentForStaticSiteResponse, error) { respType := StaticSitesCreateZipDeploymentForStaticSiteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2861,6 +2900,8 @@ type StaticSitesDeletePrivateEndpointConnectionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StaticSitesDeletePrivateEndpointConnectionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StaticSitesDeletePrivateEndpointConnectionResponse, error) { respType := StaticSitesDeletePrivateEndpointConnectionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Object) @@ -2912,6 +2953,8 @@ type StaticSitesDeleteStaticSiteBuildPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StaticSitesDeleteStaticSiteBuildPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StaticSitesDeleteStaticSiteBuildResponse, error) { respType := StaticSitesDeleteStaticSiteBuildResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -2956,6 +2999,8 @@ type StaticSitesDeleteStaticSiteCustomDomainPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StaticSitesDeleteStaticSiteCustomDomainPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StaticSitesDeleteStaticSiteCustomDomainResponse, error) { respType := StaticSitesDeleteStaticSiteCustomDomainResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3000,6 +3045,8 @@ type StaticSitesDeleteStaticSitePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StaticSitesDeleteStaticSitePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StaticSitesDeleteStaticSiteResponse, error) { respType := StaticSitesDeleteStaticSiteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3050,6 +3097,8 @@ type StaticSitesDetachStaticSitePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StaticSitesDetachStaticSitePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StaticSitesDetachStaticSiteResponse, error) { respType := StaticSitesDetachStaticSiteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3394,6 +3443,8 @@ type StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteBuildPollerResponse } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteBuildPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteBuildResponse, error) { respType := StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteBuildResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.StaticSiteUserProvidedFunctionAppARMResource) @@ -3444,6 +3495,8 @@ type StaticSitesRegisterUserProvidedFunctionAppWithStaticSitePollerResponse stru } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StaticSitesRegisterUserProvidedFunctionAppWithStaticSitePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteResponse, error) { respType := StaticSitesRegisterUserProvidedFunctionAppWithStaticSiteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.StaticSiteUserProvidedFunctionAppARMResource) @@ -3524,6 +3577,8 @@ type StaticSitesValidateCustomDomainCanBeAddedToStaticSitePollerResponse struct } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l StaticSitesValidateCustomDomainCanBeAddedToStaticSitePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (StaticSitesValidateCustomDomainCanBeAddedToStaticSiteResponse, error) { respType := StaticSitesValidateCustomDomainCanBeAddedToStaticSiteResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -3664,6 +3719,8 @@ type WebAppsApproveOrRejectPrivateEndpointConnectionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsApproveOrRejectPrivateEndpointConnectionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsApproveOrRejectPrivateEndpointConnectionResponse, error) { respType := WebAppsApproveOrRejectPrivateEndpointConnectionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RemotePrivateEndpointConnectionARMResource) @@ -3714,6 +3771,8 @@ type WebAppsApproveOrRejectPrivateEndpointConnectionSlotPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsApproveOrRejectPrivateEndpointConnectionSlotPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsApproveOrRejectPrivateEndpointConnectionSlotResponse, error) { respType := WebAppsApproveOrRejectPrivateEndpointConnectionSlotResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.RemotePrivateEndpointConnectionARMResource) @@ -3812,6 +3871,8 @@ type WebAppsCreateFunctionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsCreateFunctionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsCreateFunctionResponse, error) { respType := WebAppsCreateFunctionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.FunctionEnvelope) @@ -3862,6 +3923,8 @@ type WebAppsCreateInstanceFunctionSlotPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsCreateInstanceFunctionSlotPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsCreateInstanceFunctionSlotResponse, error) { respType := WebAppsCreateInstanceFunctionSlotResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.FunctionEnvelope) @@ -3912,6 +3975,8 @@ type WebAppsCreateInstanceMSDeployOperationPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsCreateInstanceMSDeployOperationPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsCreateInstanceMSDeployOperationResponse, error) { respType := WebAppsCreateInstanceMSDeployOperationResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.MSDeployStatus) @@ -3962,6 +4027,8 @@ type WebAppsCreateInstanceMSDeployOperationSlotPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsCreateInstanceMSDeployOperationSlotPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsCreateInstanceMSDeployOperationSlotResponse, error) { respType := WebAppsCreateInstanceMSDeployOperationSlotResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.MSDeployStatus) @@ -4012,6 +4079,8 @@ type WebAppsCreateMSDeployOperationPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsCreateMSDeployOperationPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsCreateMSDeployOperationResponse, error) { respType := WebAppsCreateMSDeployOperationResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.MSDeployStatus) @@ -4062,6 +4131,8 @@ type WebAppsCreateMSDeployOperationSlotPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsCreateMSDeployOperationSlotPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsCreateMSDeployOperationSlotResponse, error) { respType := WebAppsCreateMSDeployOperationSlotResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.MSDeployStatus) @@ -4256,6 +4327,8 @@ type WebAppsCreateOrUpdatePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsCreateOrUpdatePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsCreateOrUpdateResponse, error) { respType := WebAppsCreateOrUpdateResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Site) @@ -4354,6 +4427,8 @@ type WebAppsCreateOrUpdateSlotPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsCreateOrUpdateSlotPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsCreateOrUpdateSlotResponse, error) { respType := WebAppsCreateOrUpdateSlotResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Site) @@ -4404,6 +4479,8 @@ type WebAppsCreateOrUpdateSourceControlPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsCreateOrUpdateSourceControlPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsCreateOrUpdateSourceControlResponse, error) { respType := WebAppsCreateOrUpdateSourceControlResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SiteSourceControl) @@ -4454,6 +4531,8 @@ type WebAppsCreateOrUpdateSourceControlSlotPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsCreateOrUpdateSourceControlSlotPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsCreateOrUpdateSourceControlSlotResponse, error) { respType := WebAppsCreateOrUpdateSourceControlSlotResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SiteSourceControl) @@ -4720,6 +4799,8 @@ type WebAppsDeletePrivateEndpointConnectionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsDeletePrivateEndpointConnectionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsDeletePrivateEndpointConnectionResponse, error) { respType := WebAppsDeletePrivateEndpointConnectionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Object) @@ -4771,6 +4852,8 @@ type WebAppsDeletePrivateEndpointConnectionSlotPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsDeletePrivateEndpointConnectionSlotPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsDeletePrivateEndpointConnectionSlotResponse, error) { respType := WebAppsDeletePrivateEndpointConnectionSlotResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Object) @@ -6246,6 +6329,8 @@ type WebAppsInstallSiteExtensionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsInstallSiteExtensionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsInstallSiteExtensionResponse, error) { respType := WebAppsInstallSiteExtensionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SiteExtensionInfo) @@ -6296,6 +6381,8 @@ type WebAppsInstallSiteExtensionSlotPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsInstallSiteExtensionSlotPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsInstallSiteExtensionSlotResponse, error) { respType := WebAppsInstallSiteExtensionSlotResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.SiteExtensionInfo) @@ -7102,6 +7189,8 @@ type WebAppsListPublishingCredentialsPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsListPublishingCredentialsPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsListPublishingCredentialsResponse, error) { respType := WebAppsListPublishingCredentialsResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.User) @@ -7152,6 +7241,8 @@ type WebAppsListPublishingCredentialsSlotPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsListPublishingCredentialsSlotPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsListPublishingCredentialsSlotResponse, error) { respType := WebAppsListPublishingCredentialsSlotResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.User) @@ -7576,6 +7667,8 @@ type WebAppsMigrateMySQLPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsMigrateMySQLPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsMigrateMySQLResponse, error) { respType := WebAppsMigrateMySQLResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.Operation) @@ -7626,6 +7719,8 @@ type WebAppsMigrateStoragePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsMigrateStoragePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsMigrateStorageResponse, error) { respType := WebAppsMigrateStorageResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.StorageMigrationResponse) @@ -7736,6 +7831,8 @@ type WebAppsRestoreFromBackupBlobPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsRestoreFromBackupBlobPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsRestoreFromBackupBlobResponse, error) { respType := WebAppsRestoreFromBackupBlobResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7780,6 +7877,8 @@ type WebAppsRestoreFromBackupBlobSlotPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsRestoreFromBackupBlobSlotPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsRestoreFromBackupBlobSlotResponse, error) { respType := WebAppsRestoreFromBackupBlobSlotResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7824,6 +7923,8 @@ type WebAppsRestoreFromDeletedAppPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsRestoreFromDeletedAppPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsRestoreFromDeletedAppResponse, error) { respType := WebAppsRestoreFromDeletedAppResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7868,6 +7969,8 @@ type WebAppsRestoreFromDeletedAppSlotPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsRestoreFromDeletedAppSlotPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsRestoreFromDeletedAppSlotResponse, error) { respType := WebAppsRestoreFromDeletedAppSlotResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7912,6 +8015,8 @@ type WebAppsRestorePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsRestorePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsRestoreResponse, error) { respType := WebAppsRestoreResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -7956,6 +8061,8 @@ type WebAppsRestoreSlotPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsRestoreSlotPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsRestoreSlotResponse, error) { respType := WebAppsRestoreSlotResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -8000,6 +8107,8 @@ type WebAppsRestoreSnapshotPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsRestoreSnapshotPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsRestoreSnapshotResponse, error) { respType := WebAppsRestoreSnapshotResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -8044,6 +8153,8 @@ type WebAppsRestoreSnapshotSlotPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsRestoreSnapshotSlotPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsRestoreSnapshotSlotResponse, error) { respType := WebAppsRestoreSnapshotSlotResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -8112,6 +8223,8 @@ type WebAppsStartNetworkTracePollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsStartNetworkTracePollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsStartNetworkTraceResponse, error) { respType := WebAppsStartNetworkTraceResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.NetworkTraceArray) @@ -8163,6 +8276,8 @@ type WebAppsStartNetworkTraceSlotPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsStartNetworkTraceSlotPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsStartNetworkTraceSlotResponse, error) { respType := WebAppsStartNetworkTraceSlotResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.NetworkTraceArray) @@ -8226,6 +8341,8 @@ type WebAppsStartWebSiteNetworkTraceOperationPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsStartWebSiteNetworkTraceOperationPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsStartWebSiteNetworkTraceOperationResponse, error) { respType := WebAppsStartWebSiteNetworkTraceOperationResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.NetworkTraceArray) @@ -8277,6 +8394,8 @@ type WebAppsStartWebSiteNetworkTraceOperationSlotPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsStartWebSiteNetworkTraceOperationSlotPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsStartWebSiteNetworkTraceOperationSlotResponse, error) { respType := WebAppsStartWebSiteNetworkTraceOperationSlotResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, &respType.NetworkTraceArray) @@ -8400,6 +8519,8 @@ type WebAppsSwapSlotPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsSwapSlotPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsSwapSlotResponse, error) { respType := WebAppsSwapSlotResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) @@ -8444,6 +8565,8 @@ type WebAppsSwapSlotWithProductionPollerResponse struct { } // PollUntilDone will poll the service endpoint until a terminal state is reached or an error is received. +// freq: the time to wait between intervals in absence of a Retry-After header. Allowed minimum is one second. +// A good starting value is 30 seconds. Note that some resources might benefit from a different value. func (l WebAppsSwapSlotWithProductionPollerResponse) PollUntilDone(ctx context.Context, freq time.Duration) (WebAppsSwapSlotWithProductionResponse, error) { respType := WebAppsSwapSlotWithProductionResponse{} resp, err := l.Poller.pt.PollUntilDone(ctx, freq, nil) diff --git a/sdk/resourcemanager/web/armweb/zz_generated_staticsites_client.go b/sdk/resourcemanager/web/armweb/zz_generated_staticsites_client.go index 9b2aecfd8afd..401b7cf2bc9c 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_staticsites_client.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_staticsites_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // StaticSitesClient contains the methods for the StaticSites group. @@ -32,8 +32,15 @@ type StaticSitesClient struct { } // NewStaticSitesClient creates a new instance of StaticSitesClient with the specified values. -func NewStaticSitesClient(con *arm.Connection, subscriptionID string) *StaticSitesClient { - return &StaticSitesClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewStaticSitesClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *StaticSitesClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &StaticSitesClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // BeginApproveOrRejectPrivateEndpointConnection - Description for Approves or rejects a private endpoint connection @@ -239,7 +246,7 @@ func (client *StaticSitesClient) createOrUpdateStaticSiteAppSettingsCreateReques func (client *StaticSitesClient) createOrUpdateStaticSiteAppSettingsHandleResponse(resp *http.Response) (StaticSitesCreateOrUpdateStaticSiteAppSettingsResponse, error) { result := StaticSitesCreateOrUpdateStaticSiteAppSettingsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil { - return StaticSitesCreateOrUpdateStaticSiteAppSettingsResponse{}, err + return StaticSitesCreateOrUpdateStaticSiteAppSettingsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -308,7 +315,7 @@ func (client *StaticSitesClient) createOrUpdateStaticSiteBuildAppSettingsCreateR func (client *StaticSitesClient) createOrUpdateStaticSiteBuildAppSettingsHandleResponse(resp *http.Response) (StaticSitesCreateOrUpdateStaticSiteBuildAppSettingsResponse, error) { result := StaticSitesCreateOrUpdateStaticSiteBuildAppSettingsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil { - return StaticSitesCreateOrUpdateStaticSiteBuildAppSettingsResponse{}, err + return StaticSitesCreateOrUpdateStaticSiteBuildAppSettingsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -377,7 +384,7 @@ func (client *StaticSitesClient) createOrUpdateStaticSiteBuildFunctionAppSetting func (client *StaticSitesClient) createOrUpdateStaticSiteBuildFunctionAppSettingsHandleResponse(resp *http.Response) (StaticSitesCreateOrUpdateStaticSiteBuildFunctionAppSettingsResponse, error) { result := StaticSitesCreateOrUpdateStaticSiteBuildFunctionAppSettingsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil { - return StaticSitesCreateOrUpdateStaticSiteBuildFunctionAppSettingsResponse{}, err + return StaticSitesCreateOrUpdateStaticSiteBuildFunctionAppSettingsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -522,7 +529,7 @@ func (client *StaticSitesClient) createOrUpdateStaticSiteFunctionAppSettingsCrea func (client *StaticSitesClient) createOrUpdateStaticSiteFunctionAppSettingsHandleResponse(resp *http.Response) (StaticSitesCreateOrUpdateStaticSiteFunctionAppSettingsResponse, error) { result := StaticSitesCreateOrUpdateStaticSiteFunctionAppSettingsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil { - return StaticSitesCreateOrUpdateStaticSiteFunctionAppSettingsResponse{}, err + return StaticSitesCreateOrUpdateStaticSiteFunctionAppSettingsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -587,7 +594,7 @@ func (client *StaticSitesClient) createUserRolesInvitationLinkCreateRequest(ctx func (client *StaticSitesClient) createUserRolesInvitationLinkHandleResponse(resp *http.Response) (StaticSitesCreateUserRolesInvitationLinkResponse, error) { result := StaticSitesCreateUserRolesInvitationLinkResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StaticSiteUserInvitationResponseResource); err != nil { - return StaticSitesCreateUserRolesInvitationLinkResponse{}, err + return StaticSitesCreateUserRolesInvitationLinkResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1392,7 +1399,7 @@ func (client *StaticSitesClient) getPrivateEndpointConnectionCreateRequest(ctx c func (client *StaticSitesClient) getPrivateEndpointConnectionHandleResponse(resp *http.Response) (StaticSitesGetPrivateEndpointConnectionResponse, error) { result := StaticSitesGetPrivateEndpointConnectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RemotePrivateEndpointConnectionARMResource); err != nil { - return StaticSitesGetPrivateEndpointConnectionResponse{}, err + return StaticSitesGetPrivateEndpointConnectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1454,7 +1461,7 @@ func (client *StaticSitesClient) getPrivateEndpointConnectionListCreateRequest(c func (client *StaticSitesClient) getPrivateEndpointConnectionListHandleResponse(resp *http.Response) (StaticSitesGetPrivateEndpointConnectionListResponse, error) { result := StaticSitesGetPrivateEndpointConnectionListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionCollection); err != nil { - return StaticSitesGetPrivateEndpointConnectionListResponse{}, err + return StaticSitesGetPrivateEndpointConnectionListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1519,7 +1526,7 @@ func (client *StaticSitesClient) getPrivateLinkResourcesCreateRequest(ctx contex func (client *StaticSitesClient) getPrivateLinkResourcesHandleResponse(resp *http.Response) (StaticSitesGetPrivateLinkResourcesResponse, error) { result := StaticSitesGetPrivateLinkResourcesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourcesWrapper); err != nil { - return StaticSitesGetPrivateLinkResourcesResponse{}, err + return StaticSitesGetPrivateLinkResourcesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1584,7 +1591,7 @@ func (client *StaticSitesClient) getStaticSiteCreateRequest(ctx context.Context, func (client *StaticSitesClient) getStaticSiteHandleResponse(resp *http.Response) (StaticSitesGetStaticSiteResponse, error) { result := StaticSitesGetStaticSiteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StaticSiteARMResource); err != nil { - return StaticSitesGetStaticSiteResponse{}, err + return StaticSitesGetStaticSiteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1653,7 +1660,7 @@ func (client *StaticSitesClient) getStaticSiteBuildCreateRequest(ctx context.Con func (client *StaticSitesClient) getStaticSiteBuildHandleResponse(resp *http.Response) (StaticSitesGetStaticSiteBuildResponse, error) { result := StaticSitesGetStaticSiteBuildResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StaticSiteBuildARMResource); err != nil { - return StaticSitesGetStaticSiteBuildResponse{}, err + return StaticSitesGetStaticSiteBuildResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1715,7 +1722,7 @@ func (client *StaticSitesClient) getStaticSiteBuildsCreateRequest(ctx context.Co func (client *StaticSitesClient) getStaticSiteBuildsHandleResponse(resp *http.Response) (StaticSitesGetStaticSiteBuildsResponse, error) { result := StaticSitesGetStaticSiteBuildsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StaticSiteBuildCollection); err != nil { - return StaticSitesGetStaticSiteBuildsResponse{}, err + return StaticSitesGetStaticSiteBuildsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1784,7 +1791,7 @@ func (client *StaticSitesClient) getStaticSiteCustomDomainCreateRequest(ctx cont func (client *StaticSitesClient) getStaticSiteCustomDomainHandleResponse(resp *http.Response) (StaticSitesGetStaticSiteCustomDomainResponse, error) { result := StaticSitesGetStaticSiteCustomDomainResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StaticSiteCustomDomainOverviewARMResource); err != nil { - return StaticSitesGetStaticSiteCustomDomainResponse{}, err + return StaticSitesGetStaticSiteCustomDomainResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1842,7 +1849,7 @@ func (client *StaticSitesClient) getStaticSitesByResourceGroupCreateRequest(ctx func (client *StaticSitesClient) getStaticSitesByResourceGroupHandleResponse(resp *http.Response) (StaticSitesGetStaticSitesByResourceGroupResponse, error) { result := StaticSitesGetStaticSitesByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StaticSiteCollection); err != nil { - return StaticSitesGetStaticSitesByResourceGroupResponse{}, err + return StaticSitesGetStaticSitesByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1911,7 +1918,7 @@ func (client *StaticSitesClient) getUserProvidedFunctionAppForStaticSiteCreateRe func (client *StaticSitesClient) getUserProvidedFunctionAppForStaticSiteHandleResponse(resp *http.Response) (StaticSitesGetUserProvidedFunctionAppForStaticSiteResponse, error) { result := StaticSitesGetUserProvidedFunctionAppForStaticSiteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StaticSiteUserProvidedFunctionAppARMResource); err != nil { - return StaticSitesGetUserProvidedFunctionAppForStaticSiteResponse{}, err + return StaticSitesGetUserProvidedFunctionAppForStaticSiteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1984,7 +1991,7 @@ func (client *StaticSitesClient) getUserProvidedFunctionAppForStaticSiteBuildCre func (client *StaticSitesClient) getUserProvidedFunctionAppForStaticSiteBuildHandleResponse(resp *http.Response) (StaticSitesGetUserProvidedFunctionAppForStaticSiteBuildResponse, error) { result := StaticSitesGetUserProvidedFunctionAppForStaticSiteBuildResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StaticSiteUserProvidedFunctionAppARMResource); err != nil { - return StaticSitesGetUserProvidedFunctionAppForStaticSiteBuildResponse{}, err + return StaticSitesGetUserProvidedFunctionAppForStaticSiteBuildResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2046,7 +2053,7 @@ func (client *StaticSitesClient) getUserProvidedFunctionAppsForStaticSiteCreateR func (client *StaticSitesClient) getUserProvidedFunctionAppsForStaticSiteHandleResponse(resp *http.Response) (StaticSitesGetUserProvidedFunctionAppsForStaticSiteResponse, error) { result := StaticSitesGetUserProvidedFunctionAppsForStaticSiteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StaticSiteUserProvidedFunctionAppsCollection); err != nil { - return StaticSitesGetUserProvidedFunctionAppsForStaticSiteResponse{}, err + return StaticSitesGetUserProvidedFunctionAppsForStaticSiteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2112,7 +2119,7 @@ func (client *StaticSitesClient) getUserProvidedFunctionAppsForStaticSiteBuildCr func (client *StaticSitesClient) getUserProvidedFunctionAppsForStaticSiteBuildHandleResponse(resp *http.Response) (StaticSitesGetUserProvidedFunctionAppsForStaticSiteBuildResponse, error) { result := StaticSitesGetUserProvidedFunctionAppsForStaticSiteBuildResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StaticSiteUserProvidedFunctionAppsCollection); err != nil { - return StaticSitesGetUserProvidedFunctionAppsForStaticSiteBuildResponse{}, err + return StaticSitesGetUserProvidedFunctionAppsForStaticSiteBuildResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2166,7 +2173,7 @@ func (client *StaticSitesClient) listCreateRequest(ctx context.Context, options func (client *StaticSitesClient) listHandleResponse(resp *http.Response) (StaticSitesListResponse, error) { result := StaticSitesListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StaticSiteCollection); err != nil { - return StaticSitesListResponse{}, err + return StaticSitesListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2231,7 +2238,7 @@ func (client *StaticSitesClient) listStaticSiteAppSettingsCreateRequest(ctx cont func (client *StaticSitesClient) listStaticSiteAppSettingsHandleResponse(resp *http.Response) (StaticSitesListStaticSiteAppSettingsResponse, error) { result := StaticSitesListStaticSiteAppSettingsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil { - return StaticSitesListStaticSiteAppSettingsResponse{}, err + return StaticSitesListStaticSiteAppSettingsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2300,7 +2307,7 @@ func (client *StaticSitesClient) listStaticSiteBuildAppSettingsCreateRequest(ctx func (client *StaticSitesClient) listStaticSiteBuildAppSettingsHandleResponse(resp *http.Response) (StaticSitesListStaticSiteBuildAppSettingsResponse, error) { result := StaticSitesListStaticSiteBuildAppSettingsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil { - return StaticSitesListStaticSiteBuildAppSettingsResponse{}, err + return StaticSitesListStaticSiteBuildAppSettingsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2369,7 +2376,7 @@ func (client *StaticSitesClient) listStaticSiteBuildFunctionAppSettingsCreateReq func (client *StaticSitesClient) listStaticSiteBuildFunctionAppSettingsHandleResponse(resp *http.Response) (StaticSitesListStaticSiteBuildFunctionAppSettingsResponse, error) { result := StaticSitesListStaticSiteBuildFunctionAppSettingsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil { - return StaticSitesListStaticSiteBuildFunctionAppSettingsResponse{}, err + return StaticSitesListStaticSiteBuildFunctionAppSettingsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2435,7 +2442,7 @@ func (client *StaticSitesClient) listStaticSiteBuildFunctionsCreateRequest(ctx c func (client *StaticSitesClient) listStaticSiteBuildFunctionsHandleResponse(resp *http.Response) (StaticSitesListStaticSiteBuildFunctionsResponse, error) { result := StaticSitesListStaticSiteBuildFunctionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StaticSiteFunctionOverviewCollection); err != nil { - return StaticSitesListStaticSiteBuildFunctionsResponse{}, err + return StaticSitesListStaticSiteBuildFunctionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2500,7 +2507,7 @@ func (client *StaticSitesClient) listStaticSiteConfiguredRolesCreateRequest(ctx func (client *StaticSitesClient) listStaticSiteConfiguredRolesHandleResponse(resp *http.Response) (StaticSitesListStaticSiteConfiguredRolesResponse, error) { result := StaticSitesListStaticSiteConfiguredRolesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringList); err != nil { - return StaticSitesListStaticSiteConfiguredRolesResponse{}, err + return StaticSitesListStaticSiteConfiguredRolesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2562,7 +2569,7 @@ func (client *StaticSitesClient) listStaticSiteCustomDomainsCreateRequest(ctx co func (client *StaticSitesClient) listStaticSiteCustomDomainsHandleResponse(resp *http.Response) (StaticSitesListStaticSiteCustomDomainsResponse, error) { result := StaticSitesListStaticSiteCustomDomainsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StaticSiteCustomDomainOverviewCollection); err != nil { - return StaticSitesListStaticSiteCustomDomainsResponse{}, err + return StaticSitesListStaticSiteCustomDomainsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2627,7 +2634,7 @@ func (client *StaticSitesClient) listStaticSiteFunctionAppSettingsCreateRequest( func (client *StaticSitesClient) listStaticSiteFunctionAppSettingsHandleResponse(resp *http.Response) (StaticSitesListStaticSiteFunctionAppSettingsResponse, error) { result := StaticSitesListStaticSiteFunctionAppSettingsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil { - return StaticSitesListStaticSiteFunctionAppSettingsResponse{}, err + return StaticSitesListStaticSiteFunctionAppSettingsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2689,7 +2696,7 @@ func (client *StaticSitesClient) listStaticSiteFunctionsCreateRequest(ctx contex func (client *StaticSitesClient) listStaticSiteFunctionsHandleResponse(resp *http.Response) (StaticSitesListStaticSiteFunctionsResponse, error) { result := StaticSitesListStaticSiteFunctionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StaticSiteFunctionOverviewCollection); err != nil { - return StaticSitesListStaticSiteFunctionsResponse{}, err + return StaticSitesListStaticSiteFunctionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2754,7 +2761,7 @@ func (client *StaticSitesClient) listStaticSiteSecretsCreateRequest(ctx context. func (client *StaticSitesClient) listStaticSiteSecretsHandleResponse(resp *http.Response) (StaticSitesListStaticSiteSecretsResponse, error) { result := StaticSitesListStaticSiteSecretsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil { - return StaticSitesListStaticSiteSecretsResponse{}, err + return StaticSitesListStaticSiteSecretsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2820,7 +2827,7 @@ func (client *StaticSitesClient) listStaticSiteUsersCreateRequest(ctx context.Co func (client *StaticSitesClient) listStaticSiteUsersHandleResponse(resp *http.Response) (StaticSitesListStaticSiteUsersResponse, error) { result := StaticSitesListStaticSiteUsersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StaticSiteUserCollection); err != nil { - return StaticSitesListStaticSiteUsersResponse{}, err + return StaticSitesListStaticSiteUsersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2881,7 +2888,7 @@ func (client *StaticSitesClient) previewWorkflowCreateRequest(ctx context.Contex func (client *StaticSitesClient) previewWorkflowHandleResponse(resp *http.Response) (StaticSitesPreviewWorkflowResponse, error) { result := StaticSitesPreviewWorkflowResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StaticSitesWorkflowPreview); err != nil { - return StaticSitesPreviewWorkflowResponse{}, err + return StaticSitesPreviewWorkflowResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -3172,7 +3179,7 @@ func (client *StaticSitesClient) updateStaticSiteCreateRequest(ctx context.Conte func (client *StaticSitesClient) updateStaticSiteHandleResponse(resp *http.Response) (StaticSitesUpdateStaticSiteResponse, error) { result := StaticSitesUpdateStaticSiteResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StaticSiteARMResource); err != nil { - return StaticSitesUpdateStaticSiteResponse{}, err + return StaticSitesUpdateStaticSiteResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -3245,7 +3252,7 @@ func (client *StaticSitesClient) updateStaticSiteUserCreateRequest(ctx context.C func (client *StaticSitesClient) updateStaticSiteUserHandleResponse(resp *http.Response) (StaticSitesUpdateStaticSiteUserResponse, error) { result := StaticSitesUpdateStaticSiteUserResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StaticSiteUserARMResource); err != nil { - return StaticSitesUpdateStaticSiteUserResponse{}, err + return StaticSitesUpdateStaticSiteUserResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/web/armweb/zz_generated_time_rfc3339.go b/sdk/resourcemanager/web/armweb/zz_generated_time_rfc3339.go index 60881e3a5167..d21c335f5f18 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_time_rfc3339.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_time_rfc3339.go @@ -9,6 +9,9 @@ package armweb import ( + "encoding/json" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "reflect" "regexp" "strings" "time" @@ -56,3 +59,27 @@ func (t *timeRFC3339) Parse(layout, value string) error { *t = timeRFC3339(p) return err } + +func populateTimeRFC3339(m map[string]interface{}, k string, t *time.Time) { + if t == nil { + return + } else if azcore.IsNullValue(t) { + m[k] = nil + return + } else if reflect.ValueOf(t).IsNil() { + return + } + m[k] = (*timeRFC3339)(t) +} + +func unpopulateTimeRFC3339(data json.RawMessage, t **time.Time) error { + if data == nil || strings.EqualFold(string(data), "null") { + return nil + } + var aux timeRFC3339 + if err := json.Unmarshal(data, &aux); err != nil { + return err + } + *t = (*time.Time)(&aux) + return nil +} diff --git a/sdk/resourcemanager/web/armweb/zz_generated_topleveldomains_client.go b/sdk/resourcemanager/web/armweb/zz_generated_topleveldomains_client.go index adb1a946d1dd..aab78cd4eda2 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_topleveldomains_client.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_topleveldomains_client.go @@ -12,13 +12,14 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strings" ) // TopLevelDomainsClient contains the methods for the TopLevelDomains group. @@ -30,8 +31,15 @@ type TopLevelDomainsClient struct { } // NewTopLevelDomainsClient creates a new instance of TopLevelDomainsClient with the specified values. -func NewTopLevelDomainsClient(con *arm.Connection, subscriptionID string) *TopLevelDomainsClient { - return &TopLevelDomainsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewTopLevelDomainsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *TopLevelDomainsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &TopLevelDomainsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // Get - Description for Get details of a top-level domain. @@ -77,7 +85,7 @@ func (client *TopLevelDomainsClient) getCreateRequest(ctx context.Context, name func (client *TopLevelDomainsClient) getHandleResponse(resp *http.Response) (TopLevelDomainsGetResponse, error) { result := TopLevelDomainsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TopLevelDomain); err != nil { - return TopLevelDomainsGetResponse{}, err + return TopLevelDomainsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -131,7 +139,7 @@ func (client *TopLevelDomainsClient) listCreateRequest(ctx context.Context, opti func (client *TopLevelDomainsClient) listHandleResponse(resp *http.Response) (TopLevelDomainsListResponse, error) { result := TopLevelDomainsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TopLevelDomainCollection); err != nil { - return TopLevelDomainsListResponse{}, err + return TopLevelDomainsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -189,7 +197,7 @@ func (client *TopLevelDomainsClient) listAgreementsCreateRequest(ctx context.Con func (client *TopLevelDomainsClient) listAgreementsHandleResponse(resp *http.Response) (TopLevelDomainsListAgreementsResponse, error) { result := TopLevelDomainsListAgreementsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TldLegalAgreementCollection); err != nil { - return TopLevelDomainsListAgreementsResponse{}, err + return TopLevelDomainsListAgreementsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/web/armweb/zz_generated_webapps_client.go b/sdk/resourcemanager/web/armweb/zz_generated_webapps_client.go index ffdefc28a10f..6e3c5ce03df3 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_webapps_client.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_webapps_client.go @@ -12,15 +12,15 @@ import ( "context" "errors" "fmt" - "net/http" - "net/url" - "strconv" - "strings" - + "github.com/Azure/azure-sdk-for-go/sdk/azcore" "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" + "net/http" + "net/url" + "strconv" + "strings" ) // WebAppsClient contains the methods for the WebApps group. @@ -32,8 +32,15 @@ type WebAppsClient struct { } // NewWebAppsClient creates a new instance of WebAppsClient with the specified values. -func NewWebAppsClient(con *arm.Connection, subscriptionID string) *WebAppsClient { - return &WebAppsClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWebAppsClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WebAppsClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WebAppsClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // AddPremierAddOn - Description for Updates a named add-on of an app. @@ -87,7 +94,7 @@ func (client *WebAppsClient) addPremierAddOnCreateRequest(ctx context.Context, r func (client *WebAppsClient) addPremierAddOnHandleResponse(resp *http.Response) (WebAppsAddPremierAddOnResponse, error) { result := WebAppsAddPremierAddOnResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PremierAddOn); err != nil { - return WebAppsAddPremierAddOnResponse{}, err + return WebAppsAddPremierAddOnResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -160,7 +167,7 @@ func (client *WebAppsClient) addPremierAddOnSlotCreateRequest(ctx context.Contex func (client *WebAppsClient) addPremierAddOnSlotHandleResponse(resp *http.Response) (WebAppsAddPremierAddOnSlotResponse, error) { result := WebAppsAddPremierAddOnSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PremierAddOn); err != nil { - return WebAppsAddPremierAddOnSlotResponse{}, err + return WebAppsAddPremierAddOnSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -228,7 +235,7 @@ func (client *WebAppsClient) analyzeCustomHostnameCreateRequest(ctx context.Cont func (client *WebAppsClient) analyzeCustomHostnameHandleResponse(resp *http.Response) (WebAppsAnalyzeCustomHostnameResponse, error) { result := WebAppsAnalyzeCustomHostnameResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CustomHostnameAnalysisResult); err != nil { - return WebAppsAnalyzeCustomHostnameResponse{}, err + return WebAppsAnalyzeCustomHostnameResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -300,7 +307,7 @@ func (client *WebAppsClient) analyzeCustomHostnameSlotCreateRequest(ctx context. func (client *WebAppsClient) analyzeCustomHostnameSlotHandleResponse(resp *http.Response) (WebAppsAnalyzeCustomHostnameSlotResponse, error) { result := WebAppsAnalyzeCustomHostnameSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CustomHostnameAnalysisResult); err != nil { - return WebAppsAnalyzeCustomHostnameSlotResponse{}, err + return WebAppsAnalyzeCustomHostnameSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -645,7 +652,7 @@ func (client *WebAppsClient) backupCreateRequest(ctx context.Context, resourceGr func (client *WebAppsClient) backupHandleResponse(resp *http.Response) (WebAppsBackupResponse, error) { result := WebAppsBackupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BackupItem); err != nil { - return WebAppsBackupResponse{}, err + return WebAppsBackupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -714,7 +721,7 @@ func (client *WebAppsClient) backupSlotCreateRequest(ctx context.Context, resour func (client *WebAppsClient) backupSlotHandleResponse(resp *http.Response) (WebAppsBackupSlotResponse, error) { result := WebAppsBackupSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BackupItem); err != nil { - return WebAppsBackupSlotResponse{}, err + return WebAppsBackupSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -783,7 +790,7 @@ func (client *WebAppsClient) createDeploymentCreateRequest(ctx context.Context, func (client *WebAppsClient) createDeploymentHandleResponse(resp *http.Response) (WebAppsCreateDeploymentResponse, error) { result := WebAppsCreateDeploymentResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Deployment); err != nil { - return WebAppsCreateDeploymentResponse{}, err + return WebAppsCreateDeploymentResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -856,7 +863,7 @@ func (client *WebAppsClient) createDeploymentSlotCreateRequest(ctx context.Conte func (client *WebAppsClient) createDeploymentSlotHandleResponse(resp *http.Response) (WebAppsCreateDeploymentSlotResponse, error) { result := WebAppsCreateDeploymentSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Deployment); err != nil { - return WebAppsCreateDeploymentSlotResponse{}, err + return WebAppsCreateDeploymentSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1513,7 +1520,7 @@ func (client *WebAppsClient) createOrUpdateConfigurationCreateRequest(ctx contex func (client *WebAppsClient) createOrUpdateConfigurationHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateConfigurationResponse, error) { result := WebAppsCreateOrUpdateConfigurationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResource); err != nil { - return WebAppsCreateOrUpdateConfigurationResponse{}, err + return WebAppsCreateOrUpdateConfigurationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1582,7 +1589,7 @@ func (client *WebAppsClient) createOrUpdateConfigurationSlotCreateRequest(ctx co func (client *WebAppsClient) createOrUpdateConfigurationSlotHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateConfigurationSlotResponse, error) { result := WebAppsCreateOrUpdateConfigurationSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResource); err != nil { - return WebAppsCreateOrUpdateConfigurationSlotResponse{}, err + return WebAppsCreateOrUpdateConfigurationSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1651,7 +1658,7 @@ func (client *WebAppsClient) createOrUpdateDomainOwnershipIdentifierCreateReques func (client *WebAppsClient) createOrUpdateDomainOwnershipIdentifierHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateDomainOwnershipIdentifierResponse, error) { result := WebAppsCreateOrUpdateDomainOwnershipIdentifierResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Identifier); err != nil { - return WebAppsCreateOrUpdateDomainOwnershipIdentifierResponse{}, err + return WebAppsCreateOrUpdateDomainOwnershipIdentifierResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1724,7 +1731,7 @@ func (client *WebAppsClient) createOrUpdateDomainOwnershipIdentifierSlotCreateRe func (client *WebAppsClient) createOrUpdateDomainOwnershipIdentifierSlotHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateDomainOwnershipIdentifierSlotResponse, error) { result := WebAppsCreateOrUpdateDomainOwnershipIdentifierSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Identifier); err != nil { - return WebAppsCreateOrUpdateDomainOwnershipIdentifierSlotResponse{}, err + return WebAppsCreateOrUpdateDomainOwnershipIdentifierSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1797,7 +1804,7 @@ func (client *WebAppsClient) createOrUpdateFunctionSecretCreateRequest(ctx conte func (client *WebAppsClient) createOrUpdateFunctionSecretHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateFunctionSecretResponse, error) { result := WebAppsCreateOrUpdateFunctionSecretResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.KeyInfo); err != nil { - return WebAppsCreateOrUpdateFunctionSecretResponse{}, err + return WebAppsCreateOrUpdateFunctionSecretResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1874,7 +1881,7 @@ func (client *WebAppsClient) createOrUpdateFunctionSecretSlotCreateRequest(ctx c func (client *WebAppsClient) createOrUpdateFunctionSecretSlotHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateFunctionSecretSlotResponse, error) { result := WebAppsCreateOrUpdateFunctionSecretSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.KeyInfo); err != nil { - return WebAppsCreateOrUpdateFunctionSecretSlotResponse{}, err + return WebAppsCreateOrUpdateFunctionSecretSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -1943,7 +1950,7 @@ func (client *WebAppsClient) createOrUpdateHostNameBindingCreateRequest(ctx cont func (client *WebAppsClient) createOrUpdateHostNameBindingHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateHostNameBindingResponse, error) { result := WebAppsCreateOrUpdateHostNameBindingResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HostNameBinding); err != nil { - return WebAppsCreateOrUpdateHostNameBindingResponse{}, err + return WebAppsCreateOrUpdateHostNameBindingResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2016,7 +2023,7 @@ func (client *WebAppsClient) createOrUpdateHostNameBindingSlotCreateRequest(ctx func (client *WebAppsClient) createOrUpdateHostNameBindingSlotHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateHostNameBindingSlotResponse, error) { result := WebAppsCreateOrUpdateHostNameBindingSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HostNameBinding); err != nil { - return WebAppsCreateOrUpdateHostNameBindingSlotResponse{}, err + return WebAppsCreateOrUpdateHostNameBindingSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2089,7 +2096,7 @@ func (client *WebAppsClient) createOrUpdateHostSecretCreateRequest(ctx context.C func (client *WebAppsClient) createOrUpdateHostSecretHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateHostSecretResponse, error) { result := WebAppsCreateOrUpdateHostSecretResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.KeyInfo); err != nil { - return WebAppsCreateOrUpdateHostSecretResponse{}, err + return WebAppsCreateOrUpdateHostSecretResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2166,7 +2173,7 @@ func (client *WebAppsClient) createOrUpdateHostSecretSlotCreateRequest(ctx conte func (client *WebAppsClient) createOrUpdateHostSecretSlotHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateHostSecretSlotResponse, error) { result := WebAppsCreateOrUpdateHostSecretSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.KeyInfo); err != nil { - return WebAppsCreateOrUpdateHostSecretSlotResponse{}, err + return WebAppsCreateOrUpdateHostSecretSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2239,7 +2246,7 @@ func (client *WebAppsClient) createOrUpdateHybridConnectionCreateRequest(ctx con func (client *WebAppsClient) createOrUpdateHybridConnectionHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateHybridConnectionResponse, error) { result := WebAppsCreateOrUpdateHybridConnectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridConnection); err != nil { - return WebAppsCreateOrUpdateHybridConnectionResponse{}, err + return WebAppsCreateOrUpdateHybridConnectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2316,7 +2323,7 @@ func (client *WebAppsClient) createOrUpdateHybridConnectionSlotCreateRequest(ctx func (client *WebAppsClient) createOrUpdateHybridConnectionSlotHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateHybridConnectionSlotResponse, error) { result := WebAppsCreateOrUpdateHybridConnectionSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridConnection); err != nil { - return WebAppsCreateOrUpdateHybridConnectionSlotResponse{}, err + return WebAppsCreateOrUpdateHybridConnectionSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2385,7 +2392,7 @@ func (client *WebAppsClient) createOrUpdatePublicCertificateCreateRequest(ctx co func (client *WebAppsClient) createOrUpdatePublicCertificateHandleResponse(resp *http.Response) (WebAppsCreateOrUpdatePublicCertificateResponse, error) { result := WebAppsCreateOrUpdatePublicCertificateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicCertificate); err != nil { - return WebAppsCreateOrUpdatePublicCertificateResponse{}, err + return WebAppsCreateOrUpdatePublicCertificateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2458,7 +2465,7 @@ func (client *WebAppsClient) createOrUpdatePublicCertificateSlotCreateRequest(ct func (client *WebAppsClient) createOrUpdatePublicCertificateSlotHandleResponse(resp *http.Response) (WebAppsCreateOrUpdatePublicCertificateSlotResponse, error) { result := WebAppsCreateOrUpdatePublicCertificateSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicCertificate); err != nil { - return WebAppsCreateOrUpdatePublicCertificateSlotResponse{}, err + return WebAppsCreateOrUpdatePublicCertificateSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2527,7 +2534,7 @@ func (client *WebAppsClient) createOrUpdateRelayServiceConnectionCreateRequest(c func (client *WebAppsClient) createOrUpdateRelayServiceConnectionHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateRelayServiceConnectionResponse, error) { result := WebAppsCreateOrUpdateRelayServiceConnectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RelayServiceConnectionEntity); err != nil { - return WebAppsCreateOrUpdateRelayServiceConnectionResponse{}, err + return WebAppsCreateOrUpdateRelayServiceConnectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2600,7 +2607,7 @@ func (client *WebAppsClient) createOrUpdateRelayServiceConnectionSlotCreateReque func (client *WebAppsClient) createOrUpdateRelayServiceConnectionSlotHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateRelayServiceConnectionSlotResponse, error) { result := WebAppsCreateOrUpdateRelayServiceConnectionSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RelayServiceConnectionEntity); err != nil { - return WebAppsCreateOrUpdateRelayServiceConnectionSlotResponse{}, err + return WebAppsCreateOrUpdateRelayServiceConnectionSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2903,7 +2910,7 @@ func (client *WebAppsClient) createOrUpdateSwiftVirtualNetworkConnectionWithChec func (client *WebAppsClient) createOrUpdateSwiftVirtualNetworkConnectionWithCheckHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateSwiftVirtualNetworkConnectionWithCheckResponse, error) { result := WebAppsCreateOrUpdateSwiftVirtualNetworkConnectionWithCheckResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SwiftVirtualNetwork); err != nil { - return WebAppsCreateOrUpdateSwiftVirtualNetworkConnectionWithCheckResponse{}, err + return WebAppsCreateOrUpdateSwiftVirtualNetworkConnectionWithCheckResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -2974,7 +2981,7 @@ func (client *WebAppsClient) createOrUpdateSwiftVirtualNetworkConnectionWithChec func (client *WebAppsClient) createOrUpdateSwiftVirtualNetworkConnectionWithCheckSlotHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlotResponse, error) { result := WebAppsCreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SwiftVirtualNetwork); err != nil { - return WebAppsCreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlotResponse{}, err + return WebAppsCreateOrUpdateSwiftVirtualNetworkConnectionWithCheckSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -3043,7 +3050,7 @@ func (client *WebAppsClient) createOrUpdateVnetConnectionCreateRequest(ctx conte func (client *WebAppsClient) createOrUpdateVnetConnectionHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateVnetConnectionResponse, error) { result := WebAppsCreateOrUpdateVnetConnectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetInfoResource); err != nil { - return WebAppsCreateOrUpdateVnetConnectionResponse{}, err + return WebAppsCreateOrUpdateVnetConnectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -3116,7 +3123,7 @@ func (client *WebAppsClient) createOrUpdateVnetConnectionGatewayCreateRequest(ct func (client *WebAppsClient) createOrUpdateVnetConnectionGatewayHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateVnetConnectionGatewayResponse, error) { result := WebAppsCreateOrUpdateVnetConnectionGatewayResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetGateway); err != nil { - return WebAppsCreateOrUpdateVnetConnectionGatewayResponse{}, err + return WebAppsCreateOrUpdateVnetConnectionGatewayResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -3193,7 +3200,7 @@ func (client *WebAppsClient) createOrUpdateVnetConnectionGatewaySlotCreateReques func (client *WebAppsClient) createOrUpdateVnetConnectionGatewaySlotHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateVnetConnectionGatewaySlotResponse, error) { result := WebAppsCreateOrUpdateVnetConnectionGatewaySlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetGateway); err != nil { - return WebAppsCreateOrUpdateVnetConnectionGatewaySlotResponse{}, err + return WebAppsCreateOrUpdateVnetConnectionGatewaySlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -3266,7 +3273,7 @@ func (client *WebAppsClient) createOrUpdateVnetConnectionSlotCreateRequest(ctx c func (client *WebAppsClient) createOrUpdateVnetConnectionSlotHandleResponse(resp *http.Response) (WebAppsCreateOrUpdateVnetConnectionSlotResponse, error) { result := WebAppsCreateOrUpdateVnetConnectionSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetInfoResource); err != nil { - return WebAppsCreateOrUpdateVnetConnectionSlotResponse{}, err + return WebAppsCreateOrUpdateVnetConnectionSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -6328,7 +6335,7 @@ func (client *WebAppsClient) discoverBackupCreateRequest(ctx context.Context, re func (client *WebAppsClient) discoverBackupHandleResponse(resp *http.Response) (WebAppsDiscoverBackupResponse, error) { result := WebAppsDiscoverBackupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestoreRequest); err != nil { - return WebAppsDiscoverBackupResponse{}, err + return WebAppsDiscoverBackupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -6398,7 +6405,7 @@ func (client *WebAppsClient) discoverBackupSlotCreateRequest(ctx context.Context func (client *WebAppsClient) discoverBackupSlotHandleResponse(resp *http.Response) (WebAppsDiscoverBackupSlotResponse, error) { result := WebAppsDiscoverBackupSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RestoreRequest); err != nil { - return WebAppsDiscoverBackupSlotResponse{}, err + return WebAppsDiscoverBackupSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -6579,7 +6586,7 @@ func (client *WebAppsClient) getCreateRequest(ctx context.Context, resourceGroup func (client *WebAppsClient) getHandleResponse(resp *http.Response) (WebAppsGetResponse, error) { result := WebAppsGetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Site); err != nil { - return WebAppsGetResponse{}, err + return WebAppsGetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -6656,7 +6663,7 @@ func (client *WebAppsClient) getAppSettingKeyVaultReferenceCreateRequest(ctx con func (client *WebAppsClient) getAppSettingKeyVaultReferenceHandleResponse(resp *http.Response) (WebAppsGetAppSettingKeyVaultReferenceResponse, error) { result := WebAppsGetAppSettingKeyVaultReferenceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIKVReference); err != nil { - return WebAppsGetAppSettingKeyVaultReferenceResponse{}, err + return WebAppsGetAppSettingKeyVaultReferenceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -6729,7 +6736,7 @@ func (client *WebAppsClient) getAppSettingKeyVaultReferenceSlotCreateRequest(ctx func (client *WebAppsClient) getAppSettingKeyVaultReferenceSlotHandleResponse(resp *http.Response) (WebAppsGetAppSettingKeyVaultReferenceSlotResponse, error) { result := WebAppsGetAppSettingKeyVaultReferenceSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIKVReference); err != nil { - return WebAppsGetAppSettingKeyVaultReferenceSlotResponse{}, err + return WebAppsGetAppSettingKeyVaultReferenceSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -6791,7 +6798,7 @@ func (client *WebAppsClient) getAppSettingsKeyVaultReferencesCreateRequest(ctx c func (client *WebAppsClient) getAppSettingsKeyVaultReferencesHandleResponse(resp *http.Response) (WebAppsGetAppSettingsKeyVaultReferencesResponse, error) { result := WebAppsGetAppSettingsKeyVaultReferencesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIKVReferenceCollection); err != nil { - return WebAppsGetAppSettingsKeyVaultReferencesResponse{}, err + return WebAppsGetAppSettingsKeyVaultReferencesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -6857,7 +6864,7 @@ func (client *WebAppsClient) getAppSettingsKeyVaultReferencesSlotCreateRequest(c func (client *WebAppsClient) getAppSettingsKeyVaultReferencesSlotHandleResponse(resp *http.Response) (WebAppsGetAppSettingsKeyVaultReferencesSlotResponse, error) { result := WebAppsGetAppSettingsKeyVaultReferencesSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIKVReferenceCollection); err != nil { - return WebAppsGetAppSettingsKeyVaultReferencesSlotResponse{}, err + return WebAppsGetAppSettingsKeyVaultReferencesSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -6922,7 +6929,7 @@ func (client *WebAppsClient) getAuthSettingsCreateRequest(ctx context.Context, r func (client *WebAppsClient) getAuthSettingsHandleResponse(resp *http.Response) (WebAppsGetAuthSettingsResponse, error) { result := WebAppsGetAuthSettingsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteAuthSettings); err != nil { - return WebAppsGetAuthSettingsResponse{}, err + return WebAppsGetAuthSettingsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -6991,7 +6998,7 @@ func (client *WebAppsClient) getAuthSettingsSlotCreateRequest(ctx context.Contex func (client *WebAppsClient) getAuthSettingsSlotHandleResponse(resp *http.Response) (WebAppsGetAuthSettingsSlotResponse, error) { result := WebAppsGetAuthSettingsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteAuthSettings); err != nil { - return WebAppsGetAuthSettingsSlotResponse{}, err + return WebAppsGetAuthSettingsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -7056,7 +7063,7 @@ func (client *WebAppsClient) getAuthSettingsV2CreateRequest(ctx context.Context, func (client *WebAppsClient) getAuthSettingsV2HandleResponse(resp *http.Response) (WebAppsGetAuthSettingsV2Response, error) { result := WebAppsGetAuthSettingsV2Response{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteAuthSettingsV2); err != nil { - return WebAppsGetAuthSettingsV2Response{}, err + return WebAppsGetAuthSettingsV2Response{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -7125,7 +7132,7 @@ func (client *WebAppsClient) getAuthSettingsV2SlotCreateRequest(ctx context.Cont func (client *WebAppsClient) getAuthSettingsV2SlotHandleResponse(resp *http.Response) (WebAppsGetAuthSettingsV2SlotResponse, error) { result := WebAppsGetAuthSettingsV2SlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteAuthSettingsV2); err != nil { - return WebAppsGetAuthSettingsV2SlotResponse{}, err + return WebAppsGetAuthSettingsV2SlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -7190,7 +7197,7 @@ func (client *WebAppsClient) getBackupConfigurationCreateRequest(ctx context.Con func (client *WebAppsClient) getBackupConfigurationHandleResponse(resp *http.Response) (WebAppsGetBackupConfigurationResponse, error) { result := WebAppsGetBackupConfigurationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BackupRequest); err != nil { - return WebAppsGetBackupConfigurationResponse{}, err + return WebAppsGetBackupConfigurationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -7259,7 +7266,7 @@ func (client *WebAppsClient) getBackupConfigurationSlotCreateRequest(ctx context func (client *WebAppsClient) getBackupConfigurationSlotHandleResponse(resp *http.Response) (WebAppsGetBackupConfigurationSlotResponse, error) { result := WebAppsGetBackupConfigurationSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BackupRequest); err != nil { - return WebAppsGetBackupConfigurationSlotResponse{}, err + return WebAppsGetBackupConfigurationSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -7328,7 +7335,7 @@ func (client *WebAppsClient) getBackupStatusCreateRequest(ctx context.Context, r func (client *WebAppsClient) getBackupStatusHandleResponse(resp *http.Response) (WebAppsGetBackupStatusResponse, error) { result := WebAppsGetBackupStatusResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BackupItem); err != nil { - return WebAppsGetBackupStatusResponse{}, err + return WebAppsGetBackupStatusResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -7401,7 +7408,7 @@ func (client *WebAppsClient) getBackupStatusSlotCreateRequest(ctx context.Contex func (client *WebAppsClient) getBackupStatusSlotHandleResponse(resp *http.Response) (WebAppsGetBackupStatusSlotResponse, error) { result := WebAppsGetBackupStatusSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BackupItem); err != nil { - return WebAppsGetBackupStatusSlotResponse{}, err + return WebAppsGetBackupStatusSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -7467,7 +7474,7 @@ func (client *WebAppsClient) getConfigurationCreateRequest(ctx context.Context, func (client *WebAppsClient) getConfigurationHandleResponse(resp *http.Response) (WebAppsGetConfigurationResponse, error) { result := WebAppsGetConfigurationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResource); err != nil { - return WebAppsGetConfigurationResponse{}, err + return WebAppsGetConfigurationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -7537,7 +7544,7 @@ func (client *WebAppsClient) getConfigurationSlotCreateRequest(ctx context.Conte func (client *WebAppsClient) getConfigurationSlotHandleResponse(resp *http.Response) (WebAppsGetConfigurationSlotResponse, error) { result := WebAppsGetConfigurationSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResource); err != nil { - return WebAppsGetConfigurationSlotResponse{}, err + return WebAppsGetConfigurationSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -7606,7 +7613,7 @@ func (client *WebAppsClient) getConfigurationSnapshotCreateRequest(ctx context.C func (client *WebAppsClient) getConfigurationSnapshotHandleResponse(resp *http.Response) (WebAppsGetConfigurationSnapshotResponse, error) { result := WebAppsGetConfigurationSnapshotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResource); err != nil { - return WebAppsGetConfigurationSnapshotResponse{}, err + return WebAppsGetConfigurationSnapshotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -7679,7 +7686,7 @@ func (client *WebAppsClient) getConfigurationSnapshotSlotCreateRequest(ctx conte func (client *WebAppsClient) getConfigurationSnapshotSlotHandleResponse(resp *http.Response) (WebAppsGetConfigurationSnapshotSlotResponse, error) { result := WebAppsGetConfigurationSnapshotSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResource); err != nil { - return WebAppsGetConfigurationSnapshotSlotResponse{}, err + return WebAppsGetConfigurationSnapshotSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -7864,7 +7871,7 @@ func (client *WebAppsClient) getContinuousWebJobCreateRequest(ctx context.Contex func (client *WebAppsClient) getContinuousWebJobHandleResponse(resp *http.Response) (WebAppsGetContinuousWebJobResponse, error) { result := WebAppsGetContinuousWebJobResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ContinuousWebJob); err != nil { - return WebAppsGetContinuousWebJobResponse{}, err + return WebAppsGetContinuousWebJobResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -7945,7 +7952,7 @@ func (client *WebAppsClient) getContinuousWebJobSlotCreateRequest(ctx context.Co func (client *WebAppsClient) getContinuousWebJobSlotHandleResponse(resp *http.Response) (WebAppsGetContinuousWebJobSlotResponse, error) { result := WebAppsGetContinuousWebJobSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ContinuousWebJob); err != nil { - return WebAppsGetContinuousWebJobSlotResponse{}, err + return WebAppsGetContinuousWebJobSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -8022,7 +8029,7 @@ func (client *WebAppsClient) getDeploymentCreateRequest(ctx context.Context, res func (client *WebAppsClient) getDeploymentHandleResponse(resp *http.Response) (WebAppsGetDeploymentResponse, error) { result := WebAppsGetDeploymentResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Deployment); err != nil { - return WebAppsGetDeploymentResponse{}, err + return WebAppsGetDeploymentResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -8095,7 +8102,7 @@ func (client *WebAppsClient) getDeploymentSlotCreateRequest(ctx context.Context, func (client *WebAppsClient) getDeploymentSlotHandleResponse(resp *http.Response) (WebAppsGetDeploymentSlotResponse, error) { result := WebAppsGetDeploymentSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Deployment); err != nil { - return WebAppsGetDeploymentSlotResponse{}, err + return WebAppsGetDeploymentSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -8160,7 +8167,7 @@ func (client *WebAppsClient) getDiagnosticLogsConfigurationCreateRequest(ctx con func (client *WebAppsClient) getDiagnosticLogsConfigurationHandleResponse(resp *http.Response) (WebAppsGetDiagnosticLogsConfigurationResponse, error) { result := WebAppsGetDiagnosticLogsConfigurationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteLogsConfig); err != nil { - return WebAppsGetDiagnosticLogsConfigurationResponse{}, err + return WebAppsGetDiagnosticLogsConfigurationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -8229,7 +8236,7 @@ func (client *WebAppsClient) getDiagnosticLogsConfigurationSlotCreateRequest(ctx func (client *WebAppsClient) getDiagnosticLogsConfigurationSlotHandleResponse(resp *http.Response) (WebAppsGetDiagnosticLogsConfigurationSlotResponse, error) { result := WebAppsGetDiagnosticLogsConfigurationSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteLogsConfig); err != nil { - return WebAppsGetDiagnosticLogsConfigurationSlotResponse{}, err + return WebAppsGetDiagnosticLogsConfigurationSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -8298,7 +8305,7 @@ func (client *WebAppsClient) getDomainOwnershipIdentifierCreateRequest(ctx conte func (client *WebAppsClient) getDomainOwnershipIdentifierHandleResponse(resp *http.Response) (WebAppsGetDomainOwnershipIdentifierResponse, error) { result := WebAppsGetDomainOwnershipIdentifierResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Identifier); err != nil { - return WebAppsGetDomainOwnershipIdentifierResponse{}, err + return WebAppsGetDomainOwnershipIdentifierResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -8371,7 +8378,7 @@ func (client *WebAppsClient) getDomainOwnershipIdentifierSlotCreateRequest(ctx c func (client *WebAppsClient) getDomainOwnershipIdentifierSlotHandleResponse(resp *http.Response) (WebAppsGetDomainOwnershipIdentifierSlotResponse, error) { result := WebAppsGetDomainOwnershipIdentifierSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Identifier); err != nil { - return WebAppsGetDomainOwnershipIdentifierSlotResponse{}, err + return WebAppsGetDomainOwnershipIdentifierSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -8436,7 +8443,7 @@ func (client *WebAppsClient) getFtpAllowedCreateRequest(ctx context.Context, res func (client *WebAppsClient) getFtpAllowedHandleResponse(resp *http.Response) (WebAppsGetFtpAllowedResponse, error) { result := WebAppsGetFtpAllowedResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CsmPublishingCredentialsPoliciesEntity); err != nil { - return WebAppsGetFtpAllowedResponse{}, err + return WebAppsGetFtpAllowedResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -8505,7 +8512,7 @@ func (client *WebAppsClient) getFtpAllowedSlotCreateRequest(ctx context.Context, func (client *WebAppsClient) getFtpAllowedSlotHandleResponse(resp *http.Response) (WebAppsGetFtpAllowedSlotResponse, error) { result := WebAppsGetFtpAllowedSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CsmPublishingCredentialsPoliciesEntity); err != nil { - return WebAppsGetFtpAllowedSlotResponse{}, err + return WebAppsGetFtpAllowedSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -8574,7 +8581,7 @@ func (client *WebAppsClient) getFunctionCreateRequest(ctx context.Context, resou func (client *WebAppsClient) getFunctionHandleResponse(resp *http.Response) (WebAppsGetFunctionResponse, error) { result := WebAppsGetFunctionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FunctionEnvelope); err != nil { - return WebAppsGetFunctionResponse{}, err + return WebAppsGetFunctionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -8647,7 +8654,7 @@ func (client *WebAppsClient) getFunctionsAdminTokenCreateRequest(ctx context.Con func (client *WebAppsClient) getFunctionsAdminTokenHandleResponse(resp *http.Response) (WebAppsGetFunctionsAdminTokenResponse, error) { result := WebAppsGetFunctionsAdminTokenResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Value); err != nil { - return WebAppsGetFunctionsAdminTokenResponse{}, err + return WebAppsGetFunctionsAdminTokenResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -8716,7 +8723,7 @@ func (client *WebAppsClient) getFunctionsAdminTokenSlotCreateRequest(ctx context func (client *WebAppsClient) getFunctionsAdminTokenSlotHandleResponse(resp *http.Response) (WebAppsGetFunctionsAdminTokenSlotResponse, error) { result := WebAppsGetFunctionsAdminTokenSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Value); err != nil { - return WebAppsGetFunctionsAdminTokenSlotResponse{}, err + return WebAppsGetFunctionsAdminTokenSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -8785,7 +8792,7 @@ func (client *WebAppsClient) getHostNameBindingCreateRequest(ctx context.Context func (client *WebAppsClient) getHostNameBindingHandleResponse(resp *http.Response) (WebAppsGetHostNameBindingResponse, error) { result := WebAppsGetHostNameBindingResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HostNameBinding); err != nil { - return WebAppsGetHostNameBindingResponse{}, err + return WebAppsGetHostNameBindingResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -8858,7 +8865,7 @@ func (client *WebAppsClient) getHostNameBindingSlotCreateRequest(ctx context.Con func (client *WebAppsClient) getHostNameBindingSlotHandleResponse(resp *http.Response) (WebAppsGetHostNameBindingSlotResponse, error) { result := WebAppsGetHostNameBindingSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HostNameBinding); err != nil { - return WebAppsGetHostNameBindingSlotResponse{}, err + return WebAppsGetHostNameBindingSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -8931,7 +8938,7 @@ func (client *WebAppsClient) getHybridConnectionCreateRequest(ctx context.Contex func (client *WebAppsClient) getHybridConnectionHandleResponse(resp *http.Response) (WebAppsGetHybridConnectionResponse, error) { result := WebAppsGetHybridConnectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridConnection); err != nil { - return WebAppsGetHybridConnectionResponse{}, err + return WebAppsGetHybridConnectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -9008,7 +9015,7 @@ func (client *WebAppsClient) getHybridConnectionSlotCreateRequest(ctx context.Co func (client *WebAppsClient) getHybridConnectionSlotHandleResponse(resp *http.Response) (WebAppsGetHybridConnectionSlotResponse, error) { result := WebAppsGetHybridConnectionSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridConnection); err != nil { - return WebAppsGetHybridConnectionSlotResponse{}, err + return WebAppsGetHybridConnectionSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -9081,7 +9088,7 @@ func (client *WebAppsClient) getInstanceFunctionSlotCreateRequest(ctx context.Co func (client *WebAppsClient) getInstanceFunctionSlotHandleResponse(resp *http.Response) (WebAppsGetInstanceFunctionSlotResponse, error) { result := WebAppsGetInstanceFunctionSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FunctionEnvelope); err != nil { - return WebAppsGetInstanceFunctionSlotResponse{}, err + return WebAppsGetInstanceFunctionSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -9158,7 +9165,7 @@ func (client *WebAppsClient) getInstanceInfoCreateRequest(ctx context.Context, r func (client *WebAppsClient) getInstanceInfoHandleResponse(resp *http.Response) (WebAppsGetInstanceInfoResponse, error) { result := WebAppsGetInstanceInfoResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebSiteInstanceStatus); err != nil { - return WebAppsGetInstanceInfoResponse{}, err + return WebAppsGetInstanceInfoResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -9231,7 +9238,7 @@ func (client *WebAppsClient) getInstanceInfoSlotCreateRequest(ctx context.Contex func (client *WebAppsClient) getInstanceInfoSlotHandleResponse(resp *http.Response) (WebAppsGetInstanceInfoSlotResponse, error) { result := WebAppsGetInstanceInfoSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebSiteInstanceStatus); err != nil { - return WebAppsGetInstanceInfoSlotResponse{}, err + return WebAppsGetInstanceInfoSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -9300,7 +9307,7 @@ func (client *WebAppsClient) getInstanceMSDeployLogCreateRequest(ctx context.Con func (client *WebAppsClient) getInstanceMSDeployLogHandleResponse(resp *http.Response) (WebAppsGetInstanceMSDeployLogResponse, error) { result := WebAppsGetInstanceMSDeployLogResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MSDeployLog); err != nil { - return WebAppsGetInstanceMSDeployLogResponse{}, err + return WebAppsGetInstanceMSDeployLogResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -9381,7 +9388,7 @@ func (client *WebAppsClient) getInstanceMSDeployLogSlotCreateRequest(ctx context func (client *WebAppsClient) getInstanceMSDeployLogSlotHandleResponse(resp *http.Response) (WebAppsGetInstanceMSDeployLogSlotResponse, error) { result := WebAppsGetInstanceMSDeployLogSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MSDeployLog); err != nil { - return WebAppsGetInstanceMSDeployLogSlotResponse{}, err + return WebAppsGetInstanceMSDeployLogSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -9458,7 +9465,7 @@ func (client *WebAppsClient) getInstanceMsDeployStatusCreateRequest(ctx context. func (client *WebAppsClient) getInstanceMsDeployStatusHandleResponse(resp *http.Response) (WebAppsGetInstanceMsDeployStatusResponse, error) { result := WebAppsGetInstanceMsDeployStatusResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MSDeployStatus); err != nil { - return WebAppsGetInstanceMsDeployStatusResponse{}, err + return WebAppsGetInstanceMsDeployStatusResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -9531,7 +9538,7 @@ func (client *WebAppsClient) getInstanceMsDeployStatusSlotCreateRequest(ctx cont func (client *WebAppsClient) getInstanceMsDeployStatusSlotHandleResponse(resp *http.Response) (WebAppsGetInstanceMsDeployStatusSlotResponse, error) { result := WebAppsGetInstanceMsDeployStatusSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MSDeployStatus); err != nil { - return WebAppsGetInstanceMsDeployStatusSlotResponse{}, err + return WebAppsGetInstanceMsDeployStatusSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -9604,7 +9611,7 @@ func (client *WebAppsClient) getInstanceProcessCreateRequest(ctx context.Context func (client *WebAppsClient) getInstanceProcessHandleResponse(resp *http.Response) (WebAppsGetInstanceProcessResponse, error) { result := WebAppsGetInstanceProcessResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessInfo); err != nil { - return WebAppsGetInstanceProcessResponse{}, err + return WebAppsGetInstanceProcessResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -9839,7 +9846,7 @@ func (client *WebAppsClient) getInstanceProcessModuleCreateRequest(ctx context.C func (client *WebAppsClient) getInstanceProcessModuleHandleResponse(resp *http.Response) (WebAppsGetInstanceProcessModuleResponse, error) { result := WebAppsGetInstanceProcessModuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessModuleInfo); err != nil { - return WebAppsGetInstanceProcessModuleResponse{}, err + return WebAppsGetInstanceProcessModuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -9928,7 +9935,7 @@ func (client *WebAppsClient) getInstanceProcessModuleSlotCreateRequest(ctx conte func (client *WebAppsClient) getInstanceProcessModuleSlotHandleResponse(resp *http.Response) (WebAppsGetInstanceProcessModuleSlotResponse, error) { result := WebAppsGetInstanceProcessModuleSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessModuleInfo); err != nil { - return WebAppsGetInstanceProcessModuleSlotResponse{}, err + return WebAppsGetInstanceProcessModuleSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -10013,7 +10020,7 @@ func (client *WebAppsClient) getInstanceProcessSlotCreateRequest(ctx context.Con func (client *WebAppsClient) getInstanceProcessSlotHandleResponse(resp *http.Response) (WebAppsGetInstanceProcessSlotResponse, error) { result := WebAppsGetInstanceProcessSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessInfo); err != nil { - return WebAppsGetInstanceProcessSlotResponse{}, err + return WebAppsGetInstanceProcessSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -10086,7 +10093,7 @@ func (client *WebAppsClient) getMSDeployLogCreateRequest(ctx context.Context, re func (client *WebAppsClient) getMSDeployLogHandleResponse(resp *http.Response) (WebAppsGetMSDeployLogResponse, error) { result := WebAppsGetMSDeployLogResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MSDeployLog); err != nil { - return WebAppsGetMSDeployLogResponse{}, err + return WebAppsGetMSDeployLogResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -10163,7 +10170,7 @@ func (client *WebAppsClient) getMSDeployLogSlotCreateRequest(ctx context.Context func (client *WebAppsClient) getMSDeployLogSlotHandleResponse(resp *http.Response) (WebAppsGetMSDeployLogSlotResponse, error) { result := WebAppsGetMSDeployLogSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MSDeployLog); err != nil { - return WebAppsGetMSDeployLogSlotResponse{}, err + return WebAppsGetMSDeployLogSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -10236,7 +10243,7 @@ func (client *WebAppsClient) getMSDeployStatusCreateRequest(ctx context.Context, func (client *WebAppsClient) getMSDeployStatusHandleResponse(resp *http.Response) (WebAppsGetMSDeployStatusResponse, error) { result := WebAppsGetMSDeployStatusResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MSDeployStatus); err != nil { - return WebAppsGetMSDeployStatusResponse{}, err + return WebAppsGetMSDeployStatusResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -10305,7 +10312,7 @@ func (client *WebAppsClient) getMSDeployStatusSlotCreateRequest(ctx context.Cont func (client *WebAppsClient) getMSDeployStatusSlotHandleResponse(resp *http.Response) (WebAppsGetMSDeployStatusSlotResponse, error) { result := WebAppsGetMSDeployStatusSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MSDeployStatus); err != nil { - return WebAppsGetMSDeployStatusSlotResponse{}, err + return WebAppsGetMSDeployStatusSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -10370,7 +10377,7 @@ func (client *WebAppsClient) getMigrateMySQLStatusCreateRequest(ctx context.Cont func (client *WebAppsClient) getMigrateMySQLStatusHandleResponse(resp *http.Response) (WebAppsGetMigrateMySQLStatusResponse, error) { result := WebAppsGetMigrateMySQLStatusResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MigrateMySQLStatus); err != nil { - return WebAppsGetMigrateMySQLStatusResponse{}, err + return WebAppsGetMigrateMySQLStatusResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -10439,7 +10446,7 @@ func (client *WebAppsClient) getMigrateMySQLStatusSlotCreateRequest(ctx context. func (client *WebAppsClient) getMigrateMySQLStatusSlotHandleResponse(resp *http.Response) (WebAppsGetMigrateMySQLStatusSlotResponse, error) { result := WebAppsGetMigrateMySQLStatusSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.MigrateMySQLStatus); err != nil { - return WebAppsGetMigrateMySQLStatusSlotResponse{}, err + return WebAppsGetMigrateMySQLStatusSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -10508,7 +10515,7 @@ func (client *WebAppsClient) getNetworkTraceOperationCreateRequest(ctx context.C func (client *WebAppsClient) getNetworkTraceOperationHandleResponse(resp *http.Response) (WebAppsGetNetworkTraceOperationResponse, error) { result := WebAppsGetNetworkTraceOperationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkTraceArray); err != nil { - return WebAppsGetNetworkTraceOperationResponse{}, err + return WebAppsGetNetworkTraceOperationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -10581,7 +10588,7 @@ func (client *WebAppsClient) getNetworkTraceOperationSlotCreateRequest(ctx conte func (client *WebAppsClient) getNetworkTraceOperationSlotHandleResponse(resp *http.Response) (WebAppsGetNetworkTraceOperationSlotResponse, error) { result := WebAppsGetNetworkTraceOperationSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkTraceArray); err != nil { - return WebAppsGetNetworkTraceOperationSlotResponse{}, err + return WebAppsGetNetworkTraceOperationSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -10654,7 +10661,7 @@ func (client *WebAppsClient) getNetworkTraceOperationSlotV2CreateRequest(ctx con func (client *WebAppsClient) getNetworkTraceOperationSlotV2HandleResponse(resp *http.Response) (WebAppsGetNetworkTraceOperationSlotV2Response, error) { result := WebAppsGetNetworkTraceOperationSlotV2Response{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkTraceArray); err != nil { - return WebAppsGetNetworkTraceOperationSlotV2Response{}, err + return WebAppsGetNetworkTraceOperationSlotV2Response{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -10723,7 +10730,7 @@ func (client *WebAppsClient) getNetworkTraceOperationV2CreateRequest(ctx context func (client *WebAppsClient) getNetworkTraceOperationV2HandleResponse(resp *http.Response) (WebAppsGetNetworkTraceOperationV2Response, error) { result := WebAppsGetNetworkTraceOperationV2Response{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkTraceArray); err != nil { - return WebAppsGetNetworkTraceOperationV2Response{}, err + return WebAppsGetNetworkTraceOperationV2Response{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -10792,7 +10799,7 @@ func (client *WebAppsClient) getNetworkTracesCreateRequest(ctx context.Context, func (client *WebAppsClient) getNetworkTracesHandleResponse(resp *http.Response) (WebAppsGetNetworkTracesResponse, error) { result := WebAppsGetNetworkTracesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkTraceArray); err != nil { - return WebAppsGetNetworkTracesResponse{}, err + return WebAppsGetNetworkTracesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -10865,7 +10872,7 @@ func (client *WebAppsClient) getNetworkTracesSlotCreateRequest(ctx context.Conte func (client *WebAppsClient) getNetworkTracesSlotHandleResponse(resp *http.Response) (WebAppsGetNetworkTracesSlotResponse, error) { result := WebAppsGetNetworkTracesSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkTraceArray); err != nil { - return WebAppsGetNetworkTracesSlotResponse{}, err + return WebAppsGetNetworkTracesSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -10938,7 +10945,7 @@ func (client *WebAppsClient) getNetworkTracesSlotV2CreateRequest(ctx context.Con func (client *WebAppsClient) getNetworkTracesSlotV2HandleResponse(resp *http.Response) (WebAppsGetNetworkTracesSlotV2Response, error) { result := WebAppsGetNetworkTracesSlotV2Response{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkTraceArray); err != nil { - return WebAppsGetNetworkTracesSlotV2Response{}, err + return WebAppsGetNetworkTracesSlotV2Response{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -11007,7 +11014,7 @@ func (client *WebAppsClient) getNetworkTracesV2CreateRequest(ctx context.Context func (client *WebAppsClient) getNetworkTracesV2HandleResponse(resp *http.Response) (WebAppsGetNetworkTracesV2Response, error) { result := WebAppsGetNetworkTracesV2Response{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkTraceArray); err != nil { - return WebAppsGetNetworkTracesV2Response{}, err + return WebAppsGetNetworkTracesV2Response{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -11076,7 +11083,7 @@ func (client *WebAppsClient) getPremierAddOnCreateRequest(ctx context.Context, r func (client *WebAppsClient) getPremierAddOnHandleResponse(resp *http.Response) (WebAppsGetPremierAddOnResponse, error) { result := WebAppsGetPremierAddOnResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PremierAddOn); err != nil { - return WebAppsGetPremierAddOnResponse{}, err + return WebAppsGetPremierAddOnResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -11149,7 +11156,7 @@ func (client *WebAppsClient) getPremierAddOnSlotCreateRequest(ctx context.Contex func (client *WebAppsClient) getPremierAddOnSlotHandleResponse(resp *http.Response) (WebAppsGetPremierAddOnSlotResponse, error) { result := WebAppsGetPremierAddOnSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PremierAddOn); err != nil { - return WebAppsGetPremierAddOnSlotResponse{}, err + return WebAppsGetPremierAddOnSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -11214,7 +11221,7 @@ func (client *WebAppsClient) getPrivateAccessCreateRequest(ctx context.Context, func (client *WebAppsClient) getPrivateAccessHandleResponse(resp *http.Response) (WebAppsGetPrivateAccessResponse, error) { result := WebAppsGetPrivateAccessResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateAccess); err != nil { - return WebAppsGetPrivateAccessResponse{}, err + return WebAppsGetPrivateAccessResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -11283,7 +11290,7 @@ func (client *WebAppsClient) getPrivateAccessSlotCreateRequest(ctx context.Conte func (client *WebAppsClient) getPrivateAccessSlotHandleResponse(resp *http.Response) (WebAppsGetPrivateAccessSlotResponse, error) { result := WebAppsGetPrivateAccessSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateAccess); err != nil { - return WebAppsGetPrivateAccessSlotResponse{}, err + return WebAppsGetPrivateAccessSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -11352,7 +11359,7 @@ func (client *WebAppsClient) getPrivateEndpointConnectionCreateRequest(ctx conte func (client *WebAppsClient) getPrivateEndpointConnectionHandleResponse(resp *http.Response) (WebAppsGetPrivateEndpointConnectionResponse, error) { result := WebAppsGetPrivateEndpointConnectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RemotePrivateEndpointConnectionARMResource); err != nil { - return WebAppsGetPrivateEndpointConnectionResponse{}, err + return WebAppsGetPrivateEndpointConnectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -11414,7 +11421,7 @@ func (client *WebAppsClient) getPrivateEndpointConnectionListCreateRequest(ctx c func (client *WebAppsClient) getPrivateEndpointConnectionListHandleResponse(resp *http.Response) (WebAppsGetPrivateEndpointConnectionListResponse, error) { result := WebAppsGetPrivateEndpointConnectionListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionCollection); err != nil { - return WebAppsGetPrivateEndpointConnectionListResponse{}, err + return WebAppsGetPrivateEndpointConnectionListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -11480,7 +11487,7 @@ func (client *WebAppsClient) getPrivateEndpointConnectionListSlotCreateRequest(c func (client *WebAppsClient) getPrivateEndpointConnectionListSlotHandleResponse(resp *http.Response) (WebAppsGetPrivateEndpointConnectionListSlotResponse, error) { result := WebAppsGetPrivateEndpointConnectionListSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateEndpointConnectionCollection); err != nil { - return WebAppsGetPrivateEndpointConnectionListSlotResponse{}, err + return WebAppsGetPrivateEndpointConnectionListSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -11553,7 +11560,7 @@ func (client *WebAppsClient) getPrivateEndpointConnectionSlotCreateRequest(ctx c func (client *WebAppsClient) getPrivateEndpointConnectionSlotHandleResponse(resp *http.Response) (WebAppsGetPrivateEndpointConnectionSlotResponse, error) { result := WebAppsGetPrivateEndpointConnectionSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RemotePrivateEndpointConnectionARMResource); err != nil { - return WebAppsGetPrivateEndpointConnectionSlotResponse{}, err + return WebAppsGetPrivateEndpointConnectionSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -11618,7 +11625,7 @@ func (client *WebAppsClient) getPrivateLinkResourcesCreateRequest(ctx context.Co func (client *WebAppsClient) getPrivateLinkResourcesHandleResponse(resp *http.Response) (WebAppsGetPrivateLinkResourcesResponse, error) { result := WebAppsGetPrivateLinkResourcesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourcesWrapper); err != nil { - return WebAppsGetPrivateLinkResourcesResponse{}, err + return WebAppsGetPrivateLinkResourcesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -11687,7 +11694,7 @@ func (client *WebAppsClient) getPrivateLinkResourcesSlotCreateRequest(ctx contex func (client *WebAppsClient) getPrivateLinkResourcesSlotHandleResponse(resp *http.Response) (WebAppsGetPrivateLinkResourcesSlotResponse, error) { result := WebAppsGetPrivateLinkResourcesSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateLinkResourcesWrapper); err != nil { - return WebAppsGetPrivateLinkResourcesSlotResponse{}, err + return WebAppsGetPrivateLinkResourcesSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -11756,7 +11763,7 @@ func (client *WebAppsClient) getProcessCreateRequest(ctx context.Context, resour func (client *WebAppsClient) getProcessHandleResponse(resp *http.Response) (WebAppsGetProcessResponse, error) { result := WebAppsGetProcessResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessInfo); err != nil { - return WebAppsGetProcessResponse{}, err + return WebAppsGetProcessResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -11979,7 +11986,7 @@ func (client *WebAppsClient) getProcessModuleCreateRequest(ctx context.Context, func (client *WebAppsClient) getProcessModuleHandleResponse(resp *http.Response) (WebAppsGetProcessModuleResponse, error) { result := WebAppsGetProcessModuleResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessModuleInfo); err != nil { - return WebAppsGetProcessModuleResponse{}, err + return WebAppsGetProcessModuleResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -12064,7 +12071,7 @@ func (client *WebAppsClient) getProcessModuleSlotCreateRequest(ctx context.Conte func (client *WebAppsClient) getProcessModuleSlotHandleResponse(resp *http.Response) (WebAppsGetProcessModuleSlotResponse, error) { result := WebAppsGetProcessModuleSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessModuleInfo); err != nil { - return WebAppsGetProcessModuleSlotResponse{}, err + return WebAppsGetProcessModuleSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -12145,7 +12152,7 @@ func (client *WebAppsClient) getProcessSlotCreateRequest(ctx context.Context, re func (client *WebAppsClient) getProcessSlotHandleResponse(resp *http.Response) (WebAppsGetProcessSlotResponse, error) { result := WebAppsGetProcessSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessInfo); err != nil { - return WebAppsGetProcessSlotResponse{}, err + return WebAppsGetProcessSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -12222,7 +12229,7 @@ func (client *WebAppsClient) getPublicCertificateCreateRequest(ctx context.Conte func (client *WebAppsClient) getPublicCertificateHandleResponse(resp *http.Response) (WebAppsGetPublicCertificateResponse, error) { result := WebAppsGetPublicCertificateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicCertificate); err != nil { - return WebAppsGetPublicCertificateResponse{}, err + return WebAppsGetPublicCertificateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -12295,7 +12302,7 @@ func (client *WebAppsClient) getPublicCertificateSlotCreateRequest(ctx context.C func (client *WebAppsClient) getPublicCertificateSlotHandleResponse(resp *http.Response) (WebAppsGetPublicCertificateSlotResponse, error) { result := WebAppsGetPublicCertificateSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicCertificate); err != nil { - return WebAppsGetPublicCertificateSlotResponse{}, err + return WebAppsGetPublicCertificateSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -12364,7 +12371,7 @@ func (client *WebAppsClient) getRelayServiceConnectionCreateRequest(ctx context. func (client *WebAppsClient) getRelayServiceConnectionHandleResponse(resp *http.Response) (WebAppsGetRelayServiceConnectionResponse, error) { result := WebAppsGetRelayServiceConnectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RelayServiceConnectionEntity); err != nil { - return WebAppsGetRelayServiceConnectionResponse{}, err + return WebAppsGetRelayServiceConnectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -12437,7 +12444,7 @@ func (client *WebAppsClient) getRelayServiceConnectionSlotCreateRequest(ctx cont func (client *WebAppsClient) getRelayServiceConnectionSlotHandleResponse(resp *http.Response) (WebAppsGetRelayServiceConnectionSlotResponse, error) { result := WebAppsGetRelayServiceConnectionSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RelayServiceConnectionEntity); err != nil { - return WebAppsGetRelayServiceConnectionSlotResponse{}, err + return WebAppsGetRelayServiceConnectionSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -12502,7 +12509,7 @@ func (client *WebAppsClient) getScmAllowedCreateRequest(ctx context.Context, res func (client *WebAppsClient) getScmAllowedHandleResponse(resp *http.Response) (WebAppsGetScmAllowedResponse, error) { result := WebAppsGetScmAllowedResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CsmPublishingCredentialsPoliciesEntity); err != nil { - return WebAppsGetScmAllowedResponse{}, err + return WebAppsGetScmAllowedResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -12571,7 +12578,7 @@ func (client *WebAppsClient) getScmAllowedSlotCreateRequest(ctx context.Context, func (client *WebAppsClient) getScmAllowedSlotHandleResponse(resp *http.Response) (WebAppsGetScmAllowedSlotResponse, error) { result := WebAppsGetScmAllowedSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CsmPublishingCredentialsPoliciesEntity); err != nil { - return WebAppsGetScmAllowedSlotResponse{}, err + return WebAppsGetScmAllowedSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -12640,7 +12647,7 @@ func (client *WebAppsClient) getSiteConnectionStringKeyVaultReferenceCreateReque func (client *WebAppsClient) getSiteConnectionStringKeyVaultReferenceHandleResponse(resp *http.Response) (WebAppsGetSiteConnectionStringKeyVaultReferenceResponse, error) { result := WebAppsGetSiteConnectionStringKeyVaultReferenceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIKVReference); err != nil { - return WebAppsGetSiteConnectionStringKeyVaultReferenceResponse{}, err + return WebAppsGetSiteConnectionStringKeyVaultReferenceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -12713,7 +12720,7 @@ func (client *WebAppsClient) getSiteConnectionStringKeyVaultReferenceSlotCreateR func (client *WebAppsClient) getSiteConnectionStringKeyVaultReferenceSlotHandleResponse(resp *http.Response) (WebAppsGetSiteConnectionStringKeyVaultReferenceSlotResponse, error) { result := WebAppsGetSiteConnectionStringKeyVaultReferenceSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIKVReference); err != nil { - return WebAppsGetSiteConnectionStringKeyVaultReferenceSlotResponse{}, err + return WebAppsGetSiteConnectionStringKeyVaultReferenceSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -12775,7 +12782,7 @@ func (client *WebAppsClient) getSiteConnectionStringKeyVaultReferencesCreateRequ func (client *WebAppsClient) getSiteConnectionStringKeyVaultReferencesHandleResponse(resp *http.Response) (WebAppsGetSiteConnectionStringKeyVaultReferencesResponse, error) { result := WebAppsGetSiteConnectionStringKeyVaultReferencesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIKVReferenceCollection); err != nil { - return WebAppsGetSiteConnectionStringKeyVaultReferencesResponse{}, err + return WebAppsGetSiteConnectionStringKeyVaultReferencesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -12841,7 +12848,7 @@ func (client *WebAppsClient) getSiteConnectionStringKeyVaultReferencesSlotCreate func (client *WebAppsClient) getSiteConnectionStringKeyVaultReferencesSlotHandleResponse(resp *http.Response) (WebAppsGetSiteConnectionStringKeyVaultReferencesSlotResponse, error) { result := WebAppsGetSiteConnectionStringKeyVaultReferencesSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.APIKVReferenceCollection); err != nil { - return WebAppsGetSiteConnectionStringKeyVaultReferencesSlotResponse{}, err + return WebAppsGetSiteConnectionStringKeyVaultReferencesSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -12910,7 +12917,7 @@ func (client *WebAppsClient) getSiteExtensionCreateRequest(ctx context.Context, func (client *WebAppsClient) getSiteExtensionHandleResponse(resp *http.Response) (WebAppsGetSiteExtensionResponse, error) { result := WebAppsGetSiteExtensionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteExtensionInfo); err != nil { - return WebAppsGetSiteExtensionResponse{}, err + return WebAppsGetSiteExtensionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -12991,7 +12998,7 @@ func (client *WebAppsClient) getSiteExtensionSlotCreateRequest(ctx context.Conte func (client *WebAppsClient) getSiteExtensionSlotHandleResponse(resp *http.Response) (WebAppsGetSiteExtensionSlotResponse, error) { result := WebAppsGetSiteExtensionSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteExtensionInfo); err != nil { - return WebAppsGetSiteExtensionSlotResponse{}, err + return WebAppsGetSiteExtensionSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -13064,7 +13071,7 @@ func (client *WebAppsClient) getSitePhpErrorLogFlagCreateRequest(ctx context.Con func (client *WebAppsClient) getSitePhpErrorLogFlagHandleResponse(resp *http.Response) (WebAppsGetSitePhpErrorLogFlagResponse, error) { result := WebAppsGetSitePhpErrorLogFlagResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SitePhpErrorLogFlag); err != nil { - return WebAppsGetSitePhpErrorLogFlagResponse{}, err + return WebAppsGetSitePhpErrorLogFlagResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -13133,7 +13140,7 @@ func (client *WebAppsClient) getSitePhpErrorLogFlagSlotCreateRequest(ctx context func (client *WebAppsClient) getSitePhpErrorLogFlagSlotHandleResponse(resp *http.Response) (WebAppsGetSitePhpErrorLogFlagSlotResponse, error) { result := WebAppsGetSitePhpErrorLogFlagSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SitePhpErrorLogFlag); err != nil { - return WebAppsGetSitePhpErrorLogFlagSlotResponse{}, err + return WebAppsGetSitePhpErrorLogFlagSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -13202,7 +13209,7 @@ func (client *WebAppsClient) getSlotCreateRequest(ctx context.Context, resourceG func (client *WebAppsClient) getSlotHandleResponse(resp *http.Response) (WebAppsGetSlotResponse, error) { result := WebAppsGetSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Site); err != nil { - return WebAppsGetSlotResponse{}, err + return WebAppsGetSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -13275,7 +13282,7 @@ func (client *WebAppsClient) getSourceControlCreateRequest(ctx context.Context, func (client *WebAppsClient) getSourceControlHandleResponse(resp *http.Response) (WebAppsGetSourceControlResponse, error) { result := WebAppsGetSourceControlResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteSourceControl); err != nil { - return WebAppsGetSourceControlResponse{}, err + return WebAppsGetSourceControlResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -13344,7 +13351,7 @@ func (client *WebAppsClient) getSourceControlSlotCreateRequest(ctx context.Conte func (client *WebAppsClient) getSourceControlSlotHandleResponse(resp *http.Response) (WebAppsGetSourceControlSlotResponse, error) { result := WebAppsGetSourceControlSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteSourceControl); err != nil { - return WebAppsGetSourceControlSlotResponse{}, err + return WebAppsGetSourceControlSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -13409,7 +13416,7 @@ func (client *WebAppsClient) getSwiftVirtualNetworkConnectionCreateRequest(ctx c func (client *WebAppsClient) getSwiftVirtualNetworkConnectionHandleResponse(resp *http.Response) (WebAppsGetSwiftVirtualNetworkConnectionResponse, error) { result := WebAppsGetSwiftVirtualNetworkConnectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SwiftVirtualNetwork); err != nil { - return WebAppsGetSwiftVirtualNetworkConnectionResponse{}, err + return WebAppsGetSwiftVirtualNetworkConnectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -13478,7 +13485,7 @@ func (client *WebAppsClient) getSwiftVirtualNetworkConnectionSlotCreateRequest(c func (client *WebAppsClient) getSwiftVirtualNetworkConnectionSlotHandleResponse(resp *http.Response) (WebAppsGetSwiftVirtualNetworkConnectionSlotResponse, error) { result := WebAppsGetSwiftVirtualNetworkConnectionSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SwiftVirtualNetwork); err != nil { - return WebAppsGetSwiftVirtualNetworkConnectionSlotResponse{}, err + return WebAppsGetSwiftVirtualNetworkConnectionSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -13547,7 +13554,7 @@ func (client *WebAppsClient) getTriggeredWebJobCreateRequest(ctx context.Context func (client *WebAppsClient) getTriggeredWebJobHandleResponse(resp *http.Response) (WebAppsGetTriggeredWebJobResponse, error) { result := WebAppsGetTriggeredWebJobResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TriggeredWebJob); err != nil { - return WebAppsGetTriggeredWebJobResponse{}, err + return WebAppsGetTriggeredWebJobResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -13628,7 +13635,7 @@ func (client *WebAppsClient) getTriggeredWebJobHistoryCreateRequest(ctx context. func (client *WebAppsClient) getTriggeredWebJobHistoryHandleResponse(resp *http.Response) (WebAppsGetTriggeredWebJobHistoryResponse, error) { result := WebAppsGetTriggeredWebJobHistoryResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TriggeredJobHistory); err != nil { - return WebAppsGetTriggeredWebJobHistoryResponse{}, err + return WebAppsGetTriggeredWebJobHistoryResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -13713,7 +13720,7 @@ func (client *WebAppsClient) getTriggeredWebJobHistorySlotCreateRequest(ctx cont func (client *WebAppsClient) getTriggeredWebJobHistorySlotHandleResponse(resp *http.Response) (WebAppsGetTriggeredWebJobHistorySlotResponse, error) { result := WebAppsGetTriggeredWebJobHistorySlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TriggeredJobHistory); err != nil { - return WebAppsGetTriggeredWebJobHistorySlotResponse{}, err + return WebAppsGetTriggeredWebJobHistorySlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -13794,7 +13801,7 @@ func (client *WebAppsClient) getTriggeredWebJobSlotCreateRequest(ctx context.Con func (client *WebAppsClient) getTriggeredWebJobSlotHandleResponse(resp *http.Response) (WebAppsGetTriggeredWebJobSlotResponse, error) { result := WebAppsGetTriggeredWebJobSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TriggeredWebJob); err != nil { - return WebAppsGetTriggeredWebJobSlotResponse{}, err + return WebAppsGetTriggeredWebJobSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -13871,7 +13878,7 @@ func (client *WebAppsClient) getVnetConnectionCreateRequest(ctx context.Context, func (client *WebAppsClient) getVnetConnectionHandleResponse(resp *http.Response) (WebAppsGetVnetConnectionResponse, error) { result := WebAppsGetVnetConnectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetInfoResource); err != nil { - return WebAppsGetVnetConnectionResponse{}, err + return WebAppsGetVnetConnectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -13944,7 +13951,7 @@ func (client *WebAppsClient) getVnetConnectionGatewayCreateRequest(ctx context.C func (client *WebAppsClient) getVnetConnectionGatewayHandleResponse(resp *http.Response) (WebAppsGetVnetConnectionGatewayResponse, error) { result := WebAppsGetVnetConnectionGatewayResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetGateway); err != nil { - return WebAppsGetVnetConnectionGatewayResponse{}, err + return WebAppsGetVnetConnectionGatewayResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -14029,7 +14036,7 @@ func (client *WebAppsClient) getVnetConnectionGatewaySlotCreateRequest(ctx conte func (client *WebAppsClient) getVnetConnectionGatewaySlotHandleResponse(resp *http.Response) (WebAppsGetVnetConnectionGatewaySlotResponse, error) { result := WebAppsGetVnetConnectionGatewaySlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetGateway); err != nil { - return WebAppsGetVnetConnectionGatewaySlotResponse{}, err + return WebAppsGetVnetConnectionGatewaySlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -14110,7 +14117,7 @@ func (client *WebAppsClient) getVnetConnectionSlotCreateRequest(ctx context.Cont func (client *WebAppsClient) getVnetConnectionSlotHandleResponse(resp *http.Response) (WebAppsGetVnetConnectionSlotResponse, error) { result := WebAppsGetVnetConnectionSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetInfoResource); err != nil { - return WebAppsGetVnetConnectionSlotResponse{}, err + return WebAppsGetVnetConnectionSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -14179,7 +14186,7 @@ func (client *WebAppsClient) getWebJobCreateRequest(ctx context.Context, resourc func (client *WebAppsClient) getWebJobHandleResponse(resp *http.Response) (WebAppsGetWebJobResponse, error) { result := WebAppsGetWebJobResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebJob); err != nil { - return WebAppsGetWebJobResponse{}, err + return WebAppsGetWebJobResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -14252,7 +14259,7 @@ func (client *WebAppsClient) getWebJobSlotCreateRequest(ctx context.Context, res func (client *WebAppsClient) getWebJobSlotHandleResponse(resp *http.Response) (WebAppsGetWebJobSlotResponse, error) { result := WebAppsGetWebJobSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebJob); err != nil { - return WebAppsGetWebJobSlotResponse{}, err + return WebAppsGetWebJobSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -14613,7 +14620,7 @@ func (client *WebAppsClient) isCloneableCreateRequest(ctx context.Context, resou func (client *WebAppsClient) isCloneableHandleResponse(resp *http.Response) (WebAppsIsCloneableResponse, error) { result := WebAppsIsCloneableResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteCloneability); err != nil { - return WebAppsIsCloneableResponse{}, err + return WebAppsIsCloneableResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -14682,7 +14689,7 @@ func (client *WebAppsClient) isCloneableSlotCreateRequest(ctx context.Context, r func (client *WebAppsClient) isCloneableSlotHandleResponse(resp *http.Response) (WebAppsIsCloneableSlotResponse, error) { result := WebAppsIsCloneableSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteCloneability); err != nil { - return WebAppsIsCloneableSlotResponse{}, err + return WebAppsIsCloneableSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -14736,7 +14743,7 @@ func (client *WebAppsClient) listCreateRequest(ctx context.Context, options *Web func (client *WebAppsClient) listHandleResponse(resp *http.Response) (WebAppsListResponse, error) { result := WebAppsListResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebAppCollection); err != nil { - return WebAppsListResponse{}, err + return WebAppsListResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -14801,7 +14808,7 @@ func (client *WebAppsClient) listApplicationSettingsCreateRequest(ctx context.Co func (client *WebAppsClient) listApplicationSettingsHandleResponse(resp *http.Response) (WebAppsListApplicationSettingsResponse, error) { result := WebAppsListApplicationSettingsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil { - return WebAppsListApplicationSettingsResponse{}, err + return WebAppsListApplicationSettingsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -14870,7 +14877,7 @@ func (client *WebAppsClient) listApplicationSettingsSlotCreateRequest(ctx contex func (client *WebAppsClient) listApplicationSettingsSlotHandleResponse(resp *http.Response) (WebAppsListApplicationSettingsSlotResponse, error) { result := WebAppsListApplicationSettingsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil { - return WebAppsListApplicationSettingsSlotResponse{}, err + return WebAppsListApplicationSettingsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -14935,7 +14942,7 @@ func (client *WebAppsClient) listAzureStorageAccountsCreateRequest(ctx context.C func (client *WebAppsClient) listAzureStorageAccountsHandleResponse(resp *http.Response) (WebAppsListAzureStorageAccountsResponse, error) { result := WebAppsListAzureStorageAccountsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AzureStoragePropertyDictionaryResource); err != nil { - return WebAppsListAzureStorageAccountsResponse{}, err + return WebAppsListAzureStorageAccountsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -15004,7 +15011,7 @@ func (client *WebAppsClient) listAzureStorageAccountsSlotCreateRequest(ctx conte func (client *WebAppsClient) listAzureStorageAccountsSlotHandleResponse(resp *http.Response) (WebAppsListAzureStorageAccountsSlotResponse, error) { result := WebAppsListAzureStorageAccountsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AzureStoragePropertyDictionaryResource); err != nil { - return WebAppsListAzureStorageAccountsSlotResponse{}, err + return WebAppsListAzureStorageAccountsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -15075,7 +15082,7 @@ func (client *WebAppsClient) listBackupStatusSecretsCreateRequest(ctx context.Co func (client *WebAppsClient) listBackupStatusSecretsHandleResponse(resp *http.Response) (WebAppsListBackupStatusSecretsResponse, error) { result := WebAppsListBackupStatusSecretsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BackupItem); err != nil { - return WebAppsListBackupStatusSecretsResponse{}, err + return WebAppsListBackupStatusSecretsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -15150,7 +15157,7 @@ func (client *WebAppsClient) listBackupStatusSecretsSlotCreateRequest(ctx contex func (client *WebAppsClient) listBackupStatusSecretsSlotHandleResponse(resp *http.Response) (WebAppsListBackupStatusSecretsSlotResponse, error) { result := WebAppsListBackupStatusSecretsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BackupItem); err != nil { - return WebAppsListBackupStatusSecretsSlotResponse{}, err + return WebAppsListBackupStatusSecretsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -15212,7 +15219,7 @@ func (client *WebAppsClient) listBackupsCreateRequest(ctx context.Context, resou func (client *WebAppsClient) listBackupsHandleResponse(resp *http.Response) (WebAppsListBackupsResponse, error) { result := WebAppsListBackupsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BackupItemCollection); err != nil { - return WebAppsListBackupsResponse{}, err + return WebAppsListBackupsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -15278,7 +15285,7 @@ func (client *WebAppsClient) listBackupsSlotCreateRequest(ctx context.Context, r func (client *WebAppsClient) listBackupsSlotHandleResponse(resp *http.Response) (WebAppsListBackupsSlotResponse, error) { result := WebAppsListBackupsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BackupItemCollection); err != nil { - return WebAppsListBackupsSlotResponse{}, err + return WebAppsListBackupsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -15340,7 +15347,7 @@ func (client *WebAppsClient) listBasicPublishingCredentialsPoliciesCreateRequest func (client *WebAppsClient) listBasicPublishingCredentialsPoliciesHandleResponse(resp *http.Response) (WebAppsListBasicPublishingCredentialsPoliciesResponse, error) { result := WebAppsListBasicPublishingCredentialsPoliciesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublishingCredentialsPoliciesCollection); err != nil { - return WebAppsListBasicPublishingCredentialsPoliciesResponse{}, err + return WebAppsListBasicPublishingCredentialsPoliciesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -15406,7 +15413,7 @@ func (client *WebAppsClient) listBasicPublishingCredentialsPoliciesSlotCreateReq func (client *WebAppsClient) listBasicPublishingCredentialsPoliciesSlotHandleResponse(resp *http.Response) (WebAppsListBasicPublishingCredentialsPoliciesSlotResponse, error) { result := WebAppsListBasicPublishingCredentialsPoliciesSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublishingCredentialsPoliciesCollection); err != nil { - return WebAppsListBasicPublishingCredentialsPoliciesSlotResponse{}, err + return WebAppsListBasicPublishingCredentialsPoliciesSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -15467,7 +15474,7 @@ func (client *WebAppsClient) listByResourceGroupCreateRequest(ctx context.Contex func (client *WebAppsClient) listByResourceGroupHandleResponse(resp *http.Response) (WebAppsListByResourceGroupResponse, error) { result := WebAppsListByResourceGroupResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebAppCollection); err != nil { - return WebAppsListByResourceGroupResponse{}, err + return WebAppsListByResourceGroupResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -15530,7 +15537,7 @@ func (client *WebAppsClient) listConfigurationSnapshotInfoCreateRequest(ctx cont func (client *WebAppsClient) listConfigurationSnapshotInfoHandleResponse(resp *http.Response) (WebAppsListConfigurationSnapshotInfoResponse, error) { result := WebAppsListConfigurationSnapshotInfoResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigurationSnapshotInfoCollection); err != nil { - return WebAppsListConfigurationSnapshotInfoResponse{}, err + return WebAppsListConfigurationSnapshotInfoResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -15597,7 +15604,7 @@ func (client *WebAppsClient) listConfigurationSnapshotInfoSlotCreateRequest(ctx func (client *WebAppsClient) listConfigurationSnapshotInfoSlotHandleResponse(resp *http.Response) (WebAppsListConfigurationSnapshotInfoSlotResponse, error) { result := WebAppsListConfigurationSnapshotInfoSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigurationSnapshotInfoCollection); err != nil { - return WebAppsListConfigurationSnapshotInfoSlotResponse{}, err + return WebAppsListConfigurationSnapshotInfoSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -15659,7 +15666,7 @@ func (client *WebAppsClient) listConfigurationsCreateRequest(ctx context.Context func (client *WebAppsClient) listConfigurationsHandleResponse(resp *http.Response) (WebAppsListConfigurationsResponse, error) { result := WebAppsListConfigurationsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResourceCollection); err != nil { - return WebAppsListConfigurationsResponse{}, err + return WebAppsListConfigurationsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -15725,7 +15732,7 @@ func (client *WebAppsClient) listConfigurationsSlotCreateRequest(ctx context.Con func (client *WebAppsClient) listConfigurationsSlotHandleResponse(resp *http.Response) (WebAppsListConfigurationsSlotResponse, error) { result := WebAppsListConfigurationsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResourceCollection); err != nil { - return WebAppsListConfigurationsSlotResponse{}, err + return WebAppsListConfigurationsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -15790,7 +15797,7 @@ func (client *WebAppsClient) listConnectionStringsCreateRequest(ctx context.Cont func (client *WebAppsClient) listConnectionStringsHandleResponse(resp *http.Response) (WebAppsListConnectionStringsResponse, error) { result := WebAppsListConnectionStringsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionStringDictionary); err != nil { - return WebAppsListConnectionStringsResponse{}, err + return WebAppsListConnectionStringsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -15859,7 +15866,7 @@ func (client *WebAppsClient) listConnectionStringsSlotCreateRequest(ctx context. func (client *WebAppsClient) listConnectionStringsSlotHandleResponse(resp *http.Response) (WebAppsListConnectionStringsSlotResponse, error) { result := WebAppsListConnectionStringsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionStringDictionary); err != nil { - return WebAppsListConnectionStringsSlotResponse{}, err + return WebAppsListConnectionStringsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -15921,7 +15928,7 @@ func (client *WebAppsClient) listContinuousWebJobsCreateRequest(ctx context.Cont func (client *WebAppsClient) listContinuousWebJobsHandleResponse(resp *http.Response) (WebAppsListContinuousWebJobsResponse, error) { result := WebAppsListContinuousWebJobsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ContinuousWebJobCollection); err != nil { - return WebAppsListContinuousWebJobsResponse{}, err + return WebAppsListContinuousWebJobsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -15987,7 +15994,7 @@ func (client *WebAppsClient) listContinuousWebJobsSlotCreateRequest(ctx context. func (client *WebAppsClient) listContinuousWebJobsSlotHandleResponse(resp *http.Response) (WebAppsListContinuousWebJobsSlotResponse, error) { result := WebAppsListContinuousWebJobsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ContinuousWebJobCollection); err != nil { - return WebAppsListContinuousWebJobsSlotResponse{}, err + return WebAppsListContinuousWebJobsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -16056,7 +16063,7 @@ func (client *WebAppsClient) listDeploymentLogCreateRequest(ctx context.Context, func (client *WebAppsClient) listDeploymentLogHandleResponse(resp *http.Response) (WebAppsListDeploymentLogResponse, error) { result := WebAppsListDeploymentLogResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Deployment); err != nil { - return WebAppsListDeploymentLogResponse{}, err + return WebAppsListDeploymentLogResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -16129,7 +16136,7 @@ func (client *WebAppsClient) listDeploymentLogSlotCreateRequest(ctx context.Cont func (client *WebAppsClient) listDeploymentLogSlotHandleResponse(resp *http.Response) (WebAppsListDeploymentLogSlotResponse, error) { result := WebAppsListDeploymentLogSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Deployment); err != nil { - return WebAppsListDeploymentLogSlotResponse{}, err + return WebAppsListDeploymentLogSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -16191,7 +16198,7 @@ func (client *WebAppsClient) listDeploymentsCreateRequest(ctx context.Context, r func (client *WebAppsClient) listDeploymentsHandleResponse(resp *http.Response) (WebAppsListDeploymentsResponse, error) { result := WebAppsListDeploymentsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentCollection); err != nil { - return WebAppsListDeploymentsResponse{}, err + return WebAppsListDeploymentsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -16257,7 +16264,7 @@ func (client *WebAppsClient) listDeploymentsSlotCreateRequest(ctx context.Contex func (client *WebAppsClient) listDeploymentsSlotHandleResponse(resp *http.Response) (WebAppsListDeploymentsSlotResponse, error) { result := WebAppsListDeploymentsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentCollection); err != nil { - return WebAppsListDeploymentsSlotResponse{}, err + return WebAppsListDeploymentsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -16319,7 +16326,7 @@ func (client *WebAppsClient) listDomainOwnershipIdentifiersCreateRequest(ctx con func (client *WebAppsClient) listDomainOwnershipIdentifiersHandleResponse(resp *http.Response) (WebAppsListDomainOwnershipIdentifiersResponse, error) { result := WebAppsListDomainOwnershipIdentifiersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IdentifierCollection); err != nil { - return WebAppsListDomainOwnershipIdentifiersResponse{}, err + return WebAppsListDomainOwnershipIdentifiersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -16385,7 +16392,7 @@ func (client *WebAppsClient) listDomainOwnershipIdentifiersSlotCreateRequest(ctx func (client *WebAppsClient) listDomainOwnershipIdentifiersSlotHandleResponse(resp *http.Response) (WebAppsListDomainOwnershipIdentifiersSlotResponse, error) { result := WebAppsListDomainOwnershipIdentifiersSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IdentifierCollection); err != nil { - return WebAppsListDomainOwnershipIdentifiersSlotResponse{}, err + return WebAppsListDomainOwnershipIdentifiersSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -16454,7 +16461,7 @@ func (client *WebAppsClient) listFunctionKeysCreateRequest(ctx context.Context, func (client *WebAppsClient) listFunctionKeysHandleResponse(resp *http.Response) (WebAppsListFunctionKeysResponse, error) { result := WebAppsListFunctionKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil { - return WebAppsListFunctionKeysResponse{}, err + return WebAppsListFunctionKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -16527,7 +16534,7 @@ func (client *WebAppsClient) listFunctionKeysSlotCreateRequest(ctx context.Conte func (client *WebAppsClient) listFunctionKeysSlotHandleResponse(resp *http.Response) (WebAppsListFunctionKeysSlotResponse, error) { result := WebAppsListFunctionKeysSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil { - return WebAppsListFunctionKeysSlotResponse{}, err + return WebAppsListFunctionKeysSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -16596,7 +16603,7 @@ func (client *WebAppsClient) listFunctionSecretsCreateRequest(ctx context.Contex func (client *WebAppsClient) listFunctionSecretsHandleResponse(resp *http.Response) (WebAppsListFunctionSecretsResponse, error) { result := WebAppsListFunctionSecretsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FunctionSecrets); err != nil { - return WebAppsListFunctionSecretsResponse{}, err + return WebAppsListFunctionSecretsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -16669,7 +16676,7 @@ func (client *WebAppsClient) listFunctionSecretsSlotCreateRequest(ctx context.Co func (client *WebAppsClient) listFunctionSecretsSlotHandleResponse(resp *http.Response) (WebAppsListFunctionSecretsSlotResponse, error) { result := WebAppsListFunctionSecretsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FunctionSecrets); err != nil { - return WebAppsListFunctionSecretsSlotResponse{}, err + return WebAppsListFunctionSecretsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -16731,7 +16738,7 @@ func (client *WebAppsClient) listFunctionsCreateRequest(ctx context.Context, res func (client *WebAppsClient) listFunctionsHandleResponse(resp *http.Response) (WebAppsListFunctionsResponse, error) { result := WebAppsListFunctionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FunctionEnvelopeCollection); err != nil { - return WebAppsListFunctionsResponse{}, err + return WebAppsListFunctionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -16804,7 +16811,7 @@ func (client *WebAppsClient) listHostKeysCreateRequest(ctx context.Context, reso func (client *WebAppsClient) listHostKeysHandleResponse(resp *http.Response) (WebAppsListHostKeysResponse, error) { result := WebAppsListHostKeysResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HostKeys); err != nil { - return WebAppsListHostKeysResponse{}, err + return WebAppsListHostKeysResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -16873,7 +16880,7 @@ func (client *WebAppsClient) listHostKeysSlotCreateRequest(ctx context.Context, func (client *WebAppsClient) listHostKeysSlotHandleResponse(resp *http.Response) (WebAppsListHostKeysSlotResponse, error) { result := WebAppsListHostKeysSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HostKeys); err != nil { - return WebAppsListHostKeysSlotResponse{}, err + return WebAppsListHostKeysSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -16935,7 +16942,7 @@ func (client *WebAppsClient) listHostNameBindingsCreateRequest(ctx context.Conte func (client *WebAppsClient) listHostNameBindingsHandleResponse(resp *http.Response) (WebAppsListHostNameBindingsResponse, error) { result := WebAppsListHostNameBindingsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HostNameBindingCollection); err != nil { - return WebAppsListHostNameBindingsResponse{}, err + return WebAppsListHostNameBindingsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -17001,7 +17008,7 @@ func (client *WebAppsClient) listHostNameBindingsSlotCreateRequest(ctx context.C func (client *WebAppsClient) listHostNameBindingsSlotHandleResponse(resp *http.Response) (WebAppsListHostNameBindingsSlotResponse, error) { result := WebAppsListHostNameBindingsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HostNameBindingCollection); err != nil { - return WebAppsListHostNameBindingsSlotResponse{}, err + return WebAppsListHostNameBindingsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -17066,7 +17073,7 @@ func (client *WebAppsClient) listHybridConnectionsCreateRequest(ctx context.Cont func (client *WebAppsClient) listHybridConnectionsHandleResponse(resp *http.Response) (WebAppsListHybridConnectionsResponse, error) { result := WebAppsListHybridConnectionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridConnection); err != nil { - return WebAppsListHybridConnectionsResponse{}, err + return WebAppsListHybridConnectionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -17135,7 +17142,7 @@ func (client *WebAppsClient) listHybridConnectionsSlotCreateRequest(ctx context. func (client *WebAppsClient) listHybridConnectionsSlotHandleResponse(resp *http.Response) (WebAppsListHybridConnectionsSlotResponse, error) { result := WebAppsListHybridConnectionsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridConnection); err != nil { - return WebAppsListHybridConnectionsSlotResponse{}, err + return WebAppsListHybridConnectionsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -17201,7 +17208,7 @@ func (client *WebAppsClient) listInstanceFunctionsSlotCreateRequest(ctx context. func (client *WebAppsClient) listInstanceFunctionsSlotHandleResponse(resp *http.Response) (WebAppsListInstanceFunctionsSlotResponse, error) { result := WebAppsListInstanceFunctionsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FunctionEnvelopeCollection); err != nil { - return WebAppsListInstanceFunctionsSlotResponse{}, err + return WebAppsListInstanceFunctionsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -17271,7 +17278,7 @@ func (client *WebAppsClient) listInstanceIdentifiersCreateRequest(ctx context.Co func (client *WebAppsClient) listInstanceIdentifiersHandleResponse(resp *http.Response) (WebAppsListInstanceIdentifiersResponse, error) { result := WebAppsListInstanceIdentifiersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebAppInstanceStatusCollection); err != nil { - return WebAppsListInstanceIdentifiersResponse{}, err + return WebAppsListInstanceIdentifiersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -17337,7 +17344,7 @@ func (client *WebAppsClient) listInstanceIdentifiersSlotCreateRequest(ctx contex func (client *WebAppsClient) listInstanceIdentifiersSlotHandleResponse(resp *http.Response) (WebAppsListInstanceIdentifiersSlotResponse, error) { result := WebAppsListInstanceIdentifiersSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebAppInstanceStatusCollection); err != nil { - return WebAppsListInstanceIdentifiersSlotResponse{}, err + return WebAppsListInstanceIdentifiersSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -17407,7 +17414,7 @@ func (client *WebAppsClient) listInstanceProcessModulesCreateRequest(ctx context func (client *WebAppsClient) listInstanceProcessModulesHandleResponse(resp *http.Response) (WebAppsListInstanceProcessModulesResponse, error) { result := WebAppsListInstanceProcessModulesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessModuleInfoCollection); err != nil { - return WebAppsListInstanceProcessModulesResponse{}, err + return WebAppsListInstanceProcessModulesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -17489,7 +17496,7 @@ func (client *WebAppsClient) listInstanceProcessModulesSlotCreateRequest(ctx con func (client *WebAppsClient) listInstanceProcessModulesSlotHandleResponse(resp *http.Response) (WebAppsListInstanceProcessModulesSlotResponse, error) { result := WebAppsListInstanceProcessModulesSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessModuleInfoCollection); err != nil { - return WebAppsListInstanceProcessModulesSlotResponse{}, err + return WebAppsListInstanceProcessModulesSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -17567,7 +17574,7 @@ func (client *WebAppsClient) listInstanceProcessThreadsCreateRequest(ctx context func (client *WebAppsClient) listInstanceProcessThreadsHandleResponse(resp *http.Response) (WebAppsListInstanceProcessThreadsResponse, error) { result := WebAppsListInstanceProcessThreadsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessThreadInfoCollection); err != nil { - return WebAppsListInstanceProcessThreadsResponse{}, err + return WebAppsListInstanceProcessThreadsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -17649,7 +17656,7 @@ func (client *WebAppsClient) listInstanceProcessThreadsSlotCreateRequest(ctx con func (client *WebAppsClient) listInstanceProcessThreadsSlotHandleResponse(resp *http.Response) (WebAppsListInstanceProcessThreadsSlotResponse, error) { result := WebAppsListInstanceProcessThreadsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessThreadInfoCollection); err != nil { - return WebAppsListInstanceProcessThreadsSlotResponse{}, err + return WebAppsListInstanceProcessThreadsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -17723,7 +17730,7 @@ func (client *WebAppsClient) listInstanceProcessesCreateRequest(ctx context.Cont func (client *WebAppsClient) listInstanceProcessesHandleResponse(resp *http.Response) (WebAppsListInstanceProcessesResponse, error) { result := WebAppsListInstanceProcessesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessInfoCollection); err != nil { - return WebAppsListInstanceProcessesResponse{}, err + return WebAppsListInstanceProcessesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -17802,7 +17809,7 @@ func (client *WebAppsClient) listInstanceProcessesSlotCreateRequest(ctx context. func (client *WebAppsClient) listInstanceProcessesSlotHandleResponse(resp *http.Response) (WebAppsListInstanceProcessesSlotResponse, error) { result := WebAppsListInstanceProcessesSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessInfoCollection); err != nil { - return WebAppsListInstanceProcessesSlotResponse{}, err + return WebAppsListInstanceProcessesSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -17875,7 +17882,7 @@ func (client *WebAppsClient) listMetadataCreateRequest(ctx context.Context, reso func (client *WebAppsClient) listMetadataHandleResponse(resp *http.Response) (WebAppsListMetadataResponse, error) { result := WebAppsListMetadataResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil { - return WebAppsListMetadataResponse{}, err + return WebAppsListMetadataResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -17944,7 +17951,7 @@ func (client *WebAppsClient) listMetadataSlotCreateRequest(ctx context.Context, func (client *WebAppsClient) listMetadataSlotHandleResponse(resp *http.Response) (WebAppsListMetadataSlotResponse, error) { result := WebAppsListMetadataSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil { - return WebAppsListMetadataSlotResponse{}, err + return WebAppsListMetadataSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -18013,7 +18020,7 @@ func (client *WebAppsClient) listNetworkFeaturesCreateRequest(ctx context.Contex func (client *WebAppsClient) listNetworkFeaturesHandleResponse(resp *http.Response) (WebAppsListNetworkFeaturesResponse, error) { result := WebAppsListNetworkFeaturesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkFeatures); err != nil { - return WebAppsListNetworkFeaturesResponse{}, err + return WebAppsListNetworkFeaturesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -18094,7 +18101,7 @@ func (client *WebAppsClient) listNetworkFeaturesSlotCreateRequest(ctx context.Co func (client *WebAppsClient) listNetworkFeaturesSlotHandleResponse(resp *http.Response) (WebAppsListNetworkFeaturesSlotResponse, error) { result := WebAppsListNetworkFeaturesSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.NetworkFeatures); err != nil { - return WebAppsListNetworkFeaturesSlotResponse{}, err + return WebAppsListNetworkFeaturesSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -18169,7 +18176,7 @@ func (client *WebAppsClient) listPerfMonCountersCreateRequest(ctx context.Contex func (client *WebAppsClient) listPerfMonCountersHandleResponse(resp *http.Response) (WebAppsListPerfMonCountersResponse, error) { result := WebAppsListPerfMonCountersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PerfMonCounterCollection); err != nil { - return WebAppsListPerfMonCountersResponse{}, err + return WebAppsListPerfMonCountersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -18240,7 +18247,7 @@ func (client *WebAppsClient) listPerfMonCountersSlotCreateRequest(ctx context.Co func (client *WebAppsClient) listPerfMonCountersSlotHandleResponse(resp *http.Response) (WebAppsListPerfMonCountersSlotResponse, error) { result := WebAppsListPerfMonCountersSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PerfMonCounterCollection); err != nil { - return WebAppsListPerfMonCountersSlotResponse{}, err + return WebAppsListPerfMonCountersSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -18305,7 +18312,7 @@ func (client *WebAppsClient) listPremierAddOnsCreateRequest(ctx context.Context, func (client *WebAppsClient) listPremierAddOnsHandleResponse(resp *http.Response) (WebAppsListPremierAddOnsResponse, error) { result := WebAppsListPremierAddOnsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PremierAddOn); err != nil { - return WebAppsListPremierAddOnsResponse{}, err + return WebAppsListPremierAddOnsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -18374,7 +18381,7 @@ func (client *WebAppsClient) listPremierAddOnsSlotCreateRequest(ctx context.Cont func (client *WebAppsClient) listPremierAddOnsSlotHandleResponse(resp *http.Response) (WebAppsListPremierAddOnsSlotResponse, error) { result := WebAppsListPremierAddOnsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PremierAddOn); err != nil { - return WebAppsListPremierAddOnsSlotResponse{}, err + return WebAppsListPremierAddOnsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -18440,7 +18447,7 @@ func (client *WebAppsClient) listProcessModulesCreateRequest(ctx context.Context func (client *WebAppsClient) listProcessModulesHandleResponse(resp *http.Response) (WebAppsListProcessModulesResponse, error) { result := WebAppsListProcessModulesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessModuleInfoCollection); err != nil { - return WebAppsListProcessModulesResponse{}, err + return WebAppsListProcessModulesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -18518,7 +18525,7 @@ func (client *WebAppsClient) listProcessModulesSlotCreateRequest(ctx context.Con func (client *WebAppsClient) listProcessModulesSlotHandleResponse(resp *http.Response) (WebAppsListProcessModulesSlotResponse, error) { result := WebAppsListProcessModulesSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessModuleInfoCollection); err != nil { - return WebAppsListProcessModulesSlotResponse{}, err + return WebAppsListProcessModulesSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -18592,7 +18599,7 @@ func (client *WebAppsClient) listProcessThreadsCreateRequest(ctx context.Context func (client *WebAppsClient) listProcessThreadsHandleResponse(resp *http.Response) (WebAppsListProcessThreadsResponse, error) { result := WebAppsListProcessThreadsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessThreadInfoCollection); err != nil { - return WebAppsListProcessThreadsResponse{}, err + return WebAppsListProcessThreadsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -18670,7 +18677,7 @@ func (client *WebAppsClient) listProcessThreadsSlotCreateRequest(ctx context.Con func (client *WebAppsClient) listProcessThreadsSlotHandleResponse(resp *http.Response) (WebAppsListProcessThreadsSlotResponse, error) { result := WebAppsListProcessThreadsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessThreadInfoCollection); err != nil { - return WebAppsListProcessThreadsSlotResponse{}, err + return WebAppsListProcessThreadsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -18740,7 +18747,7 @@ func (client *WebAppsClient) listProcessesCreateRequest(ctx context.Context, res func (client *WebAppsClient) listProcessesHandleResponse(resp *http.Response) (WebAppsListProcessesResponse, error) { result := WebAppsListProcessesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessInfoCollection); err != nil { - return WebAppsListProcessesResponse{}, err + return WebAppsListProcessesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -18814,7 +18821,7 @@ func (client *WebAppsClient) listProcessesSlotCreateRequest(ctx context.Context, func (client *WebAppsClient) listProcessesSlotHandleResponse(resp *http.Response) (WebAppsListProcessesSlotResponse, error) { result := WebAppsListProcessesSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ProcessInfoCollection); err != nil { - return WebAppsListProcessesSlotResponse{}, err + return WebAppsListProcessesSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -18884,7 +18891,7 @@ func (client *WebAppsClient) listPublicCertificatesCreateRequest(ctx context.Con func (client *WebAppsClient) listPublicCertificatesHandleResponse(resp *http.Response) (WebAppsListPublicCertificatesResponse, error) { result := WebAppsListPublicCertificatesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicCertificateCollection); err != nil { - return WebAppsListPublicCertificatesResponse{}, err + return WebAppsListPublicCertificatesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -18950,7 +18957,7 @@ func (client *WebAppsClient) listPublicCertificatesSlotCreateRequest(ctx context func (client *WebAppsClient) listPublicCertificatesSlotHandleResponse(resp *http.Response) (WebAppsListPublicCertificatesSlotResponse, error) { result := WebAppsListPublicCertificatesSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PublicCertificateCollection); err != nil { - return WebAppsListPublicCertificatesSlotResponse{}, err + return WebAppsListPublicCertificatesSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -19289,7 +19296,7 @@ func (client *WebAppsClient) listRelayServiceConnectionsCreateRequest(ctx contex func (client *WebAppsClient) listRelayServiceConnectionsHandleResponse(resp *http.Response) (WebAppsListRelayServiceConnectionsResponse, error) { result := WebAppsListRelayServiceConnectionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RelayServiceConnectionEntity); err != nil { - return WebAppsListRelayServiceConnectionsResponse{}, err + return WebAppsListRelayServiceConnectionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -19358,7 +19365,7 @@ func (client *WebAppsClient) listRelayServiceConnectionsSlotCreateRequest(ctx co func (client *WebAppsClient) listRelayServiceConnectionsSlotHandleResponse(resp *http.Response) (WebAppsListRelayServiceConnectionsSlotResponse, error) { result := WebAppsListRelayServiceConnectionsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RelayServiceConnectionEntity); err != nil { - return WebAppsListRelayServiceConnectionsSlotResponse{}, err + return WebAppsListRelayServiceConnectionsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -19420,7 +19427,7 @@ func (client *WebAppsClient) listSiteBackupsCreateRequest(ctx context.Context, r func (client *WebAppsClient) listSiteBackupsHandleResponse(resp *http.Response) (WebAppsListSiteBackupsResponse, error) { result := WebAppsListSiteBackupsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BackupItemCollection); err != nil { - return WebAppsListSiteBackupsResponse{}, err + return WebAppsListSiteBackupsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -19486,7 +19493,7 @@ func (client *WebAppsClient) listSiteBackupsSlotCreateRequest(ctx context.Contex func (client *WebAppsClient) listSiteBackupsSlotHandleResponse(resp *http.Response) (WebAppsListSiteBackupsSlotResponse, error) { result := WebAppsListSiteBackupsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BackupItemCollection); err != nil { - return WebAppsListSiteBackupsSlotResponse{}, err + return WebAppsListSiteBackupsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -19548,7 +19555,7 @@ func (client *WebAppsClient) listSiteExtensionsCreateRequest(ctx context.Context func (client *WebAppsClient) listSiteExtensionsHandleResponse(resp *http.Response) (WebAppsListSiteExtensionsResponse, error) { result := WebAppsListSiteExtensionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteExtensionInfoCollection); err != nil { - return WebAppsListSiteExtensionsResponse{}, err + return WebAppsListSiteExtensionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -19622,7 +19629,7 @@ func (client *WebAppsClient) listSiteExtensionsSlotCreateRequest(ctx context.Con func (client *WebAppsClient) listSiteExtensionsSlotHandleResponse(resp *http.Response) (WebAppsListSiteExtensionsSlotResponse, error) { result := WebAppsListSiteExtensionsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteExtensionInfoCollection); err != nil { - return WebAppsListSiteExtensionsSlotResponse{}, err + return WebAppsListSiteExtensionsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -19695,7 +19702,7 @@ func (client *WebAppsClient) listSitePushSettingsCreateRequest(ctx context.Conte func (client *WebAppsClient) listSitePushSettingsHandleResponse(resp *http.Response) (WebAppsListSitePushSettingsResponse, error) { result := WebAppsListSitePushSettingsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PushSettings); err != nil { - return WebAppsListSitePushSettingsResponse{}, err + return WebAppsListSitePushSettingsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -19764,7 +19771,7 @@ func (client *WebAppsClient) listSitePushSettingsSlotCreateRequest(ctx context.C func (client *WebAppsClient) listSitePushSettingsSlotHandleResponse(resp *http.Response) (WebAppsListSitePushSettingsSlotResponse, error) { result := WebAppsListSitePushSettingsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PushSettings); err != nil { - return WebAppsListSitePushSettingsSlotResponse{}, err + return WebAppsListSitePushSettingsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -19829,7 +19836,7 @@ func (client *WebAppsClient) listSlotConfigurationNamesCreateRequest(ctx context func (client *WebAppsClient) listSlotConfigurationNamesHandleResponse(resp *http.Response) (WebAppsListSlotConfigurationNamesResponse, error) { result := WebAppsListSlotConfigurationNamesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SlotConfigNamesResource); err != nil { - return WebAppsListSlotConfigurationNamesResponse{}, err + return WebAppsListSlotConfigurationNamesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -19891,7 +19898,7 @@ func (client *WebAppsClient) listSlotDifferencesFromProductionCreateRequest(ctx func (client *WebAppsClient) listSlotDifferencesFromProductionHandleResponse(resp *http.Response) (WebAppsListSlotDifferencesFromProductionResponse, error) { result := WebAppsListSlotDifferencesFromProductionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SlotDifferenceCollection); err != nil { - return WebAppsListSlotDifferencesFromProductionResponse{}, err + return WebAppsListSlotDifferencesFromProductionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -19957,7 +19964,7 @@ func (client *WebAppsClient) listSlotDifferencesSlotCreateRequest(ctx context.Co func (client *WebAppsClient) listSlotDifferencesSlotHandleResponse(resp *http.Response) (WebAppsListSlotDifferencesSlotResponse, error) { result := WebAppsListSlotDifferencesSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SlotDifferenceCollection); err != nil { - return WebAppsListSlotDifferencesSlotResponse{}, err + return WebAppsListSlotDifferencesSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -20019,7 +20026,7 @@ func (client *WebAppsClient) listSlotsCreateRequest(ctx context.Context, resourc func (client *WebAppsClient) listSlotsHandleResponse(resp *http.Response) (WebAppsListSlotsResponse, error) { result := WebAppsListSlotsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebAppCollection); err != nil { - return WebAppsListSlotsResponse{}, err + return WebAppsListSlotsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -20081,7 +20088,7 @@ func (client *WebAppsClient) listSnapshotsCreateRequest(ctx context.Context, res func (client *WebAppsClient) listSnapshotsHandleResponse(resp *http.Response) (WebAppsListSnapshotsResponse, error) { result := WebAppsListSnapshotsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotCollection); err != nil { - return WebAppsListSnapshotsResponse{}, err + return WebAppsListSnapshotsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -20143,7 +20150,7 @@ func (client *WebAppsClient) listSnapshotsFromDRSecondaryCreateRequest(ctx conte func (client *WebAppsClient) listSnapshotsFromDRSecondaryHandleResponse(resp *http.Response) (WebAppsListSnapshotsFromDRSecondaryResponse, error) { result := WebAppsListSnapshotsFromDRSecondaryResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotCollection); err != nil { - return WebAppsListSnapshotsFromDRSecondaryResponse{}, err + return WebAppsListSnapshotsFromDRSecondaryResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -20209,7 +20216,7 @@ func (client *WebAppsClient) listSnapshotsFromDRSecondarySlotCreateRequest(ctx c func (client *WebAppsClient) listSnapshotsFromDRSecondarySlotHandleResponse(resp *http.Response) (WebAppsListSnapshotsFromDRSecondarySlotResponse, error) { result := WebAppsListSnapshotsFromDRSecondarySlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotCollection); err != nil { - return WebAppsListSnapshotsFromDRSecondarySlotResponse{}, err + return WebAppsListSnapshotsFromDRSecondarySlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -20275,7 +20282,7 @@ func (client *WebAppsClient) listSnapshotsSlotCreateRequest(ctx context.Context, func (client *WebAppsClient) listSnapshotsSlotHandleResponse(resp *http.Response) (WebAppsListSnapshotsSlotResponse, error) { result := WebAppsListSnapshotsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SnapshotCollection); err != nil { - return WebAppsListSnapshotsSlotResponse{}, err + return WebAppsListSnapshotsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -20340,7 +20347,7 @@ func (client *WebAppsClient) listSyncFunctionTriggersCreateRequest(ctx context.C func (client *WebAppsClient) listSyncFunctionTriggersHandleResponse(resp *http.Response) (WebAppsListSyncFunctionTriggersResponse, error) { result := WebAppsListSyncFunctionTriggersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FunctionSecrets); err != nil { - return WebAppsListSyncFunctionTriggersResponse{}, err + return WebAppsListSyncFunctionTriggersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -20409,7 +20416,7 @@ func (client *WebAppsClient) listSyncFunctionTriggersSlotCreateRequest(ctx conte func (client *WebAppsClient) listSyncFunctionTriggersSlotHandleResponse(resp *http.Response) (WebAppsListSyncFunctionTriggersSlotResponse, error) { result := WebAppsListSyncFunctionTriggersSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.FunctionSecrets); err != nil { - return WebAppsListSyncFunctionTriggersSlotResponse{}, err + return WebAppsListSyncFunctionTriggersSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -20591,7 +20598,7 @@ func (client *WebAppsClient) listTriggeredWebJobHistoryCreateRequest(ctx context func (client *WebAppsClient) listTriggeredWebJobHistoryHandleResponse(resp *http.Response) (WebAppsListTriggeredWebJobHistoryResponse, error) { result := WebAppsListTriggeredWebJobHistoryResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TriggeredJobHistoryCollection); err != nil { - return WebAppsListTriggeredWebJobHistoryResponse{}, err + return WebAppsListTriggeredWebJobHistoryResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -20669,7 +20676,7 @@ func (client *WebAppsClient) listTriggeredWebJobHistorySlotCreateRequest(ctx con func (client *WebAppsClient) listTriggeredWebJobHistorySlotHandleResponse(resp *http.Response) (WebAppsListTriggeredWebJobHistorySlotResponse, error) { result := WebAppsListTriggeredWebJobHistorySlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TriggeredJobHistoryCollection); err != nil { - return WebAppsListTriggeredWebJobHistorySlotResponse{}, err + return WebAppsListTriggeredWebJobHistorySlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -20739,7 +20746,7 @@ func (client *WebAppsClient) listTriggeredWebJobsCreateRequest(ctx context.Conte func (client *WebAppsClient) listTriggeredWebJobsHandleResponse(resp *http.Response) (WebAppsListTriggeredWebJobsResponse, error) { result := WebAppsListTriggeredWebJobsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TriggeredWebJobCollection); err != nil { - return WebAppsListTriggeredWebJobsResponse{}, err + return WebAppsListTriggeredWebJobsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -20805,7 +20812,7 @@ func (client *WebAppsClient) listTriggeredWebJobsSlotCreateRequest(ctx context.C func (client *WebAppsClient) listTriggeredWebJobsSlotHandleResponse(resp *http.Response) (WebAppsListTriggeredWebJobsSlotResponse, error) { result := WebAppsListTriggeredWebJobsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.TriggeredWebJobCollection); err != nil { - return WebAppsListTriggeredWebJobsSlotResponse{}, err + return WebAppsListTriggeredWebJobsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -20872,7 +20879,7 @@ func (client *WebAppsClient) listUsagesCreateRequest(ctx context.Context, resour func (client *WebAppsClient) listUsagesHandleResponse(resp *http.Response) (WebAppsListUsagesResponse, error) { result := WebAppsListUsagesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CsmUsageQuotaCollection); err != nil { - return WebAppsListUsagesResponse{}, err + return WebAppsListUsagesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -20943,7 +20950,7 @@ func (client *WebAppsClient) listUsagesSlotCreateRequest(ctx context.Context, re func (client *WebAppsClient) listUsagesSlotHandleResponse(resp *http.Response) (WebAppsListUsagesSlotResponse, error) { result := WebAppsListUsagesSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CsmUsageQuotaCollection); err != nil { - return WebAppsListUsagesSlotResponse{}, err + return WebAppsListUsagesSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -21008,7 +21015,7 @@ func (client *WebAppsClient) listVnetConnectionsCreateRequest(ctx context.Contex func (client *WebAppsClient) listVnetConnectionsHandleResponse(resp *http.Response) (WebAppsListVnetConnectionsResponse, error) { result := WebAppsListVnetConnectionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetInfoResourceArray); err != nil { - return WebAppsListVnetConnectionsResponse{}, err + return WebAppsListVnetConnectionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -21077,7 +21084,7 @@ func (client *WebAppsClient) listVnetConnectionsSlotCreateRequest(ctx context.Co func (client *WebAppsClient) listVnetConnectionsSlotHandleResponse(resp *http.Response) (WebAppsListVnetConnectionsSlotResponse, error) { result := WebAppsListVnetConnectionsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetInfoResourceArray); err != nil { - return WebAppsListVnetConnectionsSlotResponse{}, err + return WebAppsListVnetConnectionsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -21139,7 +21146,7 @@ func (client *WebAppsClient) listWebJobsCreateRequest(ctx context.Context, resou func (client *WebAppsClient) listWebJobsHandleResponse(resp *http.Response) (WebAppsListWebJobsResponse, error) { result := WebAppsListWebJobsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebJobCollection); err != nil { - return WebAppsListWebJobsResponse{}, err + return WebAppsListWebJobsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -21205,7 +21212,7 @@ func (client *WebAppsClient) listWebJobsSlotCreateRequest(ctx context.Context, r func (client *WebAppsClient) listWebJobsSlotHandleResponse(resp *http.Response) (WebAppsListWebJobsSlotResponse, error) { result := WebAppsListWebJobsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.WebJobCollection); err != nil { - return WebAppsListWebJobsSlotResponse{}, err + return WebAppsListWebJobsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -21423,7 +21430,7 @@ func (client *WebAppsClient) putPrivateAccessVnetCreateRequest(ctx context.Conte func (client *WebAppsClient) putPrivateAccessVnetHandleResponse(resp *http.Response) (WebAppsPutPrivateAccessVnetResponse, error) { result := WebAppsPutPrivateAccessVnetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateAccess); err != nil { - return WebAppsPutPrivateAccessVnetResponse{}, err + return WebAppsPutPrivateAccessVnetResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -21492,7 +21499,7 @@ func (client *WebAppsClient) putPrivateAccessVnetSlotCreateRequest(ctx context.C func (client *WebAppsClient) putPrivateAccessVnetSlotHandleResponse(resp *http.Response) (WebAppsPutPrivateAccessVnetSlotResponse, error) { result := WebAppsPutPrivateAccessVnetSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PrivateAccess); err != nil { - return WebAppsPutPrivateAccessVnetSlotResponse{}, err + return WebAppsPutPrivateAccessVnetSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -23138,7 +23145,7 @@ func (client *WebAppsClient) startWebSiteNetworkTraceCreateRequest(ctx context.C func (client *WebAppsClient) startWebSiteNetworkTraceHandleResponse(resp *http.Response) (WebAppsStartWebSiteNetworkTraceResponse, error) { result := WebAppsStartWebSiteNetworkTraceResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Value); err != nil { - return WebAppsStartWebSiteNetworkTraceResponse{}, err + return WebAppsStartWebSiteNetworkTraceResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -23390,7 +23397,7 @@ func (client *WebAppsClient) startWebSiteNetworkTraceSlotCreateRequest(ctx conte func (client *WebAppsClient) startWebSiteNetworkTraceSlotHandleResponse(resp *http.Response) (WebAppsStartWebSiteNetworkTraceSlotResponse, error) { result := WebAppsStartWebSiteNetworkTraceSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Value); err != nil { - return WebAppsStartWebSiteNetworkTraceSlotResponse{}, err + return WebAppsStartWebSiteNetworkTraceSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -24447,7 +24454,7 @@ func (client *WebAppsClient) updateCreateRequest(ctx context.Context, resourceGr func (client *WebAppsClient) updateHandleResponse(resp *http.Response) (WebAppsUpdateResponse, error) { result := WebAppsUpdateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Site); err != nil { - return WebAppsUpdateResponse{}, err + return WebAppsUpdateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -24512,7 +24519,7 @@ func (client *WebAppsClient) updateApplicationSettingsCreateRequest(ctx context. func (client *WebAppsClient) updateApplicationSettingsHandleResponse(resp *http.Response) (WebAppsUpdateApplicationSettingsResponse, error) { result := WebAppsUpdateApplicationSettingsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil { - return WebAppsUpdateApplicationSettingsResponse{}, err + return WebAppsUpdateApplicationSettingsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -24581,7 +24588,7 @@ func (client *WebAppsClient) updateApplicationSettingsSlotCreateRequest(ctx cont func (client *WebAppsClient) updateApplicationSettingsSlotHandleResponse(resp *http.Response) (WebAppsUpdateApplicationSettingsSlotResponse, error) { result := WebAppsUpdateApplicationSettingsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil { - return WebAppsUpdateApplicationSettingsSlotResponse{}, err + return WebAppsUpdateApplicationSettingsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -24646,7 +24653,7 @@ func (client *WebAppsClient) updateAuthSettingsCreateRequest(ctx context.Context func (client *WebAppsClient) updateAuthSettingsHandleResponse(resp *http.Response) (WebAppsUpdateAuthSettingsResponse, error) { result := WebAppsUpdateAuthSettingsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteAuthSettings); err != nil { - return WebAppsUpdateAuthSettingsResponse{}, err + return WebAppsUpdateAuthSettingsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -24715,7 +24722,7 @@ func (client *WebAppsClient) updateAuthSettingsSlotCreateRequest(ctx context.Con func (client *WebAppsClient) updateAuthSettingsSlotHandleResponse(resp *http.Response) (WebAppsUpdateAuthSettingsSlotResponse, error) { result := WebAppsUpdateAuthSettingsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteAuthSettings); err != nil { - return WebAppsUpdateAuthSettingsSlotResponse{}, err + return WebAppsUpdateAuthSettingsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -24780,7 +24787,7 @@ func (client *WebAppsClient) updateAuthSettingsV2CreateRequest(ctx context.Conte func (client *WebAppsClient) updateAuthSettingsV2HandleResponse(resp *http.Response) (WebAppsUpdateAuthSettingsV2Response, error) { result := WebAppsUpdateAuthSettingsV2Response{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteAuthSettingsV2); err != nil { - return WebAppsUpdateAuthSettingsV2Response{}, err + return WebAppsUpdateAuthSettingsV2Response{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -24849,7 +24856,7 @@ func (client *WebAppsClient) updateAuthSettingsV2SlotCreateRequest(ctx context.C func (client *WebAppsClient) updateAuthSettingsV2SlotHandleResponse(resp *http.Response) (WebAppsUpdateAuthSettingsV2SlotResponse, error) { result := WebAppsUpdateAuthSettingsV2SlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteAuthSettingsV2); err != nil { - return WebAppsUpdateAuthSettingsV2SlotResponse{}, err + return WebAppsUpdateAuthSettingsV2SlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -24914,7 +24921,7 @@ func (client *WebAppsClient) updateAzureStorageAccountsCreateRequest(ctx context func (client *WebAppsClient) updateAzureStorageAccountsHandleResponse(resp *http.Response) (WebAppsUpdateAzureStorageAccountsResponse, error) { result := WebAppsUpdateAzureStorageAccountsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AzureStoragePropertyDictionaryResource); err != nil { - return WebAppsUpdateAzureStorageAccountsResponse{}, err + return WebAppsUpdateAzureStorageAccountsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -24983,7 +24990,7 @@ func (client *WebAppsClient) updateAzureStorageAccountsSlotCreateRequest(ctx con func (client *WebAppsClient) updateAzureStorageAccountsSlotHandleResponse(resp *http.Response) (WebAppsUpdateAzureStorageAccountsSlotResponse, error) { result := WebAppsUpdateAzureStorageAccountsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AzureStoragePropertyDictionaryResource); err != nil { - return WebAppsUpdateAzureStorageAccountsSlotResponse{}, err + return WebAppsUpdateAzureStorageAccountsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -25048,7 +25055,7 @@ func (client *WebAppsClient) updateBackupConfigurationCreateRequest(ctx context. func (client *WebAppsClient) updateBackupConfigurationHandleResponse(resp *http.Response) (WebAppsUpdateBackupConfigurationResponse, error) { result := WebAppsUpdateBackupConfigurationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BackupRequest); err != nil { - return WebAppsUpdateBackupConfigurationResponse{}, err + return WebAppsUpdateBackupConfigurationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -25117,7 +25124,7 @@ func (client *WebAppsClient) updateBackupConfigurationSlotCreateRequest(ctx cont func (client *WebAppsClient) updateBackupConfigurationSlotHandleResponse(resp *http.Response) (WebAppsUpdateBackupConfigurationSlotResponse, error) { result := WebAppsUpdateBackupConfigurationSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BackupRequest); err != nil { - return WebAppsUpdateBackupConfigurationSlotResponse{}, err + return WebAppsUpdateBackupConfigurationSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -25182,7 +25189,7 @@ func (client *WebAppsClient) updateConfigurationCreateRequest(ctx context.Contex func (client *WebAppsClient) updateConfigurationHandleResponse(resp *http.Response) (WebAppsUpdateConfigurationResponse, error) { result := WebAppsUpdateConfigurationResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResource); err != nil { - return WebAppsUpdateConfigurationResponse{}, err + return WebAppsUpdateConfigurationResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -25251,7 +25258,7 @@ func (client *WebAppsClient) updateConfigurationSlotCreateRequest(ctx context.Co func (client *WebAppsClient) updateConfigurationSlotHandleResponse(resp *http.Response) (WebAppsUpdateConfigurationSlotResponse, error) { result := WebAppsUpdateConfigurationSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteConfigResource); err != nil { - return WebAppsUpdateConfigurationSlotResponse{}, err + return WebAppsUpdateConfigurationSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -25316,7 +25323,7 @@ func (client *WebAppsClient) updateConnectionStringsCreateRequest(ctx context.Co func (client *WebAppsClient) updateConnectionStringsHandleResponse(resp *http.Response) (WebAppsUpdateConnectionStringsResponse, error) { result := WebAppsUpdateConnectionStringsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionStringDictionary); err != nil { - return WebAppsUpdateConnectionStringsResponse{}, err + return WebAppsUpdateConnectionStringsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -25385,7 +25392,7 @@ func (client *WebAppsClient) updateConnectionStringsSlotCreateRequest(ctx contex func (client *WebAppsClient) updateConnectionStringsSlotHandleResponse(resp *http.Response) (WebAppsUpdateConnectionStringsSlotResponse, error) { result := WebAppsUpdateConnectionStringsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ConnectionStringDictionary); err != nil { - return WebAppsUpdateConnectionStringsSlotResponse{}, err + return WebAppsUpdateConnectionStringsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -25450,7 +25457,7 @@ func (client *WebAppsClient) updateDiagnosticLogsConfigCreateRequest(ctx context func (client *WebAppsClient) updateDiagnosticLogsConfigHandleResponse(resp *http.Response) (WebAppsUpdateDiagnosticLogsConfigResponse, error) { result := WebAppsUpdateDiagnosticLogsConfigResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteLogsConfig); err != nil { - return WebAppsUpdateDiagnosticLogsConfigResponse{}, err + return WebAppsUpdateDiagnosticLogsConfigResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -25519,7 +25526,7 @@ func (client *WebAppsClient) updateDiagnosticLogsConfigSlotCreateRequest(ctx con func (client *WebAppsClient) updateDiagnosticLogsConfigSlotHandleResponse(resp *http.Response) (WebAppsUpdateDiagnosticLogsConfigSlotResponse, error) { result := WebAppsUpdateDiagnosticLogsConfigSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteLogsConfig); err != nil { - return WebAppsUpdateDiagnosticLogsConfigSlotResponse{}, err + return WebAppsUpdateDiagnosticLogsConfigSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -25588,7 +25595,7 @@ func (client *WebAppsClient) updateDomainOwnershipIdentifierCreateRequest(ctx co func (client *WebAppsClient) updateDomainOwnershipIdentifierHandleResponse(resp *http.Response) (WebAppsUpdateDomainOwnershipIdentifierResponse, error) { result := WebAppsUpdateDomainOwnershipIdentifierResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Identifier); err != nil { - return WebAppsUpdateDomainOwnershipIdentifierResponse{}, err + return WebAppsUpdateDomainOwnershipIdentifierResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -25661,7 +25668,7 @@ func (client *WebAppsClient) updateDomainOwnershipIdentifierSlotCreateRequest(ct func (client *WebAppsClient) updateDomainOwnershipIdentifierSlotHandleResponse(resp *http.Response) (WebAppsUpdateDomainOwnershipIdentifierSlotResponse, error) { result := WebAppsUpdateDomainOwnershipIdentifierSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Identifier); err != nil { - return WebAppsUpdateDomainOwnershipIdentifierSlotResponse{}, err + return WebAppsUpdateDomainOwnershipIdentifierSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -25726,7 +25733,7 @@ func (client *WebAppsClient) updateFtpAllowedCreateRequest(ctx context.Context, func (client *WebAppsClient) updateFtpAllowedHandleResponse(resp *http.Response) (WebAppsUpdateFtpAllowedResponse, error) { result := WebAppsUpdateFtpAllowedResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CsmPublishingCredentialsPoliciesEntity); err != nil { - return WebAppsUpdateFtpAllowedResponse{}, err + return WebAppsUpdateFtpAllowedResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -25795,7 +25802,7 @@ func (client *WebAppsClient) updateFtpAllowedSlotCreateRequest(ctx context.Conte func (client *WebAppsClient) updateFtpAllowedSlotHandleResponse(resp *http.Response) (WebAppsUpdateFtpAllowedSlotResponse, error) { result := WebAppsUpdateFtpAllowedSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CsmPublishingCredentialsPoliciesEntity); err != nil { - return WebAppsUpdateFtpAllowedSlotResponse{}, err + return WebAppsUpdateFtpAllowedSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -25868,7 +25875,7 @@ func (client *WebAppsClient) updateHybridConnectionCreateRequest(ctx context.Con func (client *WebAppsClient) updateHybridConnectionHandleResponse(resp *http.Response) (WebAppsUpdateHybridConnectionResponse, error) { result := WebAppsUpdateHybridConnectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridConnection); err != nil { - return WebAppsUpdateHybridConnectionResponse{}, err + return WebAppsUpdateHybridConnectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -25945,7 +25952,7 @@ func (client *WebAppsClient) updateHybridConnectionSlotCreateRequest(ctx context func (client *WebAppsClient) updateHybridConnectionSlotHandleResponse(resp *http.Response) (WebAppsUpdateHybridConnectionSlotResponse, error) { result := WebAppsUpdateHybridConnectionSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.HybridConnection); err != nil { - return WebAppsUpdateHybridConnectionSlotResponse{}, err + return WebAppsUpdateHybridConnectionSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -26010,7 +26017,7 @@ func (client *WebAppsClient) updateMetadataCreateRequest(ctx context.Context, re func (client *WebAppsClient) updateMetadataHandleResponse(resp *http.Response) (WebAppsUpdateMetadataResponse, error) { result := WebAppsUpdateMetadataResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil { - return WebAppsUpdateMetadataResponse{}, err + return WebAppsUpdateMetadataResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -26079,7 +26086,7 @@ func (client *WebAppsClient) updateMetadataSlotCreateRequest(ctx context.Context func (client *WebAppsClient) updateMetadataSlotHandleResponse(resp *http.Response) (WebAppsUpdateMetadataSlotResponse, error) { result := WebAppsUpdateMetadataSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.StringDictionary); err != nil { - return WebAppsUpdateMetadataSlotResponse{}, err + return WebAppsUpdateMetadataSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -26148,7 +26155,7 @@ func (client *WebAppsClient) updatePremierAddOnCreateRequest(ctx context.Context func (client *WebAppsClient) updatePremierAddOnHandleResponse(resp *http.Response) (WebAppsUpdatePremierAddOnResponse, error) { result := WebAppsUpdatePremierAddOnResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PremierAddOn); err != nil { - return WebAppsUpdatePremierAddOnResponse{}, err + return WebAppsUpdatePremierAddOnResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -26221,7 +26228,7 @@ func (client *WebAppsClient) updatePremierAddOnSlotCreateRequest(ctx context.Con func (client *WebAppsClient) updatePremierAddOnSlotHandleResponse(resp *http.Response) (WebAppsUpdatePremierAddOnSlotResponse, error) { result := WebAppsUpdatePremierAddOnSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PremierAddOn); err != nil { - return WebAppsUpdatePremierAddOnSlotResponse{}, err + return WebAppsUpdatePremierAddOnSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -26290,7 +26297,7 @@ func (client *WebAppsClient) updateRelayServiceConnectionCreateRequest(ctx conte func (client *WebAppsClient) updateRelayServiceConnectionHandleResponse(resp *http.Response) (WebAppsUpdateRelayServiceConnectionResponse, error) { result := WebAppsUpdateRelayServiceConnectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RelayServiceConnectionEntity); err != nil { - return WebAppsUpdateRelayServiceConnectionResponse{}, err + return WebAppsUpdateRelayServiceConnectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -26363,7 +26370,7 @@ func (client *WebAppsClient) updateRelayServiceConnectionSlotCreateRequest(ctx c func (client *WebAppsClient) updateRelayServiceConnectionSlotHandleResponse(resp *http.Response) (WebAppsUpdateRelayServiceConnectionSlotResponse, error) { result := WebAppsUpdateRelayServiceConnectionSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.RelayServiceConnectionEntity); err != nil { - return WebAppsUpdateRelayServiceConnectionSlotResponse{}, err + return WebAppsUpdateRelayServiceConnectionSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -26428,7 +26435,7 @@ func (client *WebAppsClient) updateScmAllowedCreateRequest(ctx context.Context, func (client *WebAppsClient) updateScmAllowedHandleResponse(resp *http.Response) (WebAppsUpdateScmAllowedResponse, error) { result := WebAppsUpdateScmAllowedResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CsmPublishingCredentialsPoliciesEntity); err != nil { - return WebAppsUpdateScmAllowedResponse{}, err + return WebAppsUpdateScmAllowedResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -26497,7 +26504,7 @@ func (client *WebAppsClient) updateScmAllowedSlotCreateRequest(ctx context.Conte func (client *WebAppsClient) updateScmAllowedSlotHandleResponse(resp *http.Response) (WebAppsUpdateScmAllowedSlotResponse, error) { result := WebAppsUpdateScmAllowedSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.CsmPublishingCredentialsPoliciesEntity); err != nil { - return WebAppsUpdateScmAllowedSlotResponse{}, err + return WebAppsUpdateScmAllowedSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -26562,7 +26569,7 @@ func (client *WebAppsClient) updateSitePushSettingsCreateRequest(ctx context.Con func (client *WebAppsClient) updateSitePushSettingsHandleResponse(resp *http.Response) (WebAppsUpdateSitePushSettingsResponse, error) { result := WebAppsUpdateSitePushSettingsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PushSettings); err != nil { - return WebAppsUpdateSitePushSettingsResponse{}, err + return WebAppsUpdateSitePushSettingsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -26631,7 +26638,7 @@ func (client *WebAppsClient) updateSitePushSettingsSlotCreateRequest(ctx context func (client *WebAppsClient) updateSitePushSettingsSlotHandleResponse(resp *http.Response) (WebAppsUpdateSitePushSettingsSlotResponse, error) { result := WebAppsUpdateSitePushSettingsSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PushSettings); err != nil { - return WebAppsUpdateSitePushSettingsSlotResponse{}, err + return WebAppsUpdateSitePushSettingsSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -26700,7 +26707,7 @@ func (client *WebAppsClient) updateSlotCreateRequest(ctx context.Context, resour func (client *WebAppsClient) updateSlotHandleResponse(resp *http.Response) (WebAppsUpdateSlotResponse, error) { result := WebAppsUpdateSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.Site); err != nil { - return WebAppsUpdateSlotResponse{}, err + return WebAppsUpdateSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -26766,7 +26773,7 @@ func (client *WebAppsClient) updateSlotConfigurationNamesCreateRequest(ctx conte func (client *WebAppsClient) updateSlotConfigurationNamesHandleResponse(resp *http.Response) (WebAppsUpdateSlotConfigurationNamesResponse, error) { result := WebAppsUpdateSlotConfigurationNamesResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SlotConfigNamesResource); err != nil { - return WebAppsUpdateSlotConfigurationNamesResponse{}, err + return WebAppsUpdateSlotConfigurationNamesResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -26831,7 +26838,7 @@ func (client *WebAppsClient) updateSourceControlCreateRequest(ctx context.Contex func (client *WebAppsClient) updateSourceControlHandleResponse(resp *http.Response) (WebAppsUpdateSourceControlResponse, error) { result := WebAppsUpdateSourceControlResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteSourceControl); err != nil { - return WebAppsUpdateSourceControlResponse{}, err + return WebAppsUpdateSourceControlResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -26900,7 +26907,7 @@ func (client *WebAppsClient) updateSourceControlSlotCreateRequest(ctx context.Co func (client *WebAppsClient) updateSourceControlSlotHandleResponse(resp *http.Response) (WebAppsUpdateSourceControlSlotResponse, error) { result := WebAppsUpdateSourceControlSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SiteSourceControl); err != nil { - return WebAppsUpdateSourceControlSlotResponse{}, err + return WebAppsUpdateSourceControlSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -26967,7 +26974,7 @@ func (client *WebAppsClient) updateSwiftVirtualNetworkConnectionWithCheckCreateR func (client *WebAppsClient) updateSwiftVirtualNetworkConnectionWithCheckHandleResponse(resp *http.Response) (WebAppsUpdateSwiftVirtualNetworkConnectionWithCheckResponse, error) { result := WebAppsUpdateSwiftVirtualNetworkConnectionWithCheckResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SwiftVirtualNetwork); err != nil { - return WebAppsUpdateSwiftVirtualNetworkConnectionWithCheckResponse{}, err + return WebAppsUpdateSwiftVirtualNetworkConnectionWithCheckResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -27038,7 +27045,7 @@ func (client *WebAppsClient) updateSwiftVirtualNetworkConnectionWithCheckSlotCre func (client *WebAppsClient) updateSwiftVirtualNetworkConnectionWithCheckSlotHandleResponse(resp *http.Response) (WebAppsUpdateSwiftVirtualNetworkConnectionWithCheckSlotResponse, error) { result := WebAppsUpdateSwiftVirtualNetworkConnectionWithCheckSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SwiftVirtualNetwork); err != nil { - return WebAppsUpdateSwiftVirtualNetworkConnectionWithCheckSlotResponse{}, err + return WebAppsUpdateSwiftVirtualNetworkConnectionWithCheckSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -27107,7 +27114,7 @@ func (client *WebAppsClient) updateVnetConnectionCreateRequest(ctx context.Conte func (client *WebAppsClient) updateVnetConnectionHandleResponse(resp *http.Response) (WebAppsUpdateVnetConnectionResponse, error) { result := WebAppsUpdateVnetConnectionResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetInfoResource); err != nil { - return WebAppsUpdateVnetConnectionResponse{}, err + return WebAppsUpdateVnetConnectionResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -27180,7 +27187,7 @@ func (client *WebAppsClient) updateVnetConnectionGatewayCreateRequest(ctx contex func (client *WebAppsClient) updateVnetConnectionGatewayHandleResponse(resp *http.Response) (WebAppsUpdateVnetConnectionGatewayResponse, error) { result := WebAppsUpdateVnetConnectionGatewayResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetGateway); err != nil { - return WebAppsUpdateVnetConnectionGatewayResponse{}, err + return WebAppsUpdateVnetConnectionGatewayResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -27257,7 +27264,7 @@ func (client *WebAppsClient) updateVnetConnectionGatewaySlotCreateRequest(ctx co func (client *WebAppsClient) updateVnetConnectionGatewaySlotHandleResponse(resp *http.Response) (WebAppsUpdateVnetConnectionGatewaySlotResponse, error) { result := WebAppsUpdateVnetConnectionGatewaySlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetGateway); err != nil { - return WebAppsUpdateVnetConnectionGatewaySlotResponse{}, err + return WebAppsUpdateVnetConnectionGatewaySlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -27330,7 +27337,7 @@ func (client *WebAppsClient) updateVnetConnectionSlotCreateRequest(ctx context.C func (client *WebAppsClient) updateVnetConnectionSlotHandleResponse(resp *http.Response) (WebAppsUpdateVnetConnectionSlotResponse, error) { result := WebAppsUpdateVnetConnectionSlotResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetInfoResource); err != nil { - return WebAppsUpdateVnetConnectionSlotResponse{}, err + return WebAppsUpdateVnetConnectionSlotResponse{}, runtime.NewResponseError(err, resp) } return result, nil } diff --git a/sdk/resourcemanager/web/armweb/zz_generated_websitemanagementclient_client.go b/sdk/resourcemanager/web/armweb/zz_generated_websitemanagementclient_client.go index 5d203a8b4409..2d012a9082a8 100644 --- a/sdk/resourcemanager/web/armweb/zz_generated_websitemanagementclient_client.go +++ b/sdk/resourcemanager/web/armweb/zz_generated_websitemanagementclient_client.go @@ -12,14 +12,15 @@ import ( "context" "errors" "fmt" + "github.com/Azure/azure-sdk-for-go/sdk/azcore" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" + armruntime "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm/runtime" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" + "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" "net/http" "net/url" "strconv" "strings" - - "github.com/Azure/azure-sdk-for-go/sdk/azcore/arm" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/policy" - "github.com/Azure/azure-sdk-for-go/sdk/azcore/runtime" ) // WebSiteManagementClient contains the methods for the WebSiteManagementClient group. @@ -31,8 +32,15 @@ type WebSiteManagementClient struct { } // NewWebSiteManagementClient creates a new instance of WebSiteManagementClient with the specified values. -func NewWebSiteManagementClient(con *arm.Connection, subscriptionID string) *WebSiteManagementClient { - return &WebSiteManagementClient{ep: con.Endpoint(), pl: con.NewPipeline(module, version), subscriptionID: subscriptionID} +func NewWebSiteManagementClient(subscriptionID string, credential azcore.TokenCredential, options *arm.ClientOptions) *WebSiteManagementClient { + cp := arm.ClientOptions{} + if options != nil { + cp = *options + } + if len(cp.Host) == 0 { + cp.Host = arm.AzurePublicCloud + } + return &WebSiteManagementClient{subscriptionID: subscriptionID, ep: string(cp.Host), pl: armruntime.NewPipeline(module, version, credential, &cp)} } // CheckNameAvailability - Description for Check if a resource name is available. @@ -74,7 +82,7 @@ func (client *WebSiteManagementClient) checkNameAvailabilityCreateRequest(ctx co func (client *WebSiteManagementClient) checkNameAvailabilityHandleResponse(resp *http.Response) (WebSiteManagementClientCheckNameAvailabilityResponse, error) { result := WebSiteManagementClientCheckNameAvailabilityResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ResourceNameAvailability); err != nil { - return WebSiteManagementClientCheckNameAvailabilityResponse{}, err + return WebSiteManagementClientCheckNameAvailabilityResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -127,7 +135,7 @@ func (client *WebSiteManagementClient) generateGithubAccessTokenForAppserviceCLI func (client *WebSiteManagementClient) generateGithubAccessTokenForAppserviceCLIAsyncHandleResponse(resp *http.Response) (WebSiteManagementClientGenerateGithubAccessTokenForAppserviceCLIAsyncResponse, error) { result := WebSiteManagementClientGenerateGithubAccessTokenForAppserviceCLIAsyncResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.AppserviceGithubToken); err != nil { - return WebSiteManagementClientGenerateGithubAccessTokenForAppserviceCLIAsyncResponse{}, err + return WebSiteManagementClientGenerateGithubAccessTokenForAppserviceCLIAsyncResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -180,7 +188,7 @@ func (client *WebSiteManagementClient) getPublishingUserCreateRequest(ctx contex func (client *WebSiteManagementClient) getPublishingUserHandleResponse(resp *http.Response) (WebSiteManagementClientGetPublishingUserResponse, error) { result := WebSiteManagementClientGetPublishingUserResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.User); err != nil { - return WebSiteManagementClientGetPublishingUserResponse{}, err + return WebSiteManagementClientGetPublishingUserResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -237,7 +245,7 @@ func (client *WebSiteManagementClient) getSourceControlCreateRequest(ctx context func (client *WebSiteManagementClient) getSourceControlHandleResponse(resp *http.Response) (WebSiteManagementClientGetSourceControlResponse, error) { result := WebSiteManagementClientGetSourceControlResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SourceControl); err != nil { - return WebSiteManagementClientGetSourceControlResponse{}, err + return WebSiteManagementClientGetSourceControlResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -294,7 +302,7 @@ func (client *WebSiteManagementClient) getSubscriptionDeploymentLocationsCreateR func (client *WebSiteManagementClient) getSubscriptionDeploymentLocationsHandleResponse(resp *http.Response) (WebSiteManagementClientGetSubscriptionDeploymentLocationsResponse, error) { result := WebSiteManagementClientGetSubscriptionDeploymentLocationsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.DeploymentLocations); err != nil { - return WebSiteManagementClientGetSubscriptionDeploymentLocationsResponse{}, err + return WebSiteManagementClientGetSubscriptionDeploymentLocationsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -354,7 +362,7 @@ func (client *WebSiteManagementClient) listBillingMetersCreateRequest(ctx contex func (client *WebSiteManagementClient) listBillingMetersHandleResponse(resp *http.Response) (WebSiteManagementClientListBillingMetersResponse, error) { result := WebSiteManagementClientListBillingMetersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.BillingMeterCollection); err != nil { - return WebSiteManagementClientListBillingMetersResponse{}, err + return WebSiteManagementClientListBillingMetersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -420,7 +428,7 @@ func (client *WebSiteManagementClient) listGeoRegionsCreateRequest(ctx context.C func (client *WebSiteManagementClient) listGeoRegionsHandleResponse(resp *http.Response) (WebSiteManagementClientListGeoRegionsResponse, error) { result := WebSiteManagementClientListGeoRegionsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.GeoRegionCollection); err != nil { - return WebSiteManagementClientListGeoRegionsResponse{}, err + return WebSiteManagementClientListGeoRegionsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -474,7 +482,7 @@ func (client *WebSiteManagementClient) listPremierAddOnOffersCreateRequest(ctx c func (client *WebSiteManagementClient) listPremierAddOnOffersHandleResponse(resp *http.Response) (WebSiteManagementClientListPremierAddOnOffersResponse, error) { result := WebSiteManagementClientListPremierAddOnOffersResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.PremierAddOnOfferCollection); err != nil { - return WebSiteManagementClientListPremierAddOnOffersResponse{}, err + return WebSiteManagementClientListPremierAddOnOffersResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -531,7 +539,7 @@ func (client *WebSiteManagementClient) listSKUsCreateRequest(ctx context.Context func (client *WebSiteManagementClient) listSKUsHandleResponse(resp *http.Response) (WebSiteManagementClientListSKUsResponse, error) { result := WebSiteManagementClientListSKUsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SKUInfos); err != nil { - return WebSiteManagementClientListSKUsResponse{}, err + return WebSiteManagementClientListSKUsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -585,7 +593,7 @@ func (client *WebSiteManagementClient) listSiteIdentifiersAssignedToHostNameCrea func (client *WebSiteManagementClient) listSiteIdentifiersAssignedToHostNameHandleResponse(resp *http.Response) (WebSiteManagementClientListSiteIdentifiersAssignedToHostNameResponse, error) { result := WebSiteManagementClientListSiteIdentifiersAssignedToHostNameResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.IdentifierCollection); err != nil { - return WebSiteManagementClientListSiteIdentifiersAssignedToHostNameResponse{}, err + return WebSiteManagementClientListSiteIdentifiersAssignedToHostNameResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -635,7 +643,7 @@ func (client *WebSiteManagementClient) listSourceControlsCreateRequest(ctx conte func (client *WebSiteManagementClient) listSourceControlsHandleResponse(resp *http.Response) (WebSiteManagementClientListSourceControlsResponse, error) { result := WebSiteManagementClientListSourceControlsResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SourceControlCollection); err != nil { - return WebSiteManagementClientListSourceControlsResponse{}, err + return WebSiteManagementClientListSourceControlsResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -740,7 +748,7 @@ func (client *WebSiteManagementClient) updatePublishingUserCreateRequest(ctx con func (client *WebSiteManagementClient) updatePublishingUserHandleResponse(resp *http.Response) (WebSiteManagementClientUpdatePublishingUserResponse, error) { result := WebSiteManagementClientUpdatePublishingUserResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.User); err != nil { - return WebSiteManagementClientUpdatePublishingUserResponse{}, err + return WebSiteManagementClientUpdatePublishingUserResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -797,7 +805,7 @@ func (client *WebSiteManagementClient) updateSourceControlCreateRequest(ctx cont func (client *WebSiteManagementClient) updateSourceControlHandleResponse(resp *http.Response) (WebSiteManagementClientUpdateSourceControlResponse, error) { result := WebSiteManagementClientUpdateSourceControlResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.SourceControl); err != nil { - return WebSiteManagementClientUpdateSourceControlResponse{}, err + return WebSiteManagementClientUpdateSourceControlResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -858,7 +866,7 @@ func (client *WebSiteManagementClient) validateCreateRequest(ctx context.Context func (client *WebSiteManagementClient) validateHandleResponse(resp *http.Response) (WebSiteManagementClientValidateResponse, error) { result := WebSiteManagementClientValidateResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.ValidateResponse); err != nil { - return WebSiteManagementClientValidateResponse{}, err + return WebSiteManagementClientValidateResponse{}, runtime.NewResponseError(err, resp) } return result, nil } @@ -968,7 +976,7 @@ func (client *WebSiteManagementClient) verifyHostingEnvironmentVnetCreateRequest func (client *WebSiteManagementClient) verifyHostingEnvironmentVnetHandleResponse(resp *http.Response) (WebSiteManagementClientVerifyHostingEnvironmentVnetResponse, error) { result := WebSiteManagementClientVerifyHostingEnvironmentVnetResponse{RawResponse: resp} if err := runtime.UnmarshalAsJSON(resp, &result.VnetValidationFailureDetails); err != nil { - return WebSiteManagementClientVerifyHostingEnvironmentVnetResponse{}, err + return WebSiteManagementClientVerifyHostingEnvironmentVnetResponse{}, runtime.NewResponseError(err, resp) } return result, nil }